Bug 2076994

Summary: RFE: Support generating runtime BuildRequires for build backends without prepare_metadata_for_build_wheel()
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
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: carl, code, lbalhar, mhroncok, pviktori, python-sig
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pyproject-rpm-macros-1.2.0-1.fc37 pyproject-rpm-macros-1.2.0-1.fc36 pyproject-rpm-macros-1.2.0-1.fc34 pyproject-rpm-macros-1.2.0-1.fc35 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-06 09:20:15 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 2022-04-20 11:26:07 UTC
E.g. hatchling does not support the prepare_metadata_for_build_wheel() PEP 517 hook. See https://github.com/ofek/hatch/issues/128

The hook is optional and when we attempt to use %pyproject_buildrequires -r (the default), it fails with:

    ValueError: build backend cannot provide build metadata (incl. runtime requirements) before build


Let's use this bugzilla to track work that allows us to generate the metadata anyway.

Comment 1 Miro Hrončok 2022-04-20 11:33:22 UTC
The general idea is:

 1. provide a new flag for %pyproject_buildrequires (e.g. -w)
 2. when the flag is used, %pyproject_buildrequires will build the wheel (as if in %pyproject_wheel) and read the runtime requires from it
 3. (optional, nice to have) when the wheel is built during (2), %pyproject_wheel should probably just do nothing instead of building it again
 4. (later, when battle-tested) the -w flag is figured out automatically (missing prepare_metadata_for_build_wheel hook and no -R flag)



Ideally, the build of the wheel would be extracted from %pyproject_wheel and reused twice. This would require some refactoring, as %pyproject_wheel expands to shell-only while %pyproject_buildrequires is implemented mostly as a Python script.

Also, we need to compensate for https://fedoraproject.org/wiki/Changes/SetBuildFlagsBuildCheck not setting the flags in %generate_buildrequires, to have a consistent set of flags -- the wheel must be produced identially.

Comment 2 Miro Hrončok 2022-04-22 14:49:38 UTC
Very initial proposed implementation: https://src.fedoraproject.org/rpms/pyproject-rpm-macros/pull-request/272

Comment 3 Fedora Update System 2022-05-06 09:17:17 UTC
FEDORA-2022-245f1c85b8 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-245f1c85b8

Comment 4 Fedora Update System 2022-05-06 09:20:15 UTC
FEDORA-2022-245f1c85b8 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 5 Fedora Update System 2022-05-06 09:32:22 UTC
FEDORA-2022-80586f3147 has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-80586f3147

Comment 6 Fedora Update System 2022-05-06 09:32:23 UTC
FEDORA-2022-d4047b4440 has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2022-d4047b4440

Comment 7 Fedora Update System 2022-05-06 09:32:24 UTC
FEDORA-2022-64c16b2d38 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2022-64c16b2d38

Comment 8 Fedora Update System 2022-05-06 11:02:22 UTC
FEDORA-2022-80586f3147 has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-80586f3147`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-80586f3147

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

Comment 9 Fedora Update System 2022-05-07 04:38:11 UTC
FEDORA-2022-80586f3147 has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 10 Fedora Update System 2022-05-08 03:26:52 UTC
FEDORA-2022-d4047b4440 has been pushed to the Fedora 35 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-d4047b4440`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-d4047b4440

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

Comment 11 Fedora Update System 2022-05-08 04:06:21 UTC
FEDORA-2022-64c16b2d38 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-64c16b2d38`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-64c16b2d38

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

Comment 12 Fedora Update System 2022-05-16 01:43:52 UTC
FEDORA-2022-64c16b2d38 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 13 Fedora Update System 2022-05-16 02:04:40 UTC
FEDORA-2022-d4047b4440 has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.