Change in libosmocore[master]: osmo-release.sh: Add checks to help avoid libversion debian major mis...

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/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu Aug 30 12:51:59 UTC 2018


Pau Espin Pedrol has submitted this change and it was merged. ( https://gerrit.osmocom.org/10705 )

Change subject: osmo-release.sh: Add checks to help avoid libversion debian major mismatch
......................................................................

osmo-release.sh: Add checks to help avoid libversion debian major mismatch

Change-Id: Ie0f6a2f9d60908b36f90921bfba3fc31606e5027
---
M osmo-release.sh
1 file changed, 39 insertions(+), 2 deletions(-)

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



diff --git a/osmo-release.sh b/osmo-release.sh
index 26ebd33..4d4d080 100755
--- a/osmo-release.sh
+++ b/osmo-release.sh
@@ -8,9 +8,19 @@
 fi
 
 ALLOW_NO_LIBVERSION_CHANGE="${ALLOW_NO_LIBVERSION_CHANGE:-0}"
+ALLOW_NO_LIBVERSION_DEB_MATCH="${ALLOW_NO_LIBVERSION_DEB_MATCH:-0}"
+
+libversion_to_deb_major() {
+	libversion="$1"
+	current="$(echo "$libversion" | cut -d ":" -f 1)"
+	#revision="$(echo "$libversion" | cut -d ":" -f 2)"
+	age="$(echo "$libversion" | cut -d ":" -f 3)"
+	major="$(expr "$current" - "$age")"
+	echo "$major"
+}
 
 BUMPVER=`command -v bumpversion`
-
+GIT_TOPDIR="$(git rev-parse --show-toplevel)"
 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 --cached -GLIBVERSION --stat | grep Makefile.am`
@@ -35,7 +45,34 @@
 		echo "https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info"
 		exit 1
 	fi
-
+	if [ "z$ALLOW_NO_LIBVERSION_DEB_MATCH" = "z0" ]; then
+		echo "$LIBVERS" | while read -r line; do
+			libversion=$(echo "$line" | cut -d "=" -f 2)
+			major="$(libversion_to_deb_major "$libversion")"
+			file_matches="$(find "${GIT_TOPDIR}/debian" -name "lib*${major}.install" | wc -l)"
+			if [ "z$file_matches" = "z0" ]; then
+				echo "ERROR: Found no matching debian/lib*$major.install file for LIBVERSION=$libversion"
+				exit 1
+			elif [ "z$file_matches" = "z1" ]; then
+				echo "OK: Found matching debian/lib*$major.install for LIBVERSION=$libversion"
+			else
+				echo "WARN: Found $file_matches files matching debian/lib*$major.install for LIBVERSION=$libversion, manual check required!"
+			fi
+			control_matches="$(grep -e "Package" "${GIT_TOPDIR}/debian/control" | grep "lib" | grep "$major$" | wc -l)"
+			if [ "z$control_matches" = "z0" ]; then
+				echo "ERROR: Found no matching Package lib*$major in debian/control for LIBVERSION=$libversion"
+				exit 1
+			elif [ "z$control_matches" = "z1" ]; then
+				echo "OK: Found 'Package: lib*$major' in debian/control for LIBVERSION=$libversion"
+			else
+				echo "WARN: Found $file_matches files matching 'Package: lib*$major' in debian/control for LIBVERSION=$libversion, manual check required!"
+			fi
+		done
+		# catch and forward exit from pipe subshell "while read":
+		if [ $? -ne 0 ]; then
+			exit 1
+		fi
+	fi
 	if [ -f "TODO-RELEASE" ]; then
 		grep '#' TODO-RELEASE > TODO-RELEASE.clean
 		mv TODO-RELEASE.clean TODO-RELEASE

-- 
To view, visit https://gerrit.osmocom.org/10705
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie0f6a2f9d60908b36f90921bfba3fc31606e5027
Gerrit-Change-Number: 10705
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180830/22deda3c/attachment.htm>


More information about the gerrit-log mailing list