Harald Welte has submitted this change and it was merged.

Change subject: Add release target to Makefile

Add release target to Makefile

Add simple helper target to automate basic release steps:
* version bump
* prepare release commit
* git commit, tag and sign

For library projects:
* update debian/changelog from TODO-RELEASE
* cleanup TODO-RELEASE

For non-library projects:
* update debian/changelog from git log

Note: it requires bumpversion package to be installed, debian/control is
adjusted accordingly. The helper itself is installed to facilitate reuse
by other libraries.

N. B: you still have to manually adjust LIBVERSION in previous commit -
see TODO-RELEASE header for details.

Use it as follows:
make REL=minor release

The REL parameter defines which component of the version [1] to bump and
can be any of { major, minor, patch }.

[1] http://semver.org/

Change-Id: I790ceb958195b9f6cbabfe8c977dc30e2bd7414b
Related: OS#1861
M Makefile.am
M configure.ac
M debian/control
A osmo-release.mk
4 files changed, 41 insertions(+), 1 deletion(-)

  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified

diff --git a/Makefile.am b/Makefile.am
index b8de3ca..8b35856 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,13 +7,20 @@
 pkgconfig_DATA = libosmocore.pc libosmocodec.pc libosmovty.pc libosmogsm.pc \
                 libosmogb.pc libosmoctrl.pc libosmocoding.pc
+relengdir = $(includedir)
+releng_DATA = osmo-release.mk
+osmo-release.mk: git-version-gen
 BUILT_SOURCES = $(top_srcdir)/.version
        echo $(VERSION) > $@-t && mv $@-t $@
        echo $(VERSION) > $(distdir)/.tarball-version
-EXTRA_DIST = git-version-gen .version README.md
+EXTRA_DIST = git-version-gen .version README.md osmo-release.mk
diff --git a/configure.ac b/configure.ac
index 96757df..5821ad3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11,6 +11,10 @@
 dnl kernel style compile messages
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+dnl include release helper
+RELMAKE='-include osmo-release.mk'
 dnl checks for programs
diff --git a/debian/control b/debian/control
index b19448e..e266173 100644
--- a/debian/control
+++ b/debian/control
@@ -281,6 +281,7 @@
 Multi-Arch: same
 Section: libdevel
 Depends: libosmocore,
+         bumpversion,
 Description: Development headers for Open Source MObile COMmunications CORE 
diff --git a/osmo-release.mk b/osmo-release.mk
new file mode 100644
index 0000000..4407c86
--- /dev/null
+++ b/osmo-release.mk
@@ -0,0 +1,28 @@
+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 
+ISODATE := $(shell date -I)
+ifeq ($(NEW_VERSION),)
+       @$(error Failed to determine NEW_VERSION - please fix versioning 
(current is $(VERSION)) before proceeding with the release)
+       @echo "Releasing" $(VERSION) "->" $(NEW_VERSION)"..."
+ifeq ($(LIBVERS),)
+       @gbp dch --debian-tag='%(version)s' --auto --meta --git-author 
+       @echo "You should NOT be doing this unless you've read and understood 
following article:"
+       @echo 
+       @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 '#' TODO-RELEASE > TODO-RELEASE.clean
+       @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)
+       @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 
+       @echo "Release" $(NEW_VERSION) "prepared, tagged and signed."

To view, visit https://gerrit.osmocom.org/3130
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I790ceb958195b9f6cbabfe8c977dc30e2bd7414b
Gerrit-PatchSet: 13
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Holger Freyther <hol...@freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: blobb <dr.bl...@gmail.com>

Reply via email to