[PATCH] libosmocore[master]: Fixup severe build performance issues

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Wed Oct 4 14:35:24 UTC 2017


Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/4127

to look at the new patch set (#2).

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 at sysmocom.de>

Related: OS#2524

Change-Id: I98b3b5fe3db39953cea969a9dfbb75889df2e1ea
---
M Makefile.am
M debian/libosmocore-dev.install
M osmo-release.mk
A osmo-release.sh
4 files changed, 55 insertions(+), 37 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/27/4127/2

diff --git a/Makefile.am b/Makefile.am
index 8b35856..5f23673 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,6 +12,8 @@
 relengdir = $(includedir)
 releng_DATA = osmo-release.mk
 
+dist_bin_SCRIPTS = osmo-release.sh
+
 osmo-release.mk: git-version-gen
 
 BUILT_SOURCES = $(top_srcdir)/.version
@@ -20,7 +22,7 @@
 dist-hook:
 	echo $(VERSION) > $(distdir)/.tarball-version
 
-EXTRA_DIST = git-version-gen .version README.md osmo-release.mk
+EXTRA_DIST = git-version-gen .version README.md osmo-release.mk osmo-release.sh
 
 if HAVE_DOXYGEN
 
diff --git a/debian/libosmocore-dev.install b/debian/libosmocore-dev.install
index 465f933..944a7bf 100644
--- a/debian/libosmocore-dev.install
+++ b/debian/libosmocore-dev.install
@@ -3,3 +3,4 @@
 usr/lib/*/lib*.so
 usr/lib/*/lib*.la
 usr/lib/*/pkgconfig/*
+usr/bin/osmo-release.sh
diff --git a/osmo-release.mk b/osmo-release.mk
index 40eb121..01285b1 100644
--- a/osmo-release.mk
+++ b/osmo-release.mk
@@ -2,43 +2,8 @@
 	REL := patch
 endif
 
-BUMPVER := $(shell bumpversion)
-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 ($(BUMPVER),)
-	@$(error Unable to find 'bumpversion' command.)
-endif
-
-ifeq ($(NEW_VER),)
-	@$(error Please fix versioning to match http://semver.org/ spec (current is $(VERSION)) before proceeding.)
-endif
-
 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' > TODO-RELEASE.entries
-	@grep '#' TODO-RELEASE > TODO-RELEASE.clean
-	@mv TODO-RELEASE.clean TODO-RELEASE
-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_VER) --allow-dirty
-	@git tag -s $(NEW_VER) -f -m "Release v$(NEW_VER) on $(ISODATE)."
-	@echo "Release" $(NEW_VER) "prepared, tagged and signed."
+	@osmo-release.sh $(VERSION) $(REL)
diff --git a/osmo-release.sh b/osmo-release.sh
new file mode 100755
index 0000000..ff82e4c
--- /dev/null
+++ b/osmo-release.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+VERSION=$1
+REL=$2
+
+if [ "z$REL" = "z" ]; then
+	echo "No REL value specified, defaulting to 'patch' release"
+	REL=patch
+fi
+
+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
+fi
+
+if [ "z$NEW_VER" = "z" ]; then
+	echo "Please fix versioning to match http://semver.org/ spec (current is $VERSION) before proceeding."
+	exit 1
+fi
+
+echo "Releasing $VERSION -> $NEW_VER..."
+
+if [ "z$LIBVERS" = "z" ]; then
+	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' > TODO-RELEASE.entries
+	grep '#' TODO-RELEASE > TODO-RELEASE.clean
+	mv TODO-RELEASE.clean TODO-RELEASE
+	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"
+fi
+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."

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I98b3b5fe3db39953cea969a9dfbb75889df2e1ea
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list