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


Change subject: osmo-release.sh: Verify consistency of dependency versions in 
configure.ac and debian/control
......................................................................

osmo-release.sh: Verify consistency of dependency versions in configure.ac and 
debian/control

Sample output for current osmo-msc master:
Releasing 1.3.1.191-7ea0d -> 1.4.0...
ERROR: configure.ac <libosmocore, 1.0.0> does NOT match debian/control 
<libosmocore, 0.10.0>!
ERROR: configure.ac <libosmo-netif, 0.4.0> does NOT match debian/control 
<libosmo-netif, 0.1.0>!
ERROR: configure.ac <libosmo-sigtran, 1.0.0> does NOT match debian/control 
<libosmo-sigtran, 0.8.0>!
ERROR: configure.ac <libosmo-mgcp-client, 1.5.0> does NOT match debian/control 
<libosmo-mgcp-client, 1.1.0>!
ERROR: configure.ac <libosmo-gsup-client, 1.0.0> does NOT match debian/control 
<libosmo-gsup-client, 0.2.1>!
ERROR: configure.ac <libsmpp34, 1.13.0> does NOT match debian/control 
<libsmpp34, 1.12>!
ERROR: configure.ac <libasn1c, 0.9.30> does NOT match debian/control <libasn1c, 
0.9.28>!
ERROR: configure.ac <libosmo-ranap, 0.3.0> does NOT match debian/control 
<libosmo-ranap, 0.2.0>!
ERROR: exiting due to previous errors
make: *** [osmo-release.mk:9: release] Error 1

Change-Id: I702a82c1b0e21dbe71a334a6f8bc62efe07859a6
---
M osmo-release.sh
1 file changed, 42 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/10/15110/1

diff --git a/osmo-release.sh b/osmo-release.sh
index e9602aa..eab5040 100755
--- a/osmo-release.sh
+++ b/osmo-release.sh
@@ -21,6 +21,46 @@
        echo "$major"
 }

+# Make sure that depedency requirement versions match in configure.ac vs 
debian/control.
+#eg: "PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.1.0)" vs 
"libosmocore-dev (>= 1.0.0),"
+check_configureac_debctrl_deps_match() {
+       return_error=0
+       configureac_list=$(grep -e "PKG_CHECK_MODULES" 
"${GIT_TOPDIR}/configure.ac" | cut -d "," -f 2 | tr -d ")" | tr -d " " | sed 
"s/>=/ /g")
+       echo "$configureac_list" | \
+       { while read -r dep ver; do
+
+               debctrl_match="$(grep -e "${dep}-dev" 
${GIT_TOPDIR}/debian/control | grep ">=")"
+               debctrl_match_count="$(echo "$debctrl_match" | grep -c ">=")"
+               if [ "z$debctrl_match_count" != "z0" ]; then
+                       #echo "Dependency <$dep, $ver> from configure.ac 
matched in debian/control! ($debctrl_match_count)"
+                       if [ "z$debctrl_match_count" != "z1" ]; then
+                               echo "WARN: configure.ac <$dep, $ver> matches 
debian/control $debctrl_match_count times, manual check required!"
+                       else # 1 match:
+                               parsed_match=$(echo "$debctrl_match" | tr -d 
"(" | tr -d ")" | tr -d "," | tr -d " " | sed "s/>=/ /g")
+                               debctrl_dep=$(echo "$parsed_match" | cut -d " " 
-f 1 | sed "s/-dev//g")
+                               debctrl_ver=$(echo "$parsed_match" | cut -d " " 
-f 2)
+                               if [ "z$dep" != "z$debctrl_dep" ] || [ "z$ver" 
!= "z$debctrl_ver" ]; then
+                                       echo "ERROR: configure.ac <$dep, $ver> 
does NOT match debian/control <$debctrl_dep, $debctrl_ver>!"
+                                       return_error=1
+                               #else
+                               #       echo "OK: configure.ac <$dep, $ver> 
matches debian/control <$debctrl_dep, $debctrl_ver>"
+                               fi
+                       fi
+               fi
+       done
+       if [ $return_error -ne 0 ]; then
+               exit 1
+       fi
+       }
+
+       # catch and forward exit from pipe subshell "while read":
+       if [ $? -ne 0 ]; then
+               echo "ERROR: exiting due to previous errors"
+               exit 1
+       fi
+       echo "OK: dependency specific versions in configure.ac and 
debian/control match"
+}
+
 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 }'`
@@ -40,6 +80,8 @@

 echo "Releasing $VERSION -> $NEW_VER..."

+check_configureac_debctrl_deps_match
+
 if [ "z$LIBVERS" != "z" ]; then
        if [ "z$MAKEMOD" = "z" ] && [ "z$ALLOW_NO_LIBVERSION_CHANGE" = "z0" ]; 
then
                echo "ERROR: Before releasing, please modify some of the 
libversions: $LIBVERS"

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I702a82c1b0e21dbe71a334a6f8bc62efe07859a6
Gerrit-Change-Number: 15110
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pes...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to