Bug 1812665

Summary: %py3_dist is not compatible with Python RPM generators (python3dist vs python3.6dist)
Product: Red Hat Enterprise Linux 7 Reporter: Miro Hrončok <mhroncok>
Component: python-rpm-macrosAssignee: Python Maintainers <python-maint>
Status: CLOSED ERRATA QA Contact: Lukáš Zachar <lzachar>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.8CC: bugzilla, carl, cstratak, ngompa13, pviktori, sergio, sgallagh, torsava
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-rpm-macros-3-34.el7 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-09-29 19:34:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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)

Comment 8 errata-xmlrpc 2020-09-29 19:34:04 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (python-rpm-macros bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:3881

Comment 9 Sergio Basto 2021-02-06 19:11:13 UTC
Error: No Package found for python%python3_versiondist(six)
Error: No Package found for python%python3_versiondist(sphinx)

still not working $subject 

Miro , while %python3_version isn't available on buitroot, python3_pkgversion is. So I think macro should be "python%python3_pkgversiondist" , because just after install python3-devel macro works( as is now )
Miro what do you think ? should I open a new bug ?

Comment 10 Miro Hrončok 2021-02-06 21:58:48 UTC
python3_pkgversion is 36 and the provides have 3.6, sot this would not help.

yes, please open a new bug and please include a full reproducer.

Comment 11 Miro Hrončok 2021-02-06 22:00:01 UTC
But yes, I see the problem, when the buildrequires are evaluated, python3 is not installed and the macro does not function. Bummer :(