<p>Pau Espin Pedrol has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/10705">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">osmo-release.sh: Add checks to help avoid libversion debian major mismatch<br><br>Change-Id: Ie0f6a2f9d60908b36f90921bfba3fc31606e5027<br>---<br>M osmo-release.sh<br>1 file changed, 39 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/05/10705/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/osmo-release.sh b/osmo-release.sh</span><br><span>index 26ebd33..4d4d080 100755</span><br><span>--- a/osmo-release.sh</span><br><span>+++ b/osmo-release.sh</span><br><span>@@ -8,9 +8,19 @@</span><br><span> fi</span><br><span> </span><br><span> ALLOW_NO_LIBVERSION_CHANGE="${ALLOW_NO_LIBVERSION_CHANGE:-0}"</span><br><span style="color: hsl(120, 100%, 40%);">+ALLOW_NO_LIBVERSION_DEB_MATCH="${ALLOW_NO_LIBVERSION_DEB_MATCH:-0}"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+libversion_to_deb_major() {</span><br><span style="color: hsl(120, 100%, 40%);">+ libversion="$1"</span><br><span style="color: hsl(120, 100%, 40%);">+     current="$(echo "$libversion" | cut -d ":" -f 1)"</span><br><span style="color: hsl(120, 100%, 40%);">+       #revision="$(echo "$libversion" | cut -d ":" -f 2)"</span><br><span style="color: hsl(120, 100%, 40%);">+     age="$(echo "$libversion" | cut -d ":" -f 3)"</span><br><span style="color: hsl(120, 100%, 40%);">+   major="$(expr "$current" - "$age")"</span><br><span style="color: hsl(120, 100%, 40%);">+     echo "$major"</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span> </span><br><span> BUMPVER=`command -v bumpversion`</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(120, 100%, 40%);">+GIT_TOPDIR="$(git rev-parse --show-toplevel)"</span><br><span> NEW_VER=`bumpversion --list --current-version $VERSION $REL --allow-dirty | awk -F '=' '{ print $2 }'`</span><br><span> LIBVERS=`git grep -n LIBVERSION | grep  '=' | grep am | grep -v LDFLAGS`</span><br><span> MAKEMOD=`git diff --cached -GLIBVERSION --stat | grep Makefile.am`</span><br><span>@@ -35,7 +45,34 @@</span><br><span>                 echo "https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info"</span><br><span>              exit 1</span><br><span>       fi</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(120, 100%, 40%);">+    if [ "z$ALLOW_NO_LIBVERSION_DEB_MATCH" = "z0" ]; then</span><br><span style="color: hsl(120, 100%, 40%);">+             echo "$LIBVERS" | while read -r line; do</span><br><span style="color: hsl(120, 100%, 40%);">+                    libversion=$(echo "$line" | cut -d "=" -f 2)</span><br><span style="color: hsl(120, 100%, 40%);">+                      major="$(libversion_to_deb_major "$libversion")"</span><br><span style="color: hsl(120, 100%, 40%);">+                  file_matches="$(find "${GIT_TOPDIR}/debian" -name "lib*${major}.install" | wc -l)"</span><br><span style="color: hsl(120, 100%, 40%);">+                      if [ "z$file_matches" = "z0" ]; then</span><br><span style="color: hsl(120, 100%, 40%);">+                              echo "ERROR: Found no matching debian/lib*$major.install file for LIBVERSION=$libversion"</span><br><span style="color: hsl(120, 100%, 40%);">+                           exit 1</span><br><span style="color: hsl(120, 100%, 40%);">+                        elif [ "z$file_matches" = "z1" ]; then</span><br><span style="color: hsl(120, 100%, 40%);">+                            echo "OK: Found matching debian/lib*$major.install for LIBVERSION=$libversion"</span><br><span style="color: hsl(120, 100%, 40%);">+                      else</span><br><span style="color: hsl(120, 100%, 40%);">+                          echo "WARN: Found $file_matches files matching debian/lib*$major.install for LIBVERSION=$libversion, manual check required!"</span><br><span style="color: hsl(120, 100%, 40%);">+                        fi</span><br><span style="color: hsl(120, 100%, 40%);">+                    control_matches="$(grep -e "Package" "${GIT_TOPDIR}/debian/control" | grep "lib" | grep "$major$" | wc -l)"</span><br><span style="color: hsl(120, 100%, 40%);">+                 if [ "z$control_matches" = "z0" ]; then</span><br><span style="color: hsl(120, 100%, 40%);">+                           echo "ERROR: Found no matching Package lib*$major in debian/control for LIBVERSION=$libversion"</span><br><span style="color: hsl(120, 100%, 40%);">+                             exit 1</span><br><span style="color: hsl(120, 100%, 40%);">+                        elif [ "z$control_matches" = "z1" ]; then</span><br><span style="color: hsl(120, 100%, 40%);">+                         echo "OK: Found 'Package: lib*$major' in debian/control for LIBVERSION=$libversion"</span><br><span style="color: hsl(120, 100%, 40%);">+                 else</span><br><span style="color: hsl(120, 100%, 40%);">+                          echo "WARN: Found $file_matches files matching 'Package: lib*$major' in debian/control for LIBVERSION=$libversion, manual check required!"</span><br><span style="color: hsl(120, 100%, 40%);">+                  fi</span><br><span style="color: hsl(120, 100%, 40%);">+            done</span><br><span style="color: hsl(120, 100%, 40%);">+          # catch and forward exit from pipe subshell "while read":</span><br><span style="color: hsl(120, 100%, 40%);">+           if [ $? -ne 0 ]; then</span><br><span style="color: hsl(120, 100%, 40%);">+                 exit 1</span><br><span style="color: hsl(120, 100%, 40%);">+                fi</span><br><span style="color: hsl(120, 100%, 40%);">+    fi</span><br><span>   if [ -f "TODO-RELEASE" ]; then</span><br><span>             grep '#' TODO-RELEASE > TODO-RELEASE.clean</span><br><span>                mv TODO-RELEASE.clean TODO-RELEASE</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/10705">change 10705</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/10705"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ie0f6a2f9d60908b36f90921bfba3fc31606e5027 </div>
<div style="display:none"> Gerrit-Change-Number: 10705 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Pau Espin Pedrol <pespin@sysmocom.de> </div>