blob: 40eb121b490a125e9df149e78080f5e9c4039aea [file] [log] [blame]
Max031ac912017-08-25 14:22:18 +02001ifndef REL
2 REL := patch
Maxff932bb2017-07-04 18:19:38 +02003endif
4
Max98f64822017-09-04 17:15:13 +02005BUMPVER := $(shell bumpversion)
Max031ac912017-08-25 14:22:18 +02006NEW_VER := $(shell bumpversion --list --current-version $(VERSION) $(REL) --allow-dirty | awk -F '=' '{ print $$2 }')
7LIBVERS := $(shell git grep -n LIBVERSION | grep '=' | grep am | grep -v LDFLAGS)
8MAKEMOD := $(shell git diff -GLIBVERSION --stat | grep Makefile.am)
9ISODATE := $(shell date -I)
10
Maxff932bb2017-07-04 18:19:38 +020011release:
Max031ac912017-08-25 14:22:18 +020012
Max98f64822017-09-04 17:15:13 +020013ifeq ($(BUMPVER),)
14 @$(error Unable to find 'bumpversion' command.)
15endif
16
Max031ac912017-08-25 14:22:18 +020017ifeq ($(NEW_VER),)
18 @$(error Please fix versioning to match http://semver.org/ spec (current is $(VERSION)) before proceeding.)
Maxff932bb2017-07-04 18:19:38 +020019endif
Max031ac912017-08-25 14:22:18 +020020
21ifeq ($(origin REL), file)
22 @echo "No REL value specified, defaulting to 'patch' release"
23endif
24
25 @echo "Releasing" $(VERSION) "->" $(NEW_VER)"..."
26
Maxff932bb2017-07-04 18:19:38 +020027ifeq ($(LIBVERS),)
Maxd5962a82017-08-24 13:24:04 +020028 @gbp dch --debian-tag='%(version)s' --auto --meta --git-author --multimaint-merge --ignore-branch
Maxff932bb2017-07-04 18:19:38 +020029else
30 @echo "You should NOT be doing this unless you've read and understood following article:"
31 @echo "https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info"
Max031ac912017-08-25 14:22:18 +020032 @grep -v '#' TODO-RELEASE | sed 's/\t\+/: /g' > TODO-RELEASE.entries
Maxff932bb2017-07-04 18:19:38 +020033 @grep '#' TODO-RELEASE > TODO-RELEASE.clean
34 @mv TODO-RELEASE.clean TODO-RELEASE
Max031ac912017-08-25 14:22:18 +020035ifeq ($(MAKEMOD),)
36 @$(if $(shell git status -s -uno TODO-RELEASE),,$(error Before releasing, please modify some of the libversions: $(LIBVERS)))
Maxff932bb2017-07-04 18:19:38 +020037endif
Max031ac912017-08-25 14:22:18 +020038 @xargs -a TODO-RELEASE.entries -r -d'\n' -I entry dch -m -v $(NEW_VER) "entry"
39endif
40 @dch -r -m --distribution "unstable" ""
Maxff932bb2017-07-04 18:19:38 +020041 @git add -u
Max031ac912017-08-25 14:22:18 +020042 @bumpversion --current-version $(VERSION) $(REL) --tag --commit --tag-name $(NEW_VER) --allow-dirty
43 @git tag -s $(NEW_VER) -f -m "Release v$(NEW_VER) on $(ISODATE)."
44 @echo "Release" $(NEW_VER) "prepared, tagged and signed."