Bug 1886509

Summary: %pyproject_buildrequires -e does not work when used repeatedly
Product: [Fedora] Fedora Reporter: Petr Viktorin (pviktori) <pviktori>
Component: pyproject-rpm-macrosAssignee: Miro Hrončok <mhroncok>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: mhroncok, pviktori, python-sig
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pyproject-rpm-macros-0-32.fc34 pyproject-rpm-macros-0-32.fc32 pyproject-rpm-macros-0-32.fc31 pyproject-rpm-macros-0-32.fc33 pyproject-rpm-macros-0-37.eln109 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-11 10:53:14 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 Petr Viktorin (pviktori) 2020-10-08 16:03:25 UTC
I haven't tested, but from the code it looks like I can't do something like:

%pyproject_buildrequires -e %{toxenv}-unit %{?with_integration_test:-e %{toxenv}-integration}

which should redefine %{toxenv} to either pyXY-unit or pyXY-unit,pyXY-integration, and install the relevant deps.

This would be much more useful than what the README currently suggests for the %tox -e flag:

    %check
    %tox
    %if %{with integration_test}
    %tox -e %{default_toxenv}-integration
    %endif

Comment 1 Miro Hrončok 2020-10-09 08:30:30 UTC
Currently, you can do:

    %pyproject_buildrequires -e %{toxenv}-unit%{?with_integration_test,%{toxenv}-integration}

Albeit it's not very nice.


However, supporting multiple -e might be problematic. It works with -x only because we pass them to the underlying Python script via %{?**}. However with -e, we do set a macro:

    %{-e:%{expand:%global toxenv %{-e*}}}

And I am not entirely sure it is possible to get "all the values used for all -e flags" in RPM.

Comment 2 Miro Hrončok 2020-10-09 08:39:10 UTC
(In reply to Miro Hrončok from comment #1)
> And I am not entirely sure it is possible to get "all the values used for
> all -e flags" in RPM.

We could parse it from %{?**} with a small Python snippet and do:

    %global toxenv %(%{__python3} pyproject_parse_toxenv.py %{?**})

Or a small Lua macro:

    %global toxenv %{_pyproject_parse_toxenv %{?**}}

Comment 3 Miro Hrončok 2020-10-22 22:14:09 UTC
Proof of concepts:

in Lua: https://src.fedoraproject.org/rpms/pyproject-rpm-macros/pull-request/128

in Python: https://src.fedoraproject.org/rpms/pyproject-rpm-macros/pull-request/129

Both are currently untested but show how this can be done. I think the Python implementation is more robust.

Comment 4 Fedora Update System 2020-11-11 10:53:14 UTC
FEDORA-2020-6b7fa698ba has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 5 Fedora Update System 2020-11-11 11:10:36 UTC
FEDORA-2020-e568a8a558 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-e568a8a558

Comment 6 Fedora Update System 2020-11-11 11:10:37 UTC
FEDORA-2020-4842c9141f has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2020-4842c9141f

Comment 7 Fedora Update System 2020-11-11 11:10:39 UTC
FEDORA-2020-ff1e7ce8ed has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2020-ff1e7ce8ed

Comment 8 Fedora Update System 2020-11-12 04:08:05 UTC
FEDORA-2020-4842c9141f 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-4842c9141f`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-4842c9141f

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

Comment 9 Fedora Update System 2020-11-12 04:25:04 UTC
FEDORA-2020-ff1e7ce8ed has been pushed to the Fedora 33 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-ff1e7ce8ed`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-ff1e7ce8ed

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

Comment 10 Fedora Update System 2020-11-12 04:42:52 UTC
FEDORA-2020-e568a8a558 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-e568a8a558`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-e568a8a558

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

Comment 11 Fedora Update System 2020-11-20 01:26:26 UTC
FEDORA-2020-e568a8a558 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 12 Fedora Update System 2020-11-20 01:29:19 UTC
FEDORA-2020-4842c9141f has been pushed to the Fedora 31 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 13 Fedora Update System 2020-11-20 01:39:02 UTC
FEDORA-2020-ff1e7ce8ed has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 14 Fedora Update System 2021-02-04 13:31:05 UTC
FEDORA-2021-46d1d95820 has been pushed to the Fedora ELN stable repository.
If problem still persists, please make note of it in this bug report.