From b2fc53730953ac0a9532850bc40a2c5d3c6c6f3b Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Thu, 14 Jan 2016 15:25:24 -0700 Subject: [PATCH 1/4] Do not use %{?_isa} in obsoletes/provides for noarch sub-packages --- macros.python | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/macros.python b/macros.python index 4a5cb2a..3dea0e6 100644 --- a/macros.python +++ b/macros.python @@ -16,15 +16,19 @@ CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} install -O1 --ski package = rpm.expand("%{?1:%{1}}");\ vr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}") if (string.starts(package, "python2-")) then\ - str = "Provides: python-" .. string.sub(package,9,string.len(package)) .. "%{?_isa} = " .. vr;\ - print(rpm.expand(str));\ + if (rpm.expand("%{?buildarch}") != "noarch") then\ + str = "Provides: python-" .. string.sub(package,9,string.len(package)) .. "%{?_isa} = " .. vr;\ + print(rpm.expand(str));\ + end\ print("\\nProvides: python-");\ print(string.sub(package,9,string.len(package)));\ print(" = ");\ print(vr);\ --Obsoleting the previous default python package\ - str = "\\nObsoletes: python-" .. string.sub(package,9,string.len(package)) .. "%{?_isa} < " .. vr;\ - print(rpm.expand(str));\ + if (rpm.expand("%{?buildarch}") != "noarch") then\ + str = "\\nObsoletes: python-" .. string.sub(package,9,string.len(package)) .. "%{?_isa} < " .. vr;\ + print(rpm.expand(str));\ + end\ print("\\nObsoletes: python-");\ print(string.sub(package,9,string.len(package)));\ print(" < ");\ From cbf9c3d9a6a2cbe7d4098697044ebce57a84d46a Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Thu, 14 Jan 2016 15:32:18 -0700 Subject: [PATCH 2/4] Move py3_other macros to srpm-macros --- macros.python | 5 ----- macros.python-srpm | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/macros.python b/macros.python index 3dea0e6..65a7e5b 100644 --- a/macros.python +++ b/macros.python @@ -51,8 +51,3 @@ CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} install -O1 --ski print("not recognized.");\ end\ } - -# Set to /bin/true to avoid %ifdefs in specfiles -%__python3_other /bin/true -%py3_other_build /bin/true -%py3_other_install /bin/true diff --git a/macros.python-srpm b/macros.python-srpm index 4257beb..87ce887 100644 --- a/macros.python-srpm +++ b/macros.python-srpm @@ -1,3 +1,8 @@ # 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 + +# Set to /bin/true to avoid %ifdefs and %{? in specfiles +%__python3_other /bin/true +%py3_other_build /bin/true +%py3_other_install /bin/true From 608a3b9b3b3c49fa8f1b72e56741513497669a8a Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Thu, 14 Jan 2016 14:46:42 -0700 Subject: [PATCH 3/4] Handle python3_other_pkgversion in python_provide; Drop duplicate py3_other macros from macros.python --- macros.python | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/macros.python b/macros.python index 65a7e5b..3abaae2 100644 --- a/macros.python +++ b/macros.python @@ -33,8 +33,10 @@ CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} install -O1 --ski print(string.sub(package,9,string.len(package)));\ print(" < ");\ print(vr);\ - elseif (string.starts(package, "python3-")) then\ + elseif (string.starts(str, "python" .. rpm.expand("%{python3_pkgversion}") .. "-")) then\ --No unversioned provides as python3 is not default\ + elseif (rpm.expand("%{?python3_other_pkgversion}") != "" and string.starts(str, "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, "pypy3-")) then\ From f16464f0b6ee78e41d38c192c445b2ca6d1eca78 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Thu, 14 Jan 2016 16:17:51 -0700 Subject: [PATCH 4/4] Handle noarch python sub-packages (bug #1290900) --- macros.python | 6 +++--- python-rpm-macros.spec | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/macros.python b/macros.python index 3abaae2..89cd845 100644 --- a/macros.python +++ b/macros.python @@ -16,7 +16,7 @@ CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} install -O1 --ski package = rpm.expand("%{?1:%{1}}");\ vr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}") if (string.starts(package, "python2-")) then\ - if (rpm.expand("%{?buildarch}") != "noarch") then\ + if (rpm.expand("%{?buildarch}") ~= "noarch") then\ str = "Provides: python-" .. string.sub(package,9,string.len(package)) .. "%{?_isa} = " .. vr;\ print(rpm.expand(str));\ end\ @@ -25,7 +25,7 @@ CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} install -O1 --ski print(" = ");\ print(vr);\ --Obsoleting the previous default python package\ - if (rpm.expand("%{?buildarch}") != "noarch") then\ + if (rpm.expand("%{?buildarch}") ~= "noarch") then\ str = "\\nObsoletes: python-" .. string.sub(package,9,string.len(package)) .. "%{?_isa} < " .. vr;\ print(rpm.expand(str));\ end\ @@ -35,7 +35,7 @@ CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} install -O1 --ski print(vr);\ elseif (string.starts(str, "python" .. rpm.expand("%{python3_pkgversion}") .. "-")) then\ --No unversioned provides as python3 is not default\ - elseif (rpm.expand("%{?python3_other_pkgversion}") != "" and string.starts(str, "python" .. rpm.expand("%{python3_other_pkgversion}") .. "-")) then\ + elseif (rpm.expand("%{?python3_other_pkgversion}") ~= "" and string.starts(str, "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\ diff --git a/python-rpm-macros.spec b/python-rpm-macros.spec index d71e19c..577eb9f 100644 --- a/python-rpm-macros.spec +++ b/python-rpm-macros.spec @@ -1,6 +1,6 @@ Name: python-rpm-macros Version: 3 -Release: 4%{?dist} +Release: 5%{?dist} Summary: The unversioned Python RPM macros License: MIT @@ -67,6 +67,9 @@ install -m 644 %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} \ %changelog +* Thu Jan 14 2016 Orion Poplawski 3-5 +- Handle noarch python sub-packages (bug #1290900) + * Wed Jan 13 2016 Orion Poplawski 3-4 - Fix python2/3-rpm-macros package names