Bug 1838992

Summary: %pycached cannot be used with %exclude
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: python-rpm-macrosAssignee: Miro Hrončok <mhroncok>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: rawhideCC: cstratak, j, m.cyprian, mhroncok, orion, pviktori, python-sig
Target Milestone: ---Keywords: FutureFeature, Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-rpm-macros-3.9-3.fc33 python-rpm-macros-3-58.fc32 python-rpm-macros-3-57.fc31 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-13 09:45:05 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-05-22 09:42:46 UTC
The following naïve code:

    %exclude %pycached %{python3_sitelib}/%{name}/steps/provision/podman.py

Generates:

    %exclude /usr/lib/python3.8/site-packages/%{name}/steps/provision/podman.py
    /usr/lib/python3.8/site-packages/%{name}/steps/provision/__pycache__/podman.cpython-38{,.opt-?}.pyc

Which is kinda bad and dangerous.

--------


The following naïve code:

    %pycached %exclude %{python3_sitelib}/%{name}/steps/provision/podman.py

Errors:

    %pycached can only be used with paths explicitly ending with .py

Which is kinda not the correct error line.


---------

AFAIK the first case is CANTFIX, but the second one can be reasonably fixed to produce:

    %exclude /usr/lib/python3.8/site-packages/%{name}/steps/provision/podman.py
    %exclude /usr/lib/python3.8/site-packages/%{name}/steps/provision/__pycache__/podman.cpython-38{,.opt-?}.pyc

If it is, we can document that users need to use "%pycached %exclude" instead of "%exclude %pycached" in the guidelines, as a caveat.

Comment 1 Miro Hrončok 2020-05-22 09:52:35 UTC
The "reasonable fix" is to replace:

    path = rpm.expand("%{?1}")

with:

    path = rpm.expand("%{?*}")

In %pycached definition. Whoever gets to that, please take it.

Comment 2 Marcel Plch 2020-05-27 12:36:49 UTC
I have submitted a pull request here: https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/62

Comment 3 Miro Hrončok 2020-06-11 18:23:59 UTC
A new PR is in https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/65

Comment 4 Miro Hrončok 2020-06-15 09:39:33 UTC
This is now fixed in rawhide.

Leaving in POST because backports are necessary and the guidelines still need the note.

Comment 5 Fedora Update System 2020-06-16 02:03:23 UTC
FEDORA-EPEL-2020-8ae5e07128 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2020-8ae5e07128

Comment 6 Fedora Update System 2020-06-16 10:43:09 UTC
FEDORA-2020-ac08d74be3 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-ac08d74be3

Comment 7 Fedora Update System 2020-06-18 01:23:06 UTC
FEDORA-EPEL-2020-8ae5e07128 has been pushed to the Fedora EPEL 7 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2020-8ae5e07128

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2020-06-18 13:40:45 UTC
FEDORA-2020-4411a39579 has been pushed to the Fedora 31 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-4411a39579`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-4411a39579

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2020-06-18 14:13:03 UTC
FEDORA-2020-ac08d74be3 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-ac08d74be3`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-ac08d74be3

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 10 Fedora Update System 2020-06-24 01:00:42 UTC
FEDORA-2020-ac08d74be3 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 11 Fedora Update System 2020-07-03 01:37:10 UTC
FEDORA-2020-4411a39579 has been pushed to the Fedora 31 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 12 Fedora Update System 2020-07-03 01:52:03 UTC
FEDORA-EPEL-2020-8ae5e07128 has been pushed to the Fedora EPEL 7 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 13 Miro Hrončok 2020-07-13 13:22:25 UTC
Leaving in ON_QA because the guidelines still need the note.