Change in libosmocore[master]: osmo-release.sh: Check LIBVERSION matches rpm *.spec.in

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

pespin gerrit-no-reply at lists.osmocom.org
Wed Feb 24 12:22:50 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/23090 )


Change subject: osmo-release.sh: Check LIBVERSION matches rpm *.spec.in
......................................................................

osmo-release.sh: Check LIBVERSION matches rpm *.spec.in

Change-Id: I7b8d56cc255167407370c888647255d8992f4202
---
M osmo-release.sh
1 file changed, 81 insertions(+), 41 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/90/23090/1

diff --git a/osmo-release.sh b/osmo-release.sh
index ceb63b6..173652d 100755
--- a/osmo-release.sh
+++ b/osmo-release.sh
@@ -9,10 +9,11 @@
 
 ALLOW_NO_LIBVERSION_CHANGE="${ALLOW_NO_LIBVERSION_CHANGE:-0}"
 ALLOW_NO_LIBVERSION_DEB_MATCH="${ALLOW_NO_LIBVERSION_DEB_MATCH:-0}"
+ALLOW_NO_LIBVERSION_RPM_MATCH="${ALLOW_NO_LIBVERSION_RPM_MATCH:-0}"
 # Test stuff but don't modify stuff:
 DRY_RUN="${DRY_RUN:-0}"
 
-libversion_to_deb_major() {
+libversion_to_lib_major() {
 	libversion="$1"
 	current="$(echo "$libversion" | cut -d ":" -f 1)"
 	#revision="$(echo "$libversion" | cut -d ":" -f 2)"
@@ -124,6 +125,81 @@
 	done
 }
 
+libversion_deb_match() {
+	echo "$LIBVERS" | while read -r line; do
+		libversion=$(echo "$line" | cut -d "=" -f 2 | tr -d "[:space:]")
+		major="$(libversion_to_lib_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
+
+		dhstrip_lib_total="$(grep -e "dh_strip" "${GIT_TOPDIR}/debian/rules" | grep "\-plib" | wc -l)"
+		dhstrip_lib_matches="$(grep -e "dh_strip" "${GIT_TOPDIR}/debian/rules" | grep "\-plib" | grep "$major" | wc -l)"
+		if [ "z$dhstrip_lib_total" != "z0" ]; then
+			if [ "z$dhstrip_lib_matches" = "z0" ] ; then
+				echo "ERROR: Found no matching 'dh_strip -plib*$major' line in debian/rules for LIBVERSION=$libversion"
+				exit 1
+			elif [ "z$dhstrip_lib_total" = "z1" ]; then
+				echo "OK: Found 'dh_strip -plib*$major' in debian/rules for LIBVERSION=$libversion"
+			else
+				echo "WARN: Found $dhstrip_lib_matches/$dhstrip_lib_total dh_strip matches 'dh_strip -plib*$major' in debian/rules for LIBVERSION=$libversion, manual check required!"
+			fi
+		fi
+	done
+	# catch and forward exit from pipe subshell "while read":
+	if [ $? -ne 0 ]; then
+		exit 1
+	fi
+}
+
+libversion_rpmspecin_match() {
+	echo "$LIBVERS" | while read -r line; do
+		libversion=$(echo "$line" | cut -d "=" -f 2 | tr -d "[:space:]")
+		major="$(libversion_to_lib_major "$libversion")"
+
+		control_matches="$(grep -e "%files" "${GIT_TOPDIR}/contrib/"*.spec.in | grep "lib" | grep "$major$" | wc -l)"
+		if [ "z$control_matches" = "z0" ]; then
+			echo "ERROR: Found no matching '%files -n lib*$major' in contrib/*.spec.in for LIBVERSION=$libversion"
+			exit 1
+		elif [ "z$control_matches" = "z1" ]; then
+			echo "OK: Found '%files -n lib*$major' in contrib/*.spec.in for LIBVERSION=$libversion"
+		else
+			echo "WARN: Found $file_matches files matching '%files -n lib*$major' in contrib/*.spec.in for LIBVERSION=$libversion, manual check required!"
+		fi
+
+		control_matches="$(grep -e "_libdir" "${GIT_TOPDIR}/contrib/"*.spec.in | grep "/lib" | grep "so.$major" | wc -l)"
+		if [ "z$control_matches" = "z0" ]; then
+			echo "ERROR: Found no matching '%_libdir/lib*.so.$major*' in contrib/*.spec.in for LIBVERSION=$libversion"
+			exit 1
+		elif [ "z$control_matches" = "z1" ]; then
+			echo "OK: Found '%_libdir/lib*.so.$major*' in contrib/*.spec.in for LIBVERSION=$libversion"
+		else
+			echo "WARN: Found $file_matches files matching '%_libdir/lib*.so.$major*' in contrib/*.spec.in for LIBVERSION=$libversion, manual check required!"
+		fi
+	done
+	# catch and forward exit from pipe subshell "while read":
+	if [ $? -ne 0 ]; then
+		exit 1
+	fi
+}
+
+
 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 }'`
@@ -155,46 +231,10 @@
 		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 | tr -d "[:space:]")
-			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
-
-			dhstrip_lib_total="$(grep -e "dh_strip" "${GIT_TOPDIR}/debian/rules" | grep "\-plib" | wc -l)"
-			dhstrip_lib_matches="$(grep -e "dh_strip" "${GIT_TOPDIR}/debian/rules" | grep "\-plib" | grep "$major" | wc -l)"
-			if [ "z$dhstrip_lib_total" != "z0" ]; then
-				if [ "z$dhstrip_lib_matches" = "z0" ] ; then
-					echo "ERROR: Found no matching 'dh_strip -plib*$major' line in debian/rules for LIBVERSION=$libversion"
-					exit 1
-				elif [ "z$dhstrip_lib_total" = "z1" ]; then
-					echo "OK: Found 'dh_strip -plib*$major' in debian/rules for LIBVERSION=$libversion"
-				else
-					echo "WARN: Found $dhstrip_lib_matches/$dhstrip_lib_total dh_strip matches 'dh_strip -plib*$major' in debian/rules for LIBVERSION=$libversion, manual check required!"
-				fi
-			fi
-		done
-		# catch and forward exit from pipe subshell "while read":
-		if [ $? -ne 0 ]; then
-			exit 1
-		fi
+		libversion_deb_match
+	fi
+	if [ "z$ALLOW_NO_LIBVERSION_RPM_MATCH" = "z0" ]; then
+		libversion_rpmspecin_match
 	fi
 fi
 

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I7b8d56cc255167407370c888647255d8992f4202
Gerrit-Change-Number: 23090
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210224/559133cf/attachment.htm>


More information about the gerrit-log mailing list