diff --git a/make/rpmdist.mk b/make/rpmdist.mk index 5cae4227..57f63c89 100644 --- a/make/rpmdist.mk +++ b/make/rpmdist.mk @@ -56,7 +56,6 @@ ftag: ftag.dist rpm-upload-stable: rpm-upload-STABLE.dist rpm-upload-rc: rpm-upload-RC.dist -rpm-release: update-repo.dist rpm-clean: clean.rpm rpm-uninstall: rpmuninstall.dist rpm-install: rpminstall.dist @@ -138,6 +137,76 @@ update-repo.dist: upload.dist ssh -l root $(FTP_HOST) /etc/cron.hourly/create_packet_descriptions.sh touch $@ -echo-generated: - @echo GENERATED = $(GENERATED) +# ------ hash stuff +define cvs_files + for d in `find . | sed '/CVS\/Entries$$/ !d; s%CVS/Entries%%'`; do \ + sed "/^\// !d; s%^/%%; s%/.*%%; s%^%$$d%" $$d/CVS/Entries ;\ + done +endef + +CHECK_CVS_STATUS_BEFORE_INCREASING_BUILD_NUMBER ?= true + +define increase_build_number + if [ "$(CHECK_CVS_STATUS_BEFORE_INCREASING_BUILD_NUMBER)" = true ]; then \ + echo + checking cvs ;\ + cvs status > cvs_status.tmp 2>&1;\ + if [ $$? != 0 ]; then \ + cat cvs_status.tmp ;\ + echo -e "\n======== cvs status failed, giving up." >&2 ;\ + exit 1 ;\ + fi ;\ + if grep -qi "locally modified" cvs_status.tmp; then \ + echo + tried to increase build number on cvs copy with locally modified files, giving up >&2 ;\ + exit 1 ;\ + fi ;\ + if grep -qi "needs" cvs_status.tmp; then \ + echo + tried to increase build number on out-of-date cvs copy, giving up >&2 ;\ + exit 1 ;\ + fi ;\ + fi ;\ + echo $(MAJOR_MINOR_RELEASE)-$(shell expr $(BUILD_NUMBER) + 1)-dev | tee VERSION ;\ + echo $(HASH) > HASH ;\ + if ! grep -q HASH CVS/Entries; then \ + echo cvs add HASH ;\ + fi ;\ + echo cvs commit -m "o $(VERSION)" HASH VERSION +endef + +HASH = $(shell $(cvs_files) | grep -v "CHANGES\|VERSION\|HASH\|MD5SUMS" | xargs md5sum | md5sum | sed 's/ .*//') +LAST_RPM_VERSION = $(shell cat $(TOPDIR)/LAST_RPM_VERSION >/dev/null 2>&1) + +md5clean: + rm -f HASH + +md5: + echo $(HASH) > HASH + +rpm-update-release: + @if [ "`cat HASH`" != "$(HASH)" ]; then \ + echo + source was modified ;\ + $(increase_build_number) ;\ + else \ + echo + source is unmodified, new build unnecessary ;\ + fi + +rpm-check-release: + @if [ "`cat HASH`" != "$(HASH)" ]; then \ + echo + source was modified ;\ + else \ + echo + source is unmodified, new build unnecessary ;\ + fi + +rpm-next-build: + $(increase_build_number) + +rpm-release: rpm-update-release + if [ "$(VERSION)" != "$(LAST_RPM_VERSION)" ]; then ;\ + echo make update-repo.dist ;\ + cp VERSION LAST_RPM_VERSION ;\ + if ! grep -q LAST_RPM_VERSION CVS/Entries; then + cvs add LAST_RPM_VERSION ;\ + fi ;\ + echo cvs commit -m "o $(VERSION)" LAST_RPM_VERSION ;\ + fi +