packaging: modify rc detection to work with X.Yrc instead of X.Y-rc stable
authorMathias De Mare <mathias.de_mare@nokia.com>
Thu, 07 Feb 2019 09:12:01 +0100
branchstable
changeset 41320 8f0e8b179842
parent 41319 87a6e3c953e0
child 41321 f2f538725d07
packaging: modify rc detection to work with X.Yrc instead of X.Y-rc rc detection on CentOS failed without this change, resulting in upgrades from 4.9rc to 4.9 not working (4.9rc was considered more recent than 4.9). Differential Revision: https://phab.mercurial-scm.org/D5876
contrib/packaging/packagelib.sh
--- a/contrib/packaging/packagelib.sh	Tue Feb 05 20:50:54 2019 -0500
+++ b/contrib/packaging/packagelib.sh	Thu Feb 07 09:12:01 2019 +0100
@@ -28,9 +28,9 @@
         distance=''
         node=''
     fi
-    if echo $hgversion | grep -- '-' > /dev/null 2>&1; then
-        version=`echo $hgversion | cut -d- -f1`
-        type=`echo $hgversion | cut -d- -f2`
+    if echo $hgversion | grep -E -- '[0-9]\.[0-9](\.[0-9])?rc' > /dev/null 2>&1; then
+        version=`echo $hgversion | cut -d'r' -f1`
+        type="rc`echo $hgversion | cut -d'c' -f2-`"
     else
         version=$hgversion
         type=''