packaging: switch centos 7 packaging to python 3
Differential Revision: https://phab.mercurial-scm.org/D9293
--- a/contrib/packaging/Makefile Fri Nov 06 11:24:54 2020 +0100
+++ b/contrib/packaging/Makefile Fri Nov 06 17:32:23 2020 +0100
@@ -20,6 +20,7 @@
# Build a Python for these CentOS releases.
CENTOS_WITH_PYTHON_RELEASES :=
CENTOS_WITH_NONVERSIONED_PYTHON :=
+CENTOS_WITH_36_DOCUTILS := 7
help:
@echo 'Packaging Make Targets'
@@ -110,13 +111,13 @@
.PHONY: centos$(1)
centos$(1):
mkdir -p $$(HGROOT)/packages/centos$(1)
- ./buildrpm $$(if $$(filter $(1),$$(CENTOS_WITH_PYTHON_RELEASES)),--withpython,$$(if $$(filter $(1),$$(CENTOS_WITH_NONVERSIONED_PYTHON)),--python python,))
+ ./buildrpm $$(if $$(filter $(1),$$(CENTOS_WITH_PYTHON_RELEASES)),--withpython,$$(if $$(filter $(1),$$(CENTOS_WITH_NONVERSIONED_PYTHON)),--python python,))$$(if $$(filter $(1),$$(CENTOS_WITH_36_DOCUTILS)), --docutilspackage python36-docutils,)
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,$$(if $$(filter $(1),$$(CENTOS_WITH_NONVERSIONED_PYTHON)),--python python,))
+ ./dockerrpm centos$(1) $$(if $$(filter $(1),$$(CENTOS_WITH_PYTHON_RELEASES)),--withpython,$$(if $$(filter $(1),$$(CENTOS_WITH_NONVERSIONED_PYTHON)),--python python,))$$(if $$(filter $(1),$$(CENTOS_WITH_36_DOCUTILS)), --docutilspackage python36-docutils,)
endef
--- a/contrib/packaging/buildrpm Fri Nov 06 11:24:54 2020 +0100
+++ b/contrib/packaging/buildrpm Fri Nov 06 17:32:23 2020 +0100
@@ -7,6 +7,7 @@
BUILD=1
RPMBUILDDIR="$PWD/rpmbuild"
PYTHONEXE=python3
+DOCUTILSPACKAGE=python3-docutils
while [ "$1" ]; do
case "$1" in
@@ -25,6 +26,11 @@
PYTHONMD5=f1a2ace631068444831d01485466ece0
PYTHONEXE=python
;;
+ --docutilspackage)
+ shift
+ DOCUTILSPACKAGE="$1"
+ shift
+ ;;
--rpmbuilddir )
shift
RPMBUILDDIR="$1"
@@ -149,6 +155,9 @@
sed -i \
-e "s/^%define withpython.*$/%define withpython $RPMPYTHONVER/" \
$rpmspec
+sed -i \
+ -e "s/^%global pythondocutils.*$/%global pythondocutils $DOCUTILSPACKAGE/" \
+ $rpmspec
if [ "$BUILD" ]; then
rpmbuild --define "_topdir $RPMBUILDDIR" -ba $rpmspec --clean
--- a/contrib/packaging/docker/centos7 Fri Nov 06 11:24:54 2020 +0100
+++ b/contrib/packaging/docker/centos7 Fri Nov 06 17:32:23 2020 +0100
@@ -3,12 +3,13 @@
RUN groupadd -g %GID% build && \
useradd -u %UID% -g %GID% -s /bin/bash -d /build -m build
+RUN yum install -y epel-release
RUN yum install -y \
gcc \
gettext \
make \
- python-devel \
- python-docutils \
+ python3-devel \
+ python36-docutils \
rpm-build \
tar
--- a/contrib/packaging/mercurial.spec Fri Nov 06 11:24:54 2020 +0100
+++ b/contrib/packaging/mercurial.spec Fri Nov 06 17:32:23 2020 +0100
@@ -3,6 +3,7 @@
%define withpython %{nil}
%global pythonexe python3
+%global pythondocutils python3-docutils
%if "%{?withpython}"
@@ -39,7 +40,7 @@
%if "%{?withpython}"
BuildRequires: readline-devel, openssl-devel, ncurses-devel, zlib-devel, bzip2-devel
%else
-BuildRequires: %{pythonexe} >= %{pythonver}, %{pythonexe}-devel, %{pythonexe}-docutils >= 0.5
+BuildRequires: %{pythonexe} >= %{pythonver}, %{pythonexe}-devel, %{pythondocutils}
Requires: %{pythonexe} >= %{pythonver}
%endif
# The hgk extension uses the wish tcl interpreter, but we don't enforce it