D9293: packaging: switch centos 7 packaging to python 3
Mathiasdm (Mathias De Maré)
phabricator at mercurial-scm.org
Wed Nov 11 21:03:35 UTC 2020
Mathiasdm created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D9293
AFFECTED FILES
contrib/packaging/Makefile
contrib/packaging/buildrpm
contrib/packaging/docker/centos7
contrib/packaging/mercurial.spec
CHANGE DETAILS
diff --git a/contrib/packaging/mercurial.spec b/contrib/packaging/mercurial.spec
--- a/contrib/packaging/mercurial.spec
+++ b/contrib/packaging/mercurial.spec
@@ -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
diff --git a/contrib/packaging/docker/centos7 b/contrib/packaging/docker/centos7
--- a/contrib/packaging/docker/centos7
+++ b/contrib/packaging/docker/centos7
@@ -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
diff --git a/contrib/packaging/buildrpm b/contrib/packaging/buildrpm
--- a/contrib/packaging/buildrpm
+++ b/contrib/packaging/buildrpm
@@ -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
diff --git a/contrib/packaging/Makefile b/contrib/packaging/Makefile
--- a/contrib/packaging/Makefile
+++ b/contrib/packaging/Makefile
@@ -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
To: Mathiasdm, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list