Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2090007

Summary: Make %py3_dist respect %python3_pkgversion
Product: Red Hat Enterprise Linux 8 Reporter: Maxwell G <maxwell>
Component: python-rpm-macrosAssignee: Miro Hrončok <mhroncok>
Status: CLOSED ERRATA QA Contact: Lukáš Zachar <lzachar>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: ---CC: carl, mhroncok, pviktori, python-maint, rhel-cs-apps-subsystem-qe, torsava
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-rpm-macros-3-42.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-08 09:42:24 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 Maxwell G 2022-05-25 00:26:26 UTC
Description of problem:
%py3_dist does not respect the value of `%python3_pkgversion`.

Version-Release number of selected component (if applicable):
python-rpm-macros-3-41.el8.noarch

How reproducible:
When `%python3_pkgversion` has a value other than 3.

Steps to Reproduce:
1. rpm -D 'python3_pkgversion 38' -E '%{py3_dist pyyaml}'

Actual results:
python3dist(pyyaml)

Expected results:
python3.8dist(pyyaml)

Additional info:
This was already fixed in Fedora in https://src.fedoraproject.org/rpms/python-rpm-macros/c/638f809f4c15b8b14dfc1f6f8c3c08b0d2ba0b70, but it would have to be modified to account for the fact that there are no dots in `%python3_pkgversion` on RHEL.

Comment 1 Miro Hrončok 2022-05-25 11:05:20 UTC
Maxwell, could you please review https://git.centos.org/rpms/python-rpm-macros/pull-request/1 ?

Comment 3 Maxwell G 2022-05-25 15:19:51 UTC
(In reply to Miro Hrončok from comment #1)
> Maxwell, could you please review
> https://git.centos.org/rpms/python-rpm-macros/pull-request/1 ?

I left a comment[1]. Thanks for fixing this!

[1]: https://git.centos.org/rpms/python-rpm-macros/pull-request/1#comment-1114

Comment 4 Maxwell G 2022-05-28 04:47:24 UTC
`%pytest` does not respect `%python3_pkgversion`, either, as `%__pytest` is hardcoded to `/usr/bin/pytest-3`. This makes it so `%pytest` does not work with versions of pytest other than python3-pytest, as python3{8,9}-pytest provide /usr/bin/pytest-3.{8,9}. It looks like this was already solved in Fedora: https://src.fedoraproject.org/rpms/python-rpm-macros/c/02536540768555dde6d675935db45df81bcab7bf. I was going to suggest redefining `%__pytest` to `%{__python3} -m pytest`, but I'm not sure if that would cause problems with `%__python3` being set to platform-python by default.

Please let me know if I need to open a new bug for this.

Comment 6 Miro Hrončok 2022-05-28 07:31:22 UTC
(In reply to Maxwell G from comment #4)
> `%pytest` does not respect `%python3_pkgversion`, either, as `%__pytest` is
> hardcoded to `/usr/bin/pytest-3`. This makes it so `%pytest` does not work
> with versions of pytest other than python3-pytest, as python3{8,9}-pytest
> provide /usr/bin/pytest-3.{8,9}. It looks like this was already solved in
> Fedora:
> https://src.fedoraproject.org/rpms/python-rpm-macros/c/
> 02536540768555dde6d675935db45df81bcab7bf. I was going to suggest redefining
> `%__pytest` to `%{__python3} -m pytest`, but I'm not sure if that would
> cause problems with `%__python3` being set to platform-python by default.
> 
> Please let me know if I need to open a new bug for this.

 - %pytest is redefined in python3X-rpm-macros
 - `%{__python3} -m pytest` cannot be used (I wish it could) due to different default sys.path
 - to backport https://src.fedoraproject.org/rpms/python-rpm-macros/c/02536540768555dde6d675935db45df81bcab7bf yes, please open another bugzilla

Comment 7 Maxwell G 2022-05-30 02:13:40 UTC
(In reply to Miro Hrončok from comment #6) 
>  - %pytest is redefined in python3X-rpm-macros

It looks %__pytest is redefined in python39-rpm-macros[1] but not python38-rpm-macros[2]. In any case, I will open a new bugzilla to set %__pytest dynamically in python3-rpm-macros. That seems like a better approach anyways.

[1]: https://git.centos.org/rpms/python39/blob/c8s-stream-3.9/f/SOURCES/macros.python39#_3
[2]: https://git.centos.org/rpms/python38/blob/c8s-stream-3.8/f/SOURCES/macros.python38

Comment 8 Miro Hrončok 2022-05-30 06:48:00 UTC
See the commit message for how I tested this.

Comment 12 Maxwell G 2022-06-02 03:32:00 UTC
Am I correct in assuming that this is targeted for RHEL 8.7?

Comment 13 Petr Viktorin (pviktori) 2022-06-02 08:23:51 UTC
Currently, it is.

Comment 16 errata-xmlrpc 2022-11-08 09:42:24 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-2022:7572