diff --git a/Makefile b/Makefile index d64cdfabb9..b206111e90 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ MASTER_BRANCH=master # upstream solution). For upstream builds N_REL=1; N_REL=`_NR=$${PR:+0}; if test "$${_NR:-1}" == "1"; then _NR=$${MR:+0}; fi; git rev-parse --abbrev-ref HEAD | grep -qE "^($(MASTER_BRANCH)|stable)$$" || _NR=0; echo $${_NR:-1}` -TIMESTAMP=`date +%Y%m%d%H%MZ -u` +_TIMESTAMP=$${TIMESTAMP:-`date +%Y%m%d%H%MZ -u`} SHORT_SHA=`git rev-parse --short HEAD` BRANCH=`git rev-parse --abbrev-ref HEAD | tr '-' '_'` @@ -33,7 +33,7 @@ REQUEST=`if test -n "$$PR"; then echo ".PR$${PR}"; elif test -n "$$MR"; then ech # 0.201810080027Z.4078402.packaging # 0.201810080027Z.4078402.master.MR2 # 1.201810080027Z.4078402.master -RELEASE="$(N_REL).$(TIMESTAMP).$(SHORT_SHA).$(BRANCH)$(REQUEST)$(_SUFFIX)" +RELEASE="$(N_REL).$(_TIMESTAMP).$(SHORT_SHA).$(BRANCH)$(REQUEST)$(_SUFFIX)" all: help @@ -61,7 +61,13 @@ help: @echo " MR=6 COPR_CONFIG='path/to/the/config/copr/file' " @echo "" -clean: +# To ensure the TIMESTAMP will be same during the whole process, call the make +# again with the expected parameters and with the set TIMESTAMP. By this magic +# the TIMESTAMP will not be changed, even when some commands takes minutes. +_remake: + @if test -z "$$TIMESTAMP"; then TIMESTAMP=$(_TIMESTAMP) $(MAKE) $@; exit 0; fi + +clean: _remake @echo "--- Clean repo ---" @rm -rf packaging/{sources,SRPMS,tmp}/ @rm -rf build/ dist/ *.egg-info @@ -125,7 +131,7 @@ copr_build: srpm @copr --config $(_COPR_CONFIG) build $(_COPR_REPO) \ packaging/SRPMS/${PKGNAME}-${VERSION}-${RELEASE}*.src.rpm -print_release: +print_release: _remake @echo $(RELEASE) # Before doing anything, it is good idea to register repos to ensure everything