#24 %python_provide: Don't try to obsolete %_isa provides
Merged 4 years ago by churchyard. Opened 4 years ago by churchyard.
rpms/ churchyard/python-rpm-macros obsoletes_workaround  into  master

file modified
+7 -5
@@ -53,11 +53,13 @@ 

      print(string.sub(package,9,string.len(package)))

      print(" = ")

      print(vr)

-     --Obsoleting the previous default python package

-     print("\\nObsoletes: python-")

-     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("%{python3_pkgversion}") .. "-")) then

      --No unversioned provides as python3 is not default

    elseif (rpm.expand("%{?python3_other_pkgversion}") ~= "" and string.starts(package, "python" .. rpm.expand("%{python3_other_pkgversion}") .. "-")) then

file modified
+4 -1
@@ -1,6 +1,6 @@ 

  Name:           python-rpm-macros

  Version:        3

- Release:        44%{?dist}

+ Release:        45%{?dist}

  Summary:        The unversioned Python RPM macros

  

  License:        MIT
@@ -73,6 +73,9 @@ 

  

  

  %changelog

+ * Tue Jul 09 2019 Miro Hrončok <mhroncok@redhat.com> - 3-45

+ - %%python_provide: Don't try to obsolete %%_isa provides

+ 

  * Mon Jun 17 2019 Miro Hrončok <mhroncok@redhat.com> - 3-44

  - Make %%__python /usr/bin/python once again until we are ready

  

Based on recent changes in 04769fa,
packagers might want to use:

%{?python_provide:%python_provide python2-foo%{?_isa}}

...for backwards compatibility. However the macro adds obsoletes and
since RPM 4.15, obsoletes with %{?_isa} are not possible:

Only package names are allowed in Obsoletes: Obsoletes: python-foo(x86-64) < ...

To allow such usage, %python_provide now only obsoletes if the argument
does not end with ")".

Looks good to me. Do you have any builds where we can see that it's actually working or should I test it?

Metadata Update from @lbalhar:
- Request assigned

4 years ago

It works!

I've done a build of python-rpm-macros without this feature [0] and then I've tried to build a package with an _isa in %python_provide macro and the build failed [1]. But, when this feature is included [2], it skips Obsoletes and builds fine [3].

[0] https://copr.fedorainfracloud.org/coprs/lbalhar/testing/build/967576/
[1] https://copr.fedorainfracloud.org/coprs/lbalhar/testing/build/967605/
[2] https://copr.fedorainfracloud.org/coprs/lbalhar/testing/build/967623/
[3] https://copr.fedorainfracloud.org/coprs/lbalhar/testing/build/967628/

Merge and build at will.

Pull-Request has been merged by churchyard

4 years ago