Add support for upstream architectures' names (patch 353)
This commit is contained in:
parent
d1c008697b
commit
f4fc990cc5
2 changed files with 107 additions and 1 deletions
|
|
@ -0,0 +1,79 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Lumir Balhar <lbalhar@redhat.com>
|
||||
Date: Tue, 4 Aug 2020 12:04:03 +0200
|
||||
Subject: [PATCH] 00353: Original names for architectures with different names
|
||||
downstream
|
||||
|
||||
Pythons in RHEL/Fedora use 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
|
||||
file name.
|
||||
|
||||
WARNING: This patch has no effect on Python built with bootstrap
|
||||
enabled because Python/importlib_external.h is not regenerated
|
||||
and therefore Python during bootstrap contains importlib from
|
||||
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.
|
||||
---
|
||||
Lib/importlib/_bootstrap_external.py | 31 ++++++++++++++++++++++++++--
|
||||
1 file changed, 29 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py
|
||||
index 25a3f8c0e0..db4bb4d02d 100644
|
||||
--- a/Lib/importlib/_bootstrap_external.py
|
||||
+++ b/Lib/importlib/_bootstrap_external.py
|
||||
@@ -1566,7 +1566,7 @@ def _get_supported_file_loaders():
|
||||
|
||||
Each item is a tuple (loader, suffixes).
|
||||
"""
|
||||
- extensions = ExtensionFileLoader, _imp.extension_suffixes()
|
||||
+ extensions = ExtensionFileLoader, _alternative_architectures(_imp.extension_suffixes())
|
||||
source = SourceFileLoader, SOURCE_SUFFIXES
|
||||
bytecode = SourcelessFileLoader, BYTECODE_SUFFIXES
|
||||
return [extensions, source, bytecode]
|
||||
@@ -1622,7 +1622,7 @@ def _setup(_bootstrap_module):
|
||||
|
||||
# Constants
|
||||
setattr(self_module, '_relax_case', _make_relax_case())
|
||||
- EXTENSION_SUFFIXES.extend(_imp.extension_suffixes())
|
||||
+ EXTENSION_SUFFIXES.extend(_alternative_architectures(_imp.extension_suffixes()))
|
||||
if builtin_os == 'nt':
|
||||
SOURCE_SUFFIXES.append('.pyw')
|
||||
if '_d.pyd' in EXTENSION_SUFFIXES:
|
||||
@@ -1635,3 +1635,30 @@ def _install(_bootstrap_module):
|
||||
supported_loaders = _get_supported_file_loaders()
|
||||
sys.path_hooks.extend([FileFinder.path_hook(*supported_loaders)])
|
||||
sys.meta_path.append(PathFinder)
|
||||
+
|
||||
+
|
||||
+_ARCH_MAP = {
|
||||
+ "-arm-linux-gnueabi.": "-arm-linux-gnueabihf.",
|
||||
+ "-armeb-linux-gnueabi.": "-armeb-linux-gnueabihf.",
|
||||
+ "-mips64-linux-gnu.": "-mips64-linux-gnuabi64.",
|
||||
+ "-mips64el-linux-gnu.": "-mips64el-linux-gnuabi64.",
|
||||
+ "-ppc-linux-gnu.": "-powerpc-linux-gnu.",
|
||||
+ "-ppc-linux-gnuspe.": "-powerpc-linux-gnuspe.",
|
||||
+ "-ppc64-linux-gnu.": "-powerpc64-linux-gnu.",
|
||||
+ "-ppc64le-linux-gnu.": "-powerpc64le-linux-gnu.",
|
||||
+}
|
||||
+
|
||||
+
|
||||
+def _alternative_architectures(suffixes):
|
||||
+ """Add a suffix with an alternative architecture name
|
||||
+ to the list of suffixes so an extension built with
|
||||
+ the default (upstream) setting is loadable with our Pythons
|
||||
+ """
|
||||
+
|
||||
+ for suffix in suffixes:
|
||||
+ for original, alternative in _ARCH_MAP.items():
|
||||
+ if original in suffix:
|
||||
+ suffixes.append(suffix.replace(original, alternative))
|
||||
+ return suffixes
|
||||
+
|
||||
+ return suffixes
|
||||
|
|
@ -17,7 +17,7 @@ URL: https://www.python.org/
|
|||
#global prerel ...
|
||||
%global upstream_version %{general_version}%{?prerel}
|
||||
Version: %{general_version}%{?prerel:~%{prerel}}
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
License: Python
|
||||
|
||||
|
||||
|
|
@ -408,6 +408,27 @@ Patch351: 00351-avoid-infinite-loop-in-the-tarfile-module.patch
|
|||
# Fixed upstream: https://bugs.python.org/issue41004
|
||||
Patch352: 00352-resolve-hash-collisions-for-ipv4interface-and-ipv6interface.patch
|
||||
|
||||
# 00353 # f3c11e227c715450b3c1e945a5004e84cce41a58
|
||||
# Original names for architectures with different names downstream
|
||||
#
|
||||
# Pythons in RHEL/Fedora use 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
|
||||
# file name.
|
||||
#
|
||||
# WARNING: This patch has no effect on Python built with bootstrap
|
||||
# enabled because Python/importlib_external.h is not regenerated
|
||||
# and therefore Python during bootstrap contains importlib from
|
||||
# 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
|
||||
|
||||
# (New patches go here ^^^)
|
||||
#
|
||||
# When adding new patches to "python" and "python3" in Fedora, EL, etc.,
|
||||
|
|
@ -774,6 +795,9 @@ BuildPython() {
|
|||
$ExtraConfigArgs \
|
||||
%{nil}
|
||||
|
||||
# Regenerate generated importlib frozen modules (see patch 353)
|
||||
%make_build EXTRA_CFLAGS="$CFLAGS $MoreCFlags" regen-importlib
|
||||
|
||||
# Invoke the build
|
||||
%make_build EXTRA_CFLAGS="$CFLAGS $MoreCFlags"
|
||||
|
||||
|
|
@ -1567,6 +1591,9 @@ CheckPython optimized
|
|||
# ======================================================
|
||||
|
||||
%changelog
|
||||
* Mon Aug 03 2020 Lumír Balhar <lbalhar@redhat.com> - 3.6.11-4
|
||||
- Add support for upstream architectures' names (patch 353)
|
||||
|
||||
* Fri Jul 31 2020 Charalampos Stratakis <cstratak@redhat.com> - 3.6.11-3
|
||||
- Avoid infinite loop when reading specially crafted TAR files (CVE-2019-20907)
|
||||
Resolves: rhbz#1856481
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue