import python3.11-packaging-21.3-1.el8

This commit is contained in:
CentOS Sources 2023-03-28 13:06:53 +00:00 committed by Stepan Oksanichenko
commit 03a1c61590
4 changed files with 140 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/packaging-21.3.tar.gz

View File

@ -0,0 +1 @@
9ddc9625f990188862b348b53f7067f8d54c322c SOURCES/packaging-21.3.tar.gz

62
SOURCES/538.patch Normal file
View File

@ -0,0 +1,62 @@
From c3476c3207efef576a185a047e6596b3b0cbcb42 Mon Sep 17 00:00:00 2001
From: Tzu-ping Chung <uranusjr@gmail.com>
Date: Wed, 20 Apr 2022 10:00:07 +0800
Subject: [PATCH 1/2] Correctly parse ELF for musllinux on Big Endian
---
packaging/_musllinux.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/packaging/_musllinux.py b/packaging/_musllinux.py
index 8ac3059b..d5d3e044 100644
--- a/packaging/_musllinux.py
+++ b/packaging/_musllinux.py
@@ -39,9 +39,11 @@ def _parse_ld_musl_from_elf(f: IO[bytes]) -> Optional[str]:
# p_fmt: Format for section header.
# p_idx: Indexes to find p_type, p_offset, and p_filesz.
e_fmt, p_fmt, p_idx = {
- 1: ("IIIIHHH", "IIIIIIII", (0, 1, 4)), # 32-bit.
- 2: ("QQQIHHH", "IIQQQQQQ", (0, 2, 5)), # 64-bit.
- }[ident[4]]
+ (1, 1): ("<IIIIHHH", "<IIIIIIII", (0, 1, 4)), # 32-bit LSB.
+ (1, 2): (">IIIIHHH", ">IIIIIIII", (0, 1, 4)), # 32-bit MSB.
+ (2, 1): ("<QQQIHHH", "<IIQQQQQQ", (0, 2, 5)), # 64-bit LSB.
+ (2, 2): (">QQQIHHH", ">IIQQQQQQ", (0, 2, 5)), # 64-bit MSB.
+ }[(ident[4], ident[5])]
except KeyError:
return None
else:
From a339dd3374b334a1a999481f3014f68a7389dacc Mon Sep 17 00:00:00 2001
From: Tzu-ping Chung <uranusjr@gmail.com>
Date: Sun, 29 May 2022 11:55:30 +0800
Subject: [PATCH 2/2] Always use LSB to parse binary in tests
---
tests/test_musllinux.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/tests/test_musllinux.py b/tests/test_musllinux.py
index d2c87ca1..2623bdbc 100644
--- a/tests/test_musllinux.py
+++ b/tests/test_musllinux.py
@@ -101,14 +101,15 @@ def test_parse_ld_musl_from_elf_no_interpreter_section():
with BIN_MUSL_X86_64.open("rb") as f:
data = f.read()
- # Change all sections to *not* PT_INTERP.
- unpacked = struct.unpack("16BHHIQQQIHHH", data[:58])
+ # Change all sections to *not* PT_INTERP. We are explicitly using LSB rules
+ # because the binaries are in LSB.
+ unpacked = struct.unpack("<16BHHIQQQIHHH", data[:58])
*_, e_phoff, _, _, _, e_phentsize, e_phnum = unpacked
for i in range(e_phnum + 1):
sb = e_phoff + e_phentsize * i
se = sb + 56
- section = struct.unpack("IIQQQQQQ", data[sb:se])
- data = data[:sb] + struct.pack("IIQQQQQQ", 0, *section[1:]) + data[se:]
+ section = struct.unpack("<IIQQQQQQ", data[sb:se])
+ data = data[:sb] + struct.pack("<IIQQQQQQ", 0, *section[1:]) + data[se:]
assert _parse_ld_musl_from_elf(io.BytesIO(data)) is None

View File

@ -0,0 +1,76 @@
%global __python3 /usr/bin/python3.11
%global python3_pkgversion 3.11
%global pypi_name packaging
# Tests are disabled in RHEL because we don't have python-pretend.
# Specify --with tests to enable them.
%bcond_with tests
Name: python%{python3_pkgversion}-%{pypi_name}
Version: 21.3
Release: 1%{?dist}
Summary: Core utilities for Python packages
License: BSD or ASL 2.0
URL: https://github.com/pypa/packaging
Source0: %{url}/archive/%{version}/%{pypi_name}-%{version}.tar.gz
# Correctly parse ELF for musllinux on Big Endian
# Merged upstream
Patch: https://github.com/pypa/packaging/pull/538.patch
BuildArch: noarch
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-rpm-macros
BuildRequires: python%{python3_pkgversion}-setuptools
# Upstream uses nox for testing.
%if %{with tests}
BuildRequires: python%{python3_pkgversion}-pytest
BuildRequires: python%{python3_pkgversion}-pretend
%endif
# On RHEL8 we need to manually specify the runtime requirements.
# On RHEL9 they are auto-generated but we keep them for consistency.
Requires: python%{python3_pkgversion}dist(pyparsing)
%global _description %{expand:
python-packaging provides core utilities for Python packages like utilities for
dealing with versions, specifiers, markers etc.}
%description %_description
%prep
%autosetup -p1 -n %{pypi_name}-%{version}
%build
%py3_build
%install
%py3_install
%if %{with tests}
%check
%pytest
%endif
%files -n python%{python3_pkgversion}-%{pypi_name}
%license LICENSE LICENSE.APACHE LICENSE.BSD
%doc README.rst CHANGELOG.rst CONTRIBUTING.rst
%{python3_sitelib}/%{pypi_name}/
%{python3_sitelib}/%{pypi_name}-*-info/
%changelog
* Fri Nov 25 2022 Charalampos Stratakis <cstratak@redhat.com> - 21.3-1
- Initial package
- Fedora contributions by:
# Charalampos Stratakis <cstratak@redhat.com>
# Iryna Shcherbina <shcherbina.iryna@gmail.com>
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>
# Lumir Balhar <lbalhar@redhat.com>
# Miro Hrončok <miro@hroncok.cz>
# Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>