path: root/osmo-release.sh
diff options
authorHarald Welte <laforge@gnumonks.org>2017-10-03 16:54:41 +0800
committerMax <msuraev@sysmocom.de>2017-10-04 16:26:37 +0200
commitee497f245e78929ddb69ba1f06d27bcc886f6597 (patch)
tree9607668bbfd79cc0cb8f685036a0da0b9f2c19b9 /osmo-release.sh
parentb697df0c4a008b80aad750e42947363f899b9301 (diff)
Fixup severe build performance issues
Make variable substitution calling bumpversion and other commands introduce by osmo-release.mk has severely slowed down builds. Inside the makefile we could use $(eval FOO:=$(shell...)) constructs to have variable substitution only happen once the 'release' target is executed. However, 'ifeq' and friends don't work with such late constructs. Let's shift all release action into a helper shell script that is called from the Makefile instead. This way we get the best of both worlds: No performance impact during normal builds, and the convenience of 'make release'. Modified-by: Max <msuraev@sysmocom.de> Related: OS#2524 Change-Id: I98b3b5fe3db39953cea969a9dfbb75889df2e1ea
Diffstat (limited to 'osmo-release.sh')
1 files changed, 50 insertions, 0 deletions
diff --git a/osmo-release.sh b/osmo-release.sh
new file mode 100755
index 00000000..ff82e4cb
--- /dev/null
+++ b/osmo-release.sh
@@ -0,0 +1,50 @@
+if [ "z$REL" = "z" ]; then
+ echo "No REL value specified, defaulting to 'patch' release"
+ REL=patch
+BUMPVER=`command -v bumpversion`
+NEW_VER=`bumpversion --list --current-version $VERSION $REL --allow-dirty | awk -F '=' '{ print $2 }'`
+LIBVERS=`git grep -n LIBVERSION | grep '=' | grep am | grep -v LDFLAGS`
+MAKEMOD=`git diff -GLIBVERSION --stat | grep Makefile.am`
+ISODATE=`date -I`
+if [ "z$BUMPVER" = "z" ]; then
+ echo Unable to find 'bumpversion' command.
+ exit 1
+if [ "z$NEW_VER" = "z" ]; then
+ echo "Please fix versioning to match http://semver.org/ spec (current is $VERSION) before proceeding."
+ exit 1
+echo "Releasing $VERSION -> $NEW_VER..."
+if [ "z$LIBVERS" = "z" ]; then
+ gbp dch --debian-tag='%(version)s' --auto --meta --git-author --multimaint-merge --ignore-branch
+ 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' > TODO-RELEASE.entries
+ grep '#' TODO-RELEASE > TODO-RELEASE.clean
+ if [ "z$MAKEMOD" = "z" ]; then
+ git status -s -uno TODO-RELEASE
+ if [ $? -ne 0 ]; then
+ echo "Before releasing, please modify some of the libversions: $LIBVERS"
+ exit 1
+ fi
+ fi
+ xargs -a TODO-RELEASE.entries -r -d'\n' -I entry dch -m -v $NEW_VER "entry"
+dch -r -m --distribution "unstable" ""
+git add -u
+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."