diff --git a/Makefile.am b/Makefile.am index b8de3cadd..8b3585687 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,13 +7,20 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libosmocore.pc libosmocodec.pc libosmovty.pc libosmogsm.pc \ libosmogb.pc libosmoctrl.pc libosmocoding.pc +@RELMAKE@ + +relengdir = $(includedir) +releng_DATA = osmo-release.mk + +osmo-release.mk: git-version-gen + BUILT_SOURCES = $(top_srcdir)/.version $(top_srcdir)/.version: echo $(VERSION) > $@-t && mv $@-t $@ dist-hook: echo $(VERSION) > $(distdir)/.tarball-version -EXTRA_DIST = git-version-gen .version README.md +EXTRA_DIST = git-version-gen .version README.md osmo-release.mk if HAVE_DOXYGEN diff --git a/configure.ac b/configure.ac index 96757df23..5821ad369 100644 --- a/configure.ac +++ b/configure.ac @@ -11,6 +11,10 @@ AC_CONFIG_TESTDIR(tests) dnl kernel style compile messages m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) +dnl include release helper +RELMAKE='-include osmo-release.mk' +AC_SUBST([RELMAKE]) + dnl checks for programs AC_PROG_MAKE_SET AC_PROG_MKDIR_P diff --git a/debian/control b/debian/control index b19448e16..e26617354 100644 --- a/debian/control +++ b/debian/control @@ -281,6 +281,7 @@ Architecture: any Multi-Arch: same Section: libdevel Depends: libosmocore, + bumpversion, libtalloc-dev, ${misc:Depends} Description: Development headers for Open Source MObile COMmunications CORE library diff --git a/osmo-release.mk b/osmo-release.mk new file mode 100644 index 000000000..4407c861d --- /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 LDFLAGS) +ISODATE := $(shell date -I) +endif + +release: +ifeq ($(NEW_VERSION),) + @$(error Failed to determine NEW_VERSION - please fix versioning (current is $(VERSION)) before proceeding with the release) +endif + @echo "Releasing" $(VERSION) "->" $(NEW_VERSION)"..." +ifeq ($(LIBVERS),) + @gbp dch --debian-tag='%(version)s' --auto --meta --git-author --multimaint-merge +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 '#' 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) +endif + @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."