diff --git a/python-rpm-generators.spec b/python-rpm-generators.spec index 8511c94..3553018 100644 --- a/python-rpm-generators.spec +++ b/python-rpm-generators.spec @@ -1,11 +1,7 @@ -# Disable automatic bytecompilation. We install only one script and we will -# never "import" it. -%undefine py_auto_byte_compile - Name: python-rpm-generators Summary: Dependency generators for Python RPMs -Version: 10 -Release: 4%{?dist} +Version: 11 +Release: 1%{?dist} # Originally all those files were part of RPM, so license is kept here License: GPLv2+ @@ -14,8 +10,7 @@ Url: https://src.fedoraproject.org/python-rpm-generators Source0: https://raw.githubusercontent.com/rpm-software-management/rpm/102eab50b3d0d6546dfe082eac0ade21e6b3dbf1/COPYING Source1: python.attr Source2: pythondist.attr -Source3: pythondeps.sh -Source4: pythondistdeps.py +Source3: pythondistdeps.py BuildArch: noarch @@ -25,10 +20,8 @@ BuildArch: noarch %package -n python3-rpm-generators Summary: %{summary} Requires: python3-setuptools -# The point of split -Conflicts: rpm-build < 4.13.0.1-2 -# Breaking change, change a way how depgen is enabled -Conflicts: python-rpm-macros < 3-35 +# We have parametric macro generators, we need RPM 4.16 (4.15.90+ is 4.16 alpha) +Requires: rpm > 4.15.90-0 %description -n python3-rpm-generators %{summary}. @@ -39,16 +32,19 @@ cp -a %{sources} . %install install -Dpm0644 -t %{buildroot}%{_fileattrsdir} python.attr pythondist.attr -install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} pythondeps.sh pythondistdeps.py +install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} pythondistdeps.py %files -n python3-rpm-generators %license COPYING %{_fileattrsdir}/python.attr %{_fileattrsdir}/pythondist.attr -%{_rpmconfigdir}/pythondeps.sh %{_rpmconfigdir}/pythondistdeps.py %changelog +* Wed Apr 01 2020 Miro HronĨok - 11-1 +- Rewrite python(abi) generators to Lua to make them faster +- RPM 4.16+ is needed + * Thu Jan 30 2020 Fedora Release Engineering - 10-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild diff --git a/python.attr b/python.attr index f5d2dff..fc19439 100644 --- a/python.attr +++ b/python.attr @@ -1,4 +1,28 @@ -%__python_provides %{_rpmconfigdir}/pythondeps.sh --provides -%__python_requires %{_rpmconfigdir}/pythondeps.sh --requires +%__python_provides() %{lua: + -- Match buildroot/payload paths of the form + -- /PATH/OF/BUILDROOT/usr/bin/pythonMAJOR.MINOR + -- generating a line of the form + -- python(abi) = MAJOR.MINOR + -- (Don't match against -config tools e.g. /usr/bin/python2.6-config) + local path = rpm.expand('%1') + if path:match('/usr/bin/python%d+%.%d+$') then + provides = path:gsub('.*/usr/bin/python(%d+%.%d+)', 'python(abi) = %1') + print(provides) + end +} + +%__python_requires() %{lua: + -- Match buildroot paths of the form + -- /PATH/OF/BUILDROOT/usr/lib/pythonMAJOR.MINOR/ and + -- /PATH/OF/BUILDROOT/usr/lib64/pythonMAJOR.MINOR/ + -- generating a line of the form: + -- python(abi) = MAJOR.MINOR + local path = rpm.expand('%1') + if path:match('/usr/lib%d*/python%d+%.%d+/.*') then + requires = path:gsub('.*/usr/lib%d*/python(%d+%.%d+)/.*', 'python(abi) = %1') + print(requires) + end +} + %__python_path ^((/usr/lib(64)?/python[[:digit:]]\\.[[:digit:]]+/.*\\.(py[oc]?|so))|(^%{_bindir}/python[[:digit:]]\\.[[:digit:]]+))$ %__python_magic [Pp]ython.*(executable|byte-compiled) diff --git a/pythondeps.sh b/pythondeps.sh deleted file mode 100755 index 10a060a..0000000 --- a/pythondeps.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -[ $# -ge 1 ] || { - cat > /dev/null - exit 0 -} - -case $1 in --P|--provides) - shift - # Match buildroot/payload paths of the form - # /PATH/OF/BUILDROOT/usr/bin/pythonMAJOR.MINOR - # generating a line of the form - # python(abi) = MAJOR.MINOR - # (Don't match against -config tools e.g. /usr/bin/python2.6-config) - grep "/usr/bin/python.\..$" \ - | sed -e "s|.*/usr/bin/python\(.\..\)|python(abi) = \1|" - ;; --R|--requires) - shift - # Match buildroot paths of the form - # /PATH/OF/BUILDROOT/usr/lib/pythonMAJOR.MINOR/ and - # /PATH/OF/BUILDROOT/usr/lib64/pythonMAJOR.MINOR/ - # generating (uniqely) lines of the form: - # python(abi) = MAJOR.MINOR - grep "/usr/lib[^/]*/python.\../.*" \ - | sed -e "s|.*/usr/lib[^/]*/python\(.\..\)/.*|python(abi) = \1|g" \ - | sort | uniq - ;; -esac - -exit 0