From 62490dd1cc7cacbd3bca53b0136cf96b61e5f600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 25 Sep 2020 15:03:23 +0200 Subject: [PATCH] Use upstream architecture names on Fedora 34+ https://fedoraproject.org/wiki/Changes/Python_Upstream_Architecture_Names - repalce patch 274 witch a sed call - update patch 353 to work both ways - add a new bcond to control the behavior: legacy_archnames --- 00274-fix-arch-names.patch | 83 ------------------- ...chitecture-names-upstream-downstream.patch | 35 +++++--- python3.9.spec | 78 ++++++++++++----- 3 files changed, 81 insertions(+), 115 deletions(-) delete mode 100644 00274-fix-arch-names.patch rename 00353-Original-names-for-architectures-with-different-name.patch => 00353-architecture-names-upstream-downstream.patch (68%) diff --git a/00274-fix-arch-names.patch b/00274-fix-arch-names.patch deleted file mode 100644 index 81e7e6f..0000000 --- a/00274-fix-arch-names.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Petr Viktorin -Date: Mon, 28 Aug 2017 17:16:46 +0200 -Subject: [PATCH] 00274: Upstream uses Debian-style architecture naming, change - to match Fedora -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Co-authored-by: Petr Viktorin -Co-authored-by: Miro Hrončok -Co-authored-by: Tomas Orsava ---- - config.sub | 2 +- - configure.ac | 16 ++++++++-------- - 2 files changed, 9 insertions(+), 9 deletions(-) - -diff --git a/config.sub b/config.sub -index ba37cf99e2..52a9ec6662 100755 ---- a/config.sub -+++ b/config.sub -@@ -1042,7 +1042,7 @@ case $basic_machine in - ;; - ppc64) basic_machine=powerpc64-unknown - ;; -- ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` -+ ppc64-* | ppc64p7-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little) - basic_machine=powerpc64le-unknown -diff --git a/configure.ac b/configure.ac -index d60f05251a..6a95964657 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -759,9 +759,9 @@ cat >> conftest.c <> conftest.c <> conftest.c <= 34 || 0%{?rhel} >= 9 +%bcond_with legacy_archnames +%else +%bcond_without legacy_archnames +%endif # ===================== # General global macros @@ -122,8 +135,21 @@ License: Python %global LDVERSION_optimized %{pybasever}%{ABIFLAGS_optimized} %global LDVERSION_debug %{pybasever}%{ABIFLAGS_debug} -%global SOABI_optimized cpython-%{pyshortver}%{ABIFLAGS_optimized}-%{_arch}-linux%{_gnu} -%global SOABI_debug cpython-%{pyshortver}%{ABIFLAGS_debug}-%{_arch}-linux%{_gnu} +# When we use the upstream arch triplets, we convert them from the legacy ones +# This is reversed in prep when %%with legacy_archnames, so we keep both macros +%global platform_triplet_legacy %{_arch}-linux%{_gnu} +%global platform_triplet_upstream %{expand:%(echo %{platform_triplet_legacy} | sed -E \\ + -e 's/^arm(eb)?-linux-gnueabi$/arm\\1-linux-gnueabihf/' \\ + -e 's/^mips64(el)?-linux-gnu$/mips64\\1-linux-gnuabi64/' \\ + -e 's/^ppc(64)?(le)?-linux-gnu$/powerpc\\1\\2-linux-gnu/')} +%if %{with legacy_archnames} +%global platform_triplet %{platform_triplet_legacy} +%else +%global platform_triplet %{platform_triplet_upstream} +%endif + +%global SOABI_optimized cpython-%{pyshortver}%{ABIFLAGS_optimized}-%{platform_triplet} +%global SOABI_debug cpython-%{pyshortver}%{ABIFLAGS_debug}-%{platform_triplet} # All bytecode files are in a __pycache__ subdirectory, with a name # reflecting the version of the bytecode. @@ -287,10 +313,6 @@ Patch189: 00189-use-rpm-wheels.patch # Downstream only: Awaiting resources to work on upstream PEP Patch251: 00251-change-user-install-location.patch -# 00274 # 1e9258f6e8f70e86d5130113d3eed22993cf3da9 -# Upstream uses Debian-style architecture naming, change to match Fedora -Patch274: 00274-fix-arch-names.patch - # 00328 # 367fdcb5a075f083aea83ac174999272a8faf75c # Restore pyc to TIMESTAMP invalidation mode as default in rpmbuild # @@ -305,18 +327,22 @@ Patch274: 00274-fix-arch-names.patch # Ideally, we should talk to upstream and explain why we don't want this Patch328: 00328-pyc-timestamp-invalidation-mode.patch -# 00353 # f3c11e227c715450b3c1e945a5004e84cce41a58 +# 00353 # ab4cc97b643cfe99f567e3a03e5617b507183771 # Original names for architectures with different names downstream # -# Pythons in RHEL/Fedora use different names for some architectures +# https://fedoraproject.org/wiki/Changes/Python_Upstream_Architecture_Names +# +# Pythons in RHEL/Fedora used different names for some architectures # than upstream and other distros (for example ppc64 vs. powerpc64). -# See patch 274. -# That means that an extension built with the default upstream settings -# (on other distro or as an manylinux wheel) cannot be found by Python -# on RHEL/Fedora because it has a different suffix. -# This patch adds the original names to importlib so Python is able -# to import extensions with an original architecture name in its +# This was patched in patch 274, now it is sedded if %%with legacy_archnames. +# +# That meant that an extension built with the default upstream settings +# (on other distro or as an manylinux wheel) could not been found by Python +# on RHEL/Fedora because it had a different suffix. +# This patch adds the legacy names to importlib so Python is able +# to import extensions with a legacy architecture name in its # file name. +# It work both ways, so it support both %%with and %%without legacy_archnames. # # WARNING: This patch has no effect on Python built with bootstrap # enabled because Python/importlib_external.h is not regenerated @@ -324,7 +350,7 @@ Patch328: 00328-pyc-timestamp-invalidation-mode.patch # upstream without this feature. It's possible to include # Python/importlib_external.h to this patch but it'd make rebasing # a nightmare because it's basically a binary file. -Patch353: 00353-Original-names-for-architectures-with-different-name.patch +Patch353: 00353-architecture-names-upstream-downstream.patch # (New patches go here ^^^) # @@ -683,6 +709,12 @@ rm -r Modules/expat # (This is after patching, so that we can use patches directly from upstream) rm configure pyconfig.h.in +# When we use the legacy arch names, we need to change them in configure.ac +%if %{with legacy_archnames} +sed -i configure.ac \ + -e 's/\b%{platform_triplet_upstream}\b/%{platform_triplet_legacy}/' +%endif + # ====================================================== # Configuring and building the code: @@ -1381,8 +1413,8 @@ CheckPython optimized # "Makefile" and the config-32/64.h file are needed by # distutils/sysconfig.py:_init_posix(), so we include them in the core # package, along with their parent directories (bug 531901): -%dir %{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/ -%{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/Makefile +%dir %{pylibdir}/config-%{LDVERSION_optimized}-%{platform_triplet}/ +%{pylibdir}/config-%{LDVERSION_optimized}-%{platform_triplet}/Makefile %dir %{_includedir}/python%{LDVERSION_optimized}/ %{_includedir}/python%{LDVERSION_optimized}/%{_pyconfig_h} @@ -1400,9 +1432,9 @@ CheckPython optimized %{_bindir}/2to3 %endif -%{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/* +%{pylibdir}/config-%{LDVERSION_optimized}-%{platform_triplet}/* %if %{without flatpackage} -%exclude %{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/Makefile +%exclude %{pylibdir}/config-%{LDVERSION_optimized}-%{platform_triplet}/Makefile %exclude %{_includedir}/python%{LDVERSION_optimized}/%{_pyconfig_h} %endif %{_includedir}/python%{LDVERSION_optimized}/*.h @@ -1593,7 +1625,7 @@ CheckPython optimized %{_libdir}/%{py_INSTSONAME_debug} # Analog of the -devel subpackage's files: -%{pylibdir}/config-%{LDVERSION_debug}-%{_arch}-linux%{_gnu} +%{pylibdir}/config-%{LDVERSION_debug}-%{platform_triplet} %{_includedir}/python%{LDVERSION_debug} %{_bindir}/python%{LDVERSION_debug}-config %{_bindir}/python%{LDVERSION_debug}-*-config @@ -1640,6 +1672,10 @@ CheckPython optimized # ====================================================== %changelog +* Fri Sep 25 2020 Miro Hrončok - 3.9.0~rc2-2 +- Use upstream architecture names on Fedora 34+ +- https://fedoraproject.org/wiki/Changes/Python_Upstream_Architecture_Names + * Thu Sep 17 2020 Miro Hrončok - 3.9.0~rc2-1 - Update to 3.9.0rc2