From 6d57556c97d25a6df7e688dd82564f59a0decd85 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Wed, 7 Aug 2019 23:39:32 +0200 Subject: 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 does NOT match debian/control ! ERROR: configure.ac does NOT match debian/control ! ERROR: configure.ac does NOT match debian/control ! ERROR: configure.ac does NOT match debian/control ! ERROR: configure.ac does NOT match debian/control ! ERROR: configure.ac does NOT match debian/control ! ERROR: configure.ac does NOT match debian/control ! ERROR: configure.ac does NOT match debian/control ! ERROR: exiting due to previous errors make: *** [osmo-release.mk:9: release] Error 1 Change-Id: I702a82c1b0e21dbe71a334a6f8bc62efe07859a6 --- osmo-release.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/osmo-release.sh b/osmo-release.sh index e9602aa1..38f238df 100755 --- a/osmo-release.sh +++ b/osmo-release.sh @@ -21,6 +21,46 @@ libversion_to_deb_major() { 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() { + 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" | \ + { return_error=0 + 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 @@ fi 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" -- cgit v1.2.3