diff --git a/macros.python b/macros.python index fe30d71..0b00946 100644 --- a/macros.python +++ b/macros.python @@ -52,11 +52,29 @@ end package = rpm.expand("%{?1}") vr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}") - if (string.starts(package, "python2-")) then - --No unversioned provides as python2 is not default - elseif (string.starts(package, "python" .. rpm.expand("%{python3_pkgversion}") .. "-")) then + if (string.starts(package, "python3-")) then print("\\nProvides: python-") - l = 8 + string.len(rpm.expand("%{python3_pkgversion}")) + print(string.sub(package,9,string.len(package))) + print(" = ") + print(vr) + print("\\nProvides: python" .. rpm.expand("%{__default_python3_pkgversion}") .. "-") + print(string.sub(package,9,string.len(package))) + print(" = ") + print(vr) + --Obsoleting the previous default python package (if it doesn't have isa) + if (string.sub(package, "-1") ~= ")") then + print("\\nObsoletes: python-") + print(string.sub(package,9,string.len(package))) + print(" < ") + print(vr) + end + elseif (string.starts(package, "python" .. rpm.expand("%{__default_python3_pkgversion}") .. "-")) then + print("\\nProvides: python-") + l = 8 + string.len(rpm.expand("%{__default_python3_pkgversion}")) + print(string.sub(package,l,string.len(package))) + print(" = ") + print(vr) + print("\\nProvides: python3-") print(string.sub(package,l,string.len(package))) print(" = ") print(vr) @@ -67,16 +85,10 @@ print(" < ") print(vr) end - elseif (rpm.expand("%{?python3_other_pkgversion}") ~= "" and string.starts(package, "python" .. rpm.expand("%{python3_other_pkgversion}") .. "-")) then - --No unversioned provides as python3_other is not default - elseif (string.starts(package, "pypy-")) then - --No unversioned provides as pypy is not default - elseif (string.starts(package, "pypy2-")) then - --No unversioned provides as pypy is not default - elseif (string.starts(package, "pypy3-")) then - --No unversioned provides as pypy is not default - elseif (string.starts(package, "python-")) then - --No unversioned provides needed for unversioned python + elseif (string.starts(package, "python")) then + --No unversioned provides as other python3 cases are not the default + elseif (string.starts(package, "pypy")) then + --No unversioned provides as pypy is not default either else print("%python_provide: ERROR: ") print(package) diff --git a/macros.python-srpm b/macros.python-srpm index 9fa4f06..67e53c9 100644 --- a/macros.python-srpm +++ b/macros.python-srpm @@ -25,6 +25,11 @@ end\ } +# This specifies what packages are equal to the python3-... packages, in python_provide macro +# E.g. in Fedora 32, python38-foo will provide python3-foo and vice versa +%__default_python3_version 3.8 +%__default_python3_pkgversion %(echo %__default_python3_version | sed 's/\\.//') + # python3_pkgversion specifies the version of Python 3 in the distro. It can be # a specific version (e.g. 34 in Fedora EPEL7) %python3_pkgversion 3 diff --git a/python-rpm-macros.spec b/python-rpm-macros.spec index 0734fe4..dd5ea6a 100644 --- a/python-rpm-macros.spec +++ b/python-rpm-macros.spec @@ -1,7 +1,7 @@ Name: python-rpm-macros -Version: 3 -Release: 54%{?dist} -Summary: The unversioned Python RPM macros +Version: 3.8 +Release: 1%{?dist} +Summary: The common Python RPM macros # macros: MIT, compileall2.py: PSFv2 License: MIT and Python @@ -78,6 +78,11 @@ install -m 644 %{SOURCE5} \ %changelog +* Mon Mar 23 2020 Miro Hrončok - 3.8-1 +- Hardcode the default Python 3 version in the SRPM macros (#1812087) +- Provide python38-foo for python3-foo and the other way around (future RHEL compatibility) +- %%python_provide: Allow any names starting with "python" or "pypy" + * Mon Feb 10 2020 Miro Hrončok - 3-54 - Update of bundled compileall2 module to 0.7.0 Adds the optional --hardlink-dupes flag for compileall2 for pyc deduplication