Bug 1812665 - %py3_dist is not compatible with Python RPM generators (python3dist vs python3.6dist)
Summary: %py3_dist is not compatible with Python RPM generators (python3dist vs python...
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: python-rpm-macros
Version: 7.8
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Python Maintainers
QA Contact: Lukáš Zachar
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-03-11 19:35 UTC by Miro Hrončok
Modified: 2020-06-05 18:30 UTC (History)
7 users (show)

Fixed In Version: python-rpm-macros-3-34.el7
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:


Attachments (Terms of Use)

Description Miro Hrončok 2020-03-11 19:35:41 UTC
Description of problem:
In RHEL 7, we generate Python RPM provides via:

  %__pythondist_provides	%{_rpmconfigdir}/pythondistdeps.py --provides

Unlike Fedora, where we have the --majorver-provides flag, in RHEL 7 we don't have it.

That means, that Python packages will provide:

  python3.6dist(six)

But not:

  python3dist(six)

However, the %{py3_dist six} macro invocation will output python3dist(six).

Hence, the macros are not compatible within each other. As such, this perfectly valid Fedora spec snippet:

  BuildRequires: %{py3_dist six}

Will produce unmet build dependencies in EPEL.


As a fixer, I think it makes perfect sense to amend %py3_dist to output the versioned provide.

Version-Release number of selected component (if applicable):
python-rpm-macros-3-32.el7


As a fix, this:

	
                print("python3dist(" .. canonical .. ") ");

Can be replaced with:

                python3_version = rpm.expand("%python3_version");
                print("python" .. python3_version .. "dist(" .. canonical .. ") ");

I can provide a pull request, if we are still able to fix this in RHEL 7.



Side note: Likewise, the %py2_dist macro is completely useless on RHEL 7, as Python 2 packages don't have the necessary provides at all (neither python2dist() nor python2.7dist()). As such we can either turn it into error, delete it, or leave it be to maintain artificial backwards compatibility with self (useless, but safe).

Comment 3 Charalampos Stratakis 2020-03-18 16:37:47 UTC
To test:
    
Before:
    
$ rpm --eval '%{py3_dist six}'
python3dist(six)
    
After:
    
$ rpm --eval '%{py3_dist six}'
python3.6dist(six)
    
Or even (on EPEL):
    
$ rpm --define '__python3 %__python3_other' --eval '%{py3_dist six}'
python3.4dist(six)


Note You need to log in before you can comment on or make changes to this bug.