#42 Use %python_provide macros for backward compatibility provides
Merged 2 months ago by churchyard. Opened 2 months ago by churchyard.
rpms/ churchyard/python2 python_provide  into  master

file modified
+17 -12

@@ -193,6 +193,9 @@ 

  

  BuildRequires: zlib-devel

  

+ # For %%python_provide

+ BuildRequires: python-rpm-macros

+ 

  %if %{with rpmwheels}

  BuildRequires: python-setuptools-wheel

  BuildRequires: python-pip-wheel

@@ -828,8 +831,8 @@ 

  Provides: bundled(python2-setuptools) = 40.6.2

  %endif

  

- Provides: python-libs = %{version}-%{release}

- Provides: python-libs%{?_isa} = %{version}-%{release}

+ %{?python_provide:%python_provide python2-libs}

+ %{?python_provide:%python_provide python2-libs%{?_isa}}

  

  %description libs

  This package contains files used to embed Python 2 into applications.

@@ -869,8 +872,8 @@ 

  # package

  Conflicts: %{python} < %{version}-%{release}

  

- Provides: python-devel = %{version}-%{release}

- Provides: python-devel%{?_isa} = %{version}-%{release}

+ %{?python_provide:%python_provide python2-devel}

+ %{?python_provide:%python_provide python2-devel%{?_isa}}

  

  %description devel

  This package contains libraries and header files used to build applications

@@ -883,8 +886,8 @@ 

  Requires: %{name} = %{version}-%{release}

  Requires: %{python}-tkinter = %{version}-%{release}

  

- Provides: python-tools = %{version}-%{release}

- Provides: python-tools%{?_isa} = %{version}-%{release}

+ %{?python_provide:%python_provide python2-tools}

+ %{?python_provide:%python_provide python2-tools%{?_isa}}

  

  %description tools

  This package includes several tools to help with the development of Python 2

@@ -897,12 +900,14 @@ 

  

  Requires: %{name} = %{version}-%{release}

  

+ %if 0%{?fedora} < 31

  Provides: tkinter = %{version}-%{release}

  Provides: tkinter%{?_isa} = %{version}-%{release}

  Provides: tkinter2 = %{version}-%{release}

  Provides: tkinter2%{?_isa} = %{version}-%{release}

- Provides: python-tkinter = %{version}-%{release}

- Provides: python-tkinter%{?_isa} = %{version}-%{release}

+ %endif

+ %{?python_provide:%python_provide python2-tkinter}

+ %{?python_provide:%python_provide python2-tkinter%{?_isa}}

  

  %description tkinter

  

@@ -918,8 +923,8 @@ 

  

  Requires: %{name} = %{version}-%{release}

  

- Provides: python-test = %{version}-%{release}

- Provides: python-test%{?_isa} = %{version}-%{release}

+ %{?python_provide:%python_provide python2-test}

+ %{?python_provide:%python_provide python2-test%{?_isa}}

  

  %description test

  

@@ -945,8 +950,8 @@ 

  Requires: %{python}-tkinter%{?_isa} = %{version}-%{release}

  Requires: %{name}-tools%{?_isa} = %{version}-%{release}

  

- Provides: python-debug = %{version}-%{release}

- Provides: python-debug%{?_isa} = %{version}-%{release}

+ %{?python_provide:%python_provide python2-debug}

+ %{?python_provide:%python_provide python2-debug%{?_isa}}

  

  %description debug

  python2-debug provides a version of the Python 2 runtime with numerous debugging

This allows easier compatibility back and forth once (and if)
https://fedoraproject.org/wiki/Changes/Python_means_Python3
happens. This is not the full implementation of the change,
as the python-unversioned command still stays.

Note that on Fedora 31, the provides are no longer with %{_isa},
but we are not breaking stable releases in that regard, as %{_isa}
is still provided on those.

Also, conditionalize the tkinter provides for Fedora < 31 (nothing uses it).

rebased onto a72fd29

