[PATCH 4 of 8 stable] packaging: use "--python python" for centos7 to avoid explicit "python2"

Mads Kiilerich mads at kiilerich.com
Fri Nov 1 10:40:32 EDT 2019


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1572608858 -3600
#      Fri Nov 01 12:47:38 2019 +0100
# Branch stable
# Node ID 27f849825e3a2fe7bd08a79659cfddaa95851ff9
# Parent  0039dc1d76f454f86a9cbfb9064ca6b3cac664d6
packaging: use "--python python" for centos7 to avoid explicit "python2"

This is a partial backout of 92a51a45d44c.

We will need to be able to control whether package dependencies are python2 or
python3. Generally (at least in recent Fedora), the package prefix match the
name of the python executable ...  but CentOS 7 doesn't use the python2 prefix
in package name or alias for python-docutils yet, so just keep centos7 in the
unversioned "python" world.

Change the new (unused) buildrpm "--python3" option (introduced in
a6dcac6454c1) to "--python python3" to get a more generic method for explicit
control over whether we use python, python2 or python3.

diff --git a/contrib/packaging/Makefile b/contrib/packaging/Makefile
--- a/contrib/packaging/Makefile
+++ b/contrib/packaging/Makefile
@@ -116,13 +116,13 @@ define centos_targets
 .PHONY: centos$(1)
 centos$(1):
 	mkdir -p $$(HGROOT)/packages/centos$(1)
-	./buildrpm $$(if $$(filter $(1),$$(CENTOS_WITH_PYTHON_RELEASES)),--withpython)
+	./buildrpm $$(if $$(filter $(1),$$(CENTOS_WITH_PYTHON_RELEASES)),--withpython,--python python)
 	cp $$(HGROOT)/contrib/packaging/rpmbuild/RPMS/*/* $$(HGROOT)/packages/centos$(1)
 	cp $$(HGROOT)/contrib/packaging/rpmbuild/SRPMS/* $$(HGROOT)/packages/centos$(1)
 
 .PHONY: docker-centos$(1)
 docker-centos$(1):
-	./dockerrpm centos$(1) $$(if $$(filter $(1),$$(CENTOS_WITH_PYTHON_RELEASES)),--withpython)
+	./dockerrpm centos$(1) $$(if $$(filter $(1),$$(CENTOS_WITH_PYTHON_RELEASES)),--withpython,--python python)
 
 endef
 
diff --git a/contrib/packaging/buildrpm b/contrib/packaging/buildrpm
--- a/contrib/packaging/buildrpm
+++ b/contrib/packaging/buildrpm
@@ -14,9 +14,10 @@ while [ "$1" ]; do
         shift
         BUILD=
         ;;
-    --python3)
+    --python)
         shift
-        PYTHONEXE=python3
+        PYTHONEXE=$1
+        shift
         ;;
     --withpython | --with-python)
         shift


More information about the Mercurial-devel mailing list