From 65889ff1d52fe20c04254d29e26042e4eb3e6f22 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Sat, 2 Apr 2022 16:02:27 +0200 Subject: [PATCH] - missing patches --- no-exe-for-elf-req.patch | 12 ++++++++ python-3.10-abi.patch | 60 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 no-exe-for-elf-req.patch create mode 100644 python-3.10-abi.patch diff --git a/no-exe-for-elf-req.patch b/no-exe-for-elf-req.patch new file mode 100644 index 0000000..3aa7b0f --- /dev/null +++ b/no-exe-for-elf-req.patch @@ -0,0 +1,12 @@ +--- rpm-4.16.1.3/tools/elfdeps.c.orig 2020-05-28 12:04:25.084136944 +0200 ++++ rpm-4.16.1.3/tools/elfdeps.c 2022-03-23 11:19:01.656202339 +0100 +@@ -300,7 +300,8 @@ + if (ehdr->e_type == ET_DYN || ehdr->e_type == ET_EXEC) { + ei->marker = mkmarker(ehdr); + ei->isDSO = (ehdr->e_type == ET_DYN); +- ei->isExec = (st.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)); ++ //ei->isExec = (st.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)); ++ ei->isExec = 1; + + processProgHeaders(ei, ehdr); + processSections(ei); diff --git a/python-3.10-abi.patch b/python-3.10-abi.patch new file mode 100644 index 0000000..4842b5d --- /dev/null +++ b/python-3.10-abi.patch @@ -0,0 +1,60 @@ +From d12e039037bf9a7d22d51bf1cc5925525a945ddf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Mon, 19 Apr 2021 20:33:33 +0200 +Subject: [PATCH] Fix python(abi) generator (the one written in Python) + +There were three problems: + + - sys.version was not imported + - sys.version[:3] is not reliable on Python 3.10+ + - distutils is deprecated on Python 3.10+ + +We were not hit by the missing import in Fedora because we only run the script +on .dist-info/.egg-info/.egg and not on .py files, so this if-branch never runs. + +But when the script was fed with a .py path, it errored: + + Traceback (most recent call last): + File "/usr/lib/rpm/pythondistdeps.py", line 344, in + purelib = get_python_lib(standard_lib=0, plat_specific=0).split(version[:3])[0] + NameError: name 'version' is not defined + +The sys.version[:3] thing kinda works for Python 3.10+ because *in this +particular case* splitting on '3.1' and taking the prefix yields the same +results as splitting on '3.10', but I consider that mere coincidence. + +Finally, since the distutils import happened at module-level, +we got the Deprecation warning in all Fedora's Python packages: + + /usr/lib/rpm/pythondistdeps.py:16: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12 +--- + scripts/pythondistdeps.py | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/scripts/pythondistdeps.py b/scripts/pythondistdeps.py +index 4e178c0..1f81c19 100755 +--- a/scripts/pythondistdeps.py ++++ b/scripts/pythondistdeps.py +@@ -13,8 +13,8 @@ + from __future__ import print_function + import argparse + from os.path import basename, dirname, isdir, sep +-from sys import argv, stdin, version +-from distutils.sysconfig import get_python_lib ++from sys import argv, stdin, version, version_info ++from sysconfig import get_path + from warnings import warn + + +@@ -287,8 +287,9 @@ def get_marker_env(dist, extra): + if py_abi and (lower.endswith('.py') or lower.endswith('.pyc') or lower.endswith('.pyo')): + if name not in py_deps: + py_deps[name] = [] +- purelib = get_python_lib(standard_lib=0, plat_specific=0).split(version[:3])[0] +- platlib = get_python_lib(standard_lib=0, plat_specific=1).split(version[:3])[0] ++ running_python_version = '{}.{}'.format(*version_info[:2]) ++ purelib = get_path('purelib').split(running_python_version)[0] ++ platlib = get_path('platlib').split(running_python_version)[0] + for lib in (purelib, platlib): + if lib in f: + spec = ('==', f.split(lib)[1].split(sep)[0]) -- 2.46.0