D9464: packaging: don't use plain 'python' if another python has been specified

Mathiasdm (Mathias De Maré) phabricator at mercurial-scm.org
Mon Nov 30 10:15:43 UTC 2020


Mathiasdm created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9464

AFFECTED FILES
  contrib/packaging/buildrpm
  contrib/packaging/packagelib.sh

CHANGE DETAILS

diff --git a/contrib/packaging/packagelib.sh b/contrib/packaging/packagelib.sh
--- a/contrib/packaging/packagelib.sh
+++ b/contrib/packaging/packagelib.sh
@@ -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`
diff --git a/contrib/packaging/buildrpm b/contrib/packaging/buildrpm
--- a/contrib/packaging/buildrpm
+++ b/contrib/packaging/buildrpm
@@ -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):



To: Mathiasdm, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list