changeset 45983:97205cf0ee4d

packaging: don't use plain 'python' if another python has been specified Before this change, packaging on CentOS 8 failed because 'python' is used instead of 'python3'. Change was tested with: - make docker-centos7 - make docker-centos8 - make docker-ubuntu-bionic Differential Revision: https://phab.mercurial-scm.org/D9464
author Mathias De Mare <mathias.de_mare@nokia.com>
date Mon, 30 Nov 2020 10:18:36 +0100
parents d26497811ed9
children fada33872b5b
files contrib/packaging/buildrpm contrib/packaging/packagelib.sh
diffstat 2 files changed, 14 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/packaging/buildrpm	Thu Nov 26 02:00:00 2020 -0500
+++ b/contrib/packaging/buildrpm	Mon Nov 30 10:18:36 2020 +0100
@@ -56,7 +56,7 @@
     exit 1
 fi
 
-gethgversion
+gethgversion $PYTHONEXE
 
 if [ -z "$type" ] ; then
     release=1
@@ -76,7 +76,7 @@
 fi
 
 mkdir -p $RPMBUILDDIR/{SOURCES,BUILD,SRPMS,RPMS}
-$HG archive -t tgz $RPMBUILDDIR/SOURCES/mercurial-$version-$release.tar.gz
+$PYTHONEXE $HG archive -t tgz $RPMBUILDDIR/SOURCES/mercurial-$version-$release.tar.gz
 if [ "$PYTHONVER" ]; then
 (
     mkdir -p build
@@ -112,7 +112,7 @@
 
 if echo $version | grep '+' > /dev/null 2>&1; then
     latesttag="`echo $version | sed -e 's/+.*//'`"
-    $HG log -r .:"$latesttag" -fM \
+    $PYTHONEXE $HG log -r .:"$latesttag" -fM \
         --template '{date|hgdate}\t{author}\t{desc|firstline}\n' | python -c '
 import sys, time
 
@@ -136,9 +136,9 @@
 
 else
 
-    $HG log \
+    $PYTHONEXE $HG log \
          --template '{date|hgdate}\t{author}\t{desc|firstline}\n' \
-         .hgtags | python -c '
+         .hgtags | $PYTHONEXE -c '
 import sys, time
 
 def datestr(date, format):
--- a/contrib/packaging/packagelib.sh	Thu Nov 26 02:00:00 2020 -0500
+++ b/contrib/packaging/packagelib.sh	Mon Nov 30 10:18:36 2020 +0100
@@ -8,16 +8,21 @@
 #
 # node: the node|short hg was built from, or empty if built from a tag
 gethgversion() {
+    if [ -z "${1+x}" ]; then
+        python="python"
+    else
+        python="$1"
+    fi
     export HGRCPATH=
     export HGPLAIN=
 
-    make cleanbutpackages
-    make local PURE=--pure
+    make cleanbutpackages PYTHON=$python
+    make local PURE=--pure PYTHON=$python
     HG="$PWD/hg"
 
-    "$HG" version > /dev/null || { echo 'abort: hg version failed!'; exit 1 ; }
+    $python "$HG" version > /dev/null || { echo 'abort: hg version failed!'; exit 1 ; }
 
-    hgversion=`LANGUAGE=C "$HG" version | sed -ne 's/.*(version \(.*\))$/\1/p'`
+    hgversion=`LANGUAGE=C $python "$HG" version | sed -ne 's/.*(version \(.*\))$/\1/p'`
 
     if echo $hgversion | grep + > /dev/null 2>&1 ; then
         tmp=`echo $hgversion | cut -d+ -f 2`