2 months ago
$ for pkg in fedora/*rpm; do echo rpmdiff $pkg ${pkg/fedora/pr}; rpmdiff -iT -i5 -iS -iV $pkg ${pkg/fedora/pr} | grep -v '/usr/lib/.build-id' | grep -v 'rpmlib'; echo; echo; done
rpmdiff fedora/python2-debug-2.7.16-2.fc31.x86_64.rpm pr/python2-debug-2.7.16-2.fc31.x86_64.rpm
removed     PROVIDES python-debug(x86-64) = 2.7.16-2.fc31
added       OBSOLETES python-debug < 2.7.16-2.fc31


rpmdiff fedora/python2-devel-2.7.16-2.fc31.x86_64.rpm pr/python2-devel-2.7.16-2.fc31.x86_64.rpm
removed     PROVIDES python-devel(x86-64) = 2.7.16-2.fc31
added       OBSOLETES python-devel < 2.7.16-2.fc31


rpmdiff fedora/python2-libs-2.7.16-2.fc31.x86_64.rpm pr/python2-libs-2.7.16-2.fc31.x86_64.rpm
removed     PROVIDES python-libs(x86-64) = 2.7.16-2.fc31
added       OBSOLETES python-libs < 2.7.16-2.fc31


rpmdiff fedora/python2-test-2.7.16-2.fc31.x86_64.rpm pr/python2-test-2.7.16-2.fc31.x86_64.rpm
removed     PROVIDES python-test(x86-64) = 2.7.16-2.fc31
added       OBSOLETES python-test < 2.7.16-2.fc31


rpmdiff fedora/python2-tkinter-2.7.16-2.fc31.x86_64.rpm pr/python2-tkinter-2.7.16-2.fc31.x86_64.rpm
removed     PROVIDES python-tkinter(x86-64) = 2.7.16-2.fc31
removed     PROVIDES tkinter = 2.7.16-2.fc31
removed     PROVIDES tkinter(x86-64) = 2.7.16-2.fc31
removed     PROVIDES tkinter2 = 2.7.16-2.fc31
removed     PROVIDES tkinter2(x86-64) = 2.7.16-2.fc31
added       OBSOLETES python-tkinter < 2.7.16-2.fc31


rpmdiff fedora/python2-tools-2.7.16-2.fc31.x86_64.rpm pr/python2-tools-2.7.16-2.fc31.x86_64.rpm
removed     PROVIDES python-tools(x86-64) = 2.7.16-2.fc31
added       OBSOLETES python-tools < 2.7.16-2.fc31

This looks expected.

rebased onto b44a3f3

2 months ago

Amended:

Use %python_provide macros for backward compatibility provides

This allows easier compatibility back and forth once (and if)
https://fedoraproject.org/wiki/Changes/Python_means_Python3
happens. This is not the full implementation of the change,
as the python-unversioned package still stays.

The provides with %{?_isa} are added for backwards compatibility.
In theory, such provides should be added by %python_provide automatically,
but in practice the noarch python-unversioned-command subpackage prevents
it, see https://bugzilla.redhat.com/show_bug.cgi?id=1705656

Also, conditionalize the tkinter provides for Fedora < 31 (nothing uses it).

This will be trickier then expected:

error: line 835: Only package names are allowed in Obsoletes: Obsoletes: python-libs(x86-64) < 2.7.16-2.fc31

Luckily, this only happens on RPM 4.15. So I can add a workaround to rawhide's %python_provide.

$ for pkg in fedora/*rpm; do echo rpmdiff $pkg ${pkg/fedora/pr}; rpmdiff -iT -i5 -iS -iV $pkg ${pkg/fedora/pr} | grep -v '/usr/lib/.build-id' | grep -v 'rpmlib'; echo; echo; done
rpmdiff fedora/python2-debug-2.7.16-2.fc31.x86_64.rpm pr/python2-debug-2.7.16-2.fc31.x86_64.rpm
added       OBSOLETES python-debug < 2.7.16-2.fc31


rpmdiff fedora/python2-devel-2.7.16-2.fc31.x86_64.rpm pr/python2-devel-2.7.16-2.fc31.x86_64.rpm
added       OBSOLETES python-devel < 2.7.16-2.fc31


rpmdiff fedora/python2-libs-2.7.16-2.fc31.x86_64.rpm pr/python2-libs-2.7.16-2.fc31.x86_64.rpm
added       OBSOLETES python-libs < 2.7.16-2.fc31
.M......... /usr/share/doc/python2-libs/pyfuntop.stp
.M......... /usr/share/doc/python2-libs/systemtap-example.stp


rpmdiff fedora/python2-test-2.7.16-2.fc31.x86_64.rpm pr/python2-test-2.7.16-2.fc31.x86_64.rpm
added       OBSOLETES python-test < 2.7.16-2.fc31


rpmdiff fedora/python2-tkinter-2.7.16-2.fc31.x86_64.rpm pr/python2-tkinter-2.7.16-2.fc31.x86_64.rpm
removed     PROVIDES tkinter = 2.7.16-2.fc31
removed     PROVIDES tkinter(x86-64) = 2.7.16-2.fc31
removed     PROVIDES tkinter2 = 2.7.16-2.fc31
removed     PROVIDES tkinter2(x86-64) = 2.7.16-2.fc31
added       OBSOLETES python-tkinter < 2.7.16-2.fc31


rpmdiff fedora/python2-tools-2.7.16-2.fc31.x86_64.rpm pr/python2-tools-2.7.16-2.fc31.x86_64.rpm
added       OBSOLETES python-tools < 2.7.16-2.fc31

Pull-Request has been merged by churchyard

2 months ago