Skip to content

Commit ac4a607

Browse files
support defining the release number
1 parent bf7b319 commit ac4a607

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Makefile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
NAME=mongodb_consistent_backup
55
BIN_NAME?=mongodb-consistent-backup
66
VERSION=$(shell cat VERSION | cut -d- -f1)
7+
RELEASE?=1
78
GIT_COMMIT?=$(shell git show 2>/dev/null | awk 'NR==1{print $$2}')
89
PREFIX?=/usr/local
910
ARCH?=x86_64
@@ -17,7 +18,7 @@ MAKE_DIR=$(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
1718
all: bin/$(BIN_NAME)
1819

1920
bin/$(BIN_NAME): setup.py requirements.txt README.rst VERSION scripts/build.sh $(NAME)/*.py $(NAME)/*/*.py $(NAME)/*/*/*.py
20-
BIN_NAME=$(BIN_NAME) GIT_COMMIT=$(GIT_COMMIT) PYTHON_BIN=$(PYTHON_BIN) VIRTUALENV_BIN=$(VIRTUALENV_BIN) bash scripts/build.sh
21+
BIN_NAME=$(BIN_NAME) RELEASE=$(RELEASE) GIT_COMMIT=$(GIT_COMMIT) PYTHON_BIN=$(PYTHON_BIN) VIRTUALENV_BIN=$(VIRTUALENV_BIN) bash scripts/build.sh
2122

2223
install: bin/$(BIN_NAME)
2324
mkdir -p $(BINDIR) $(SHAREDIR)/$(NAME) || true
@@ -35,14 +36,14 @@ rpm: bin/$(BIN_NAME)
3536
cp -f $(MAKE_DIR)/{LICENSE,README.rst} build/rpm/SOURCES
3637
cp -f $(MAKE_DIR)/bin/$(BIN_NAME) build/rpm/SOURCES/mongodb-consistent-backup
3738
cp -f $(MAKE_DIR)/conf/mongodb-consistent-backup.example.conf build/rpm/SOURCES/mongodb-consistent-backup.conf
38-
rpmbuild -D "_topdir $(MAKE_DIR)/build/rpm" -D "version $(VERSION)" -bb $(MAKE_DIR)/scripts/$(NAME).spec
39+
rpmbuild -D "_topdir $(MAKE_DIR)/build/rpm" -D "version $(VERSION)" -D "release $(RELEASE)" -bb $(MAKE_DIR)/scripts/$(NAME).spec
3940

4041
uninstall:
4142
rm -f $(BINDIR)/mongodb-consistent-backup
4243
rm -rf $(SHAREDIR)/$(NAME)
4344

4445
# Build CentOS7 RPM (in Docker)
45-
build/rpm/RPMS/$(ARCH)/$(NAME)-$(VERSION)-1.el7.centos.$(ARCH).rpm:
46+
build/rpm/RPMS/$(ARCH)/$(NAME)-$(VERSION)-$(RELEASE).el7.centos.$(ARCH).rpm:
4647
mkdir -p $(MAKE_DIR)/build/rpm/RPMS/$(ARCH)
4748
docker run --rm \
4849
-v "$(MAKE_DIR)/bin:/src/bin:Z" \
@@ -59,7 +60,7 @@ build/rpm/RPMS/$(ARCH)/$(NAME)-$(VERSION)-1.el7.centos.$(ARCH).rpm:
5960
-v "$(MAKE_DIR)/build/rpm/RPMS/$(ARCH):/src/build/rpm/RPMS/$(ARCH):Z" \
6061
-it centos:centos7 \
6162
/bin/bash -c "yum install -y python-devel python-virtualenv gcc make libffi-devel openssl-devel rpm-build && \
62-
make -C /src GIT_COMMIT=$(GIT_COMMIT) BIN_NAME=mongodb-consistent-backup.el7.centos.$(ARCH) rpm && \
63+
make -C /src RELEASE=$(RELEASE) GIT_COMMIT=$(GIT_COMMIT) BIN_NAME=mongodb-consistent-backup.el7.centos.$(ARCH) rpm && \
6364
/src/bin/mongodb-consistent-backup.el7.centos.$(ARCH) --version"
6465

6566
centos7: build/rpm/RPMS/$(ARCH)/$(NAME)-$(VERSION)-1.el7.centos.$(ARCH).rpm
@@ -80,7 +81,7 @@ bin/mongodb-consistent-backup.debian8.$(ARCH):
8081
-v "$(MAKE_DIR)/VERSION:/src/VERSION:Z" \
8182
-it debian:jessie \
8283
/bin/bash -c "apt-get update && apt-get install -y python2.7-minimal python2.7-dev python-virtualenv gcc make libffi-dev libssl-dev && \
83-
make -C /src GIT_COMMIT=$(GIT_COMMIT) BIN_NAME=mongodb-consistent-backup.debian8.$(ARCH).tmp && \
84+
make -C /src RELEASE=$(RELEASE) GIT_COMMIT=$(GIT_COMMIT) BIN_NAME=mongodb-consistent-backup.debian8.$(ARCH).tmp && \
8485
mv -vf /src/bin/mongodb-consistent-backup.debian8.$(ARCH).tmp /src/bin/mongodb-consistent-backup.debian8.$(ARCH) && \
8586
/src/bin/mongodb-consistent-backup.debian8.$(ARCH) --version"
8687

@@ -102,13 +103,13 @@ bin/mongodb-consistent-backup.debian9.$(ARCH):
102103
-v "$(MAKE_DIR)/VERSION:/src/VERSION:Z" \
103104
-it debian:stretch \
104105
/bin/bash -c "apt-get update && apt-get install -y python2.7-minimal python2.7-dev python-virtualenv gcc make libffi-dev libssl-dev && \
105-
make -C /src GIT_COMMIT=$(GIT_COMMIT) BIN_NAME=mongodb-consistent-backup.debian9.$(ARCH).tmp && \
106+
make -C /src RELEASE=$(RELEASE) GIT_COMMIT=$(GIT_COMMIT) BIN_NAME=mongodb-consistent-backup.debian9.$(ARCH).tmp && \
106107
mv -vf /src/bin/mongodb-consistent-backup.debian9.$(ARCH).tmp /src/bin/mongodb-consistent-backup.debian9.$(ARCH) && \
107108
/src/bin/mongodb-consistent-backup.debian9.$(ARCH) --version"
108109

109110
debian9: bin/mongodb-consistent-backup.debian9.$(ARCH)
110111

111-
docker: build/rpm/RPMS/$(ARCH)/$(NAME)-$(VERSION)-1.el7.centos.$(ARCH).rpm
112+
docker: build/rpm/RPMS/$(ARCH)/$(NAME)-$(VERSION)-$(RELEASE).el7.centos.$(ARCH).rpm
112113
docker build --no-cache --tag $(DOCKER_TAG) .
113114
docker tag $(DOCKER_TAG) $(NAME):latest
114115
docker run --rm -it $(DOCKER_TAG) --version

scripts/mongodb_consistent_backup.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
Name: mongodb_consistent_backup
99
Version: %{version}
10-
Release: 1%{?dist}
10+
Release: %{release}%{?dist}
1111
Summary: MongoDB Consistent Backup Tool
1212

1313
Group: Software/Database

0 commit comments

Comments
 (0)