Update release helper
* add reference to semver spec
* use 'patch' release by default
* unify debian/changelog distro update for library and non-library
projects
* abort library release for non-empty TODO-RELEASE if libversion is not
modified
Change-Id: I413f99cbfa6e6dcc753e3be9fc3c8d682e6a41f3
Related: OS#1861
diff --git a/osmo-release.mk b/osmo-release.mk
index 3fe6803..03eb3cb 100644
--- a/osmo-release.mk
+++ b/osmo-release.mk
@@ -1,28 +1,39 @@
-ifdef REL
-NEW_VERSION := $(shell bumpversion --list --current-version $(VERSION) $(REL) --allow-dirty | awk -F '=' '{ print $$2 }')
-LIBVERS := $(shell git grep -n LIBVERSION | grep '=' | grep am | grep -v LDFLAGS)
-ISODATE := $(shell date -I)
+ifndef REL
+ REL := patch
endif
+NEW_VER := $(shell bumpversion --list --current-version $(VERSION) $(REL) --allow-dirty | awk -F '=' '{ print $$2 }')
+LIBVERS := $(shell git grep -n LIBVERSION | grep '=' | grep am | grep -v LDFLAGS)
+MAKEMOD := $(shell git diff -GLIBVERSION --stat | grep Makefile.am)
+ISODATE := $(shell date -I)
+
release:
-ifeq ($(NEW_VERSION),)
- @$(error Failed to determine NEW_VERSION - please fix versioning (current is $(VERSION)) before proceeding with the release)
+
+ifeq ($(NEW_VER),)
+ @$(error Please fix versioning to match http://semver.org/ spec (current is $(VERSION)) before proceeding.)
endif
- @echo "Releasing" $(VERSION) "->" $(NEW_VERSION)"..."
+
+ifeq ($(origin REL), file)
+ @echo "No REL value specified, defaulting to 'patch' release"
+endif
+
+ @echo "Releasing" $(VERSION) "->" $(NEW_VER)"..."
+
ifeq ($(LIBVERS),)
@gbp dch --debian-tag='%(version)s' --auto --meta --git-author --multimaint-merge --ignore-branch
else
@echo "You should NOT be doing this unless you've read and understood following article:"
@echo "https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info"
- @grep -v '#' TODO-RELEASE | sed 's/\t\+/:/g' | xargs -d'\n' -I entry dch -m -v $(NEW_VERSION) "entry"
- @dch -r -m --distribution "unstable" ""
+ @grep -v '#' TODO-RELEASE | sed 's/\t\+/: /g' > TODO-RELEASE.entries
@grep '#' TODO-RELEASE > TODO-RELEASE.clean
@mv TODO-RELEASE.clean TODO-RELEASE
- @echo "Do NOT push the release commit if you have not adjusted LIBVERSION in preceeding commit!!!"
- @echo "Are you sure the following versions are correct?"
- @echo $(LIBVERS)
+ifeq ($(MAKEMOD),)
+ @$(if $(shell git status -s -uno TODO-RELEASE),,$(error Before releasing, please modify some of the libversions: $(LIBVERS)))
endif
+ @xargs -a TODO-RELEASE.entries -r -d'\n' -I entry dch -m -v $(NEW_VER) "entry"
+endif
+ @dch -r -m --distribution "unstable" ""
@git add -u
- @bumpversion --current-version $(VERSION) $(REL) --tag --commit --tag-name $(NEW_VERSION) --allow-dirty
- @git tag -s $(NEW_VERSION) -f -m "Release v$(NEW_VERSION) on $(ISODATE)."
- @echo "Release" $(NEW_VERSION) "prepared, tagged and signed."
+ @bumpversion --current-version $(VERSION) $(REL) --tag --commit --tag-name $(NEW_VER) --allow-dirty
+ @git tag -s $(NEW_VER) -f -m "Release v$(NEW_VER) on $(ISODATE)."
+ @echo "Release" $(NEW_VER) "prepared, tagged and signed."