diff --git a/brp-python-bytecompile-compatibility-with-newer-pyth.patch b/brp-python-bytecompile-compatibility-with-newer-pyth.patch new file mode 100644 index 0000000..ebe7230 --- /dev/null +++ b/brp-python-bytecompile-compatibility-with-newer-pyth.patch @@ -0,0 +1,46 @@ +From acbf558c486ee3518aca74045504f05872da4a58 Mon Sep 17 00:00:00 2001 +From: Lumir Balhar +Date: Tue, 26 Sep 2023 13:14:44 +0200 +Subject: [PATCH] brp-python-bytecompile compatibility with newer pythons + +--- + scripts/brp-python-bytecompile | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/scripts/brp-python-bytecompile b/scripts/brp-python-bytecompile +index 4a9b49e..472bf10 100644 +--- a/scripts/brp-python-bytecompile ++++ b/scripts/brp-python-bytecompile +@@ -58,7 +58,7 @@ EOF + # and below /usr/lib/python3.1/, we're targeting /usr/bin/python3.1 + + shopt -s nullglob +-for python_libdir in `find "$RPM_BUILD_ROOT" -type d|grep -E "/usr/lib(64)?/python[0-9]\.[0-9]$"`; ++for python_libdir in `find "$RPM_BUILD_ROOT" -type d|grep -E "/usr/lib(64)?/python[0-9]\.[0-9]+$"`; + do + python_binary=/usr/bin/$(basename $python_libdir) + if [ "$python_binary" = "/usr/bin/python3.6" ]; then +@@ -97,17 +97,17 @@ fi + + # Figure out if there are files to be bytecompiled with the default_python at all + # this prevents unnecessary default_python invocation +-find "$RPM_BUILD_ROOT" -type f -name "*.py" | grep -Ev "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]|/usr/share/doc" || exit 0 ++find "$RPM_BUILD_ROOT" -type f -name "*.py" | grep -Ev "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]+|/usr/share/doc" || exit 0 + + # Generate normal (.pyc) byte-compiled files. +-python_bytecompile "" $default_python "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]|/usr/share/doc" "$RPM_BUILD_ROOT" "$depth" "/" ++python_bytecompile "" $default_python "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]+|/usr/share/doc" "$RPM_BUILD_ROOT" "$depth" "/" + if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then + # One or more of the files had a syntax error + exit 1 + fi + + # Generate optimized (.pyo) byte-compiled files. +-python_bytecompile "-O" $default_python "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]|/usr/share/doc" "$RPM_BUILD_ROOT" "$depth" "/" ++python_bytecompile "-O" $default_python "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]+|/usr/share/doc" "$RPM_BUILD_ROOT" "$depth" "/" + if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then + # One or more of the files had a syntax error + exit 1 +-- +2.41.0 + diff --git a/rpm.spec b/rpm.spec index f235765..b550fb4 100644 --- a/rpm.spec +++ b/rpm.spec @@ -32,7 +32,7 @@ %global rpmver 4.14.3 #global snapver rc2 -%global rel 26 +%global rel 27 %global srcver %{version}%{?snapver:-%{snapver}} %global srcdir %{?snapver:testing}%{!?snapver:%{name}-%(echo %{version} | cut -d'.' -f1-2).x} @@ -150,6 +150,8 @@ Patch1000: disable-python-extra.patch Patch1001: compile-with-Platform-Python-binary-where-relevant.patch # make unversioned %%__python an error unless explicitly overridden Patch1002: rpm-4.14.2-unversioned-python.patch +# Make brp-python-bytecompile compatible with Python 3.10+ +Patch1003: brp-python-bytecompile-compatibility-with-newer-pyth.patch # Partially GPL/LGPL dual-licensed and some bits with BSD # SourceLicense: (GPLv2+ and LGPLv2+ with exceptions) and BSD @@ -699,6 +701,10 @@ make check || cat tests/rpmtests.log %doc doc/librpm/html/* %changelog +* Tue Sep 26 2023 Lumír Balhar - 4.14.4-27 +- Make brp-python-bytecompile script compatible with Python 3.10+ +Resolves: RHEL-6423 + * Mon Dec 19 2022 Florian Festi - 4.14.4-26 - Add --nocompression to rpm2archive (#2129345)