Dynamic BuildRequires
Summary
Add possibility to generate build-time dependencies within RPM spec file and teach RPM and mock how to handle this.
Owner
- Name: Igor Gnatenko, Florian Festi, Miroslav Suchý
- Email: ignatenkobrain@fedoraproject.org, ffesti@redhat.com, miroslav@suchy.cz
- Release notes owner:
Current status
- Targeted release: Fedora 31
- Last updated: 2019-04-12
- Tracker bug: <will be assigned by the Wrangler>
Detailed Description
For many languages (Rust, Golang, Node.Js, Ruby, Python), BuildRequires can be automatically generated. All it takes, run some special tool which will output dependencies in RPM format.
rpmbuild
- New
%generate_buildrequires
section ("script" later in text) in spec file - New option
-br
which will run script, check dynamic BuildRequires- If all of them are satisfied, generate
src.rpm
- If some of them are not satisfied or
--nodeps
is present, generatebuildreqs.nosrc.rpm
- If all of them are satisfied, generate
src.rpm
produced byrpmbuild -ba
will contain dynamic BuildRequires- Option
-bs
does not change behavior
mock
- New option in config
dynamic_buildrequires
which controls support of new features - Support for rpmbuild changes if this option enabled
Benefit to Fedora
Packagers won't have to pre-generate BuildRequires in the spec file which means it will be always updated (and correct) :
- Packagers can focus of making their packages better instead of spending all their packaging time copying BuildRequires from documentation and third party tools.
- BuildRequires are dropped as soon as they're no longer necessary
- Packages can be easily bumped without requiring a manual BuildRequires refresh
- BuildRequires and Requires generation can use similar utilities, making sure that the deps packages declare can also be used for second-level building. Packages no longer need to declare the deps of their second and n-th dependencies because someone forgot to declare them in the correct package.
Scope
- Proposal owners: Implement support for a feature in RPM and mock. Make use of it in interested ecosystems.
- Other developers: Maintainers of language stacks are advised to use this feature.
- Release engineering: #8129
- List of deliverables: N/A
- Policies and guidelines: Packaging Guidelines need to be updated with instructions how to use this feature.
- Trademark approval: N/A (not needed for this Change)
Upgrade/compatibility impact
Packagers and users who use repoquery might be affected (src.rpm might not contain generated dependencies).
How To Test
0. Make sure you have new rpm-build
(OPTION 1) or mock
(OPTION 2).
1. Add %generate_buildrequires
script into spec file which prints dependencies, remove static BuildRequires
2. OPTION1: Run rpmbuild -ba
with your usual workflow
2. OPTION2: Run mock -r fedora-rawhide-x86_64
with your usual workflow
3. Check that your package builds fine, dependencies are getting checked/installed and final src.rpm contains generated BuildRequires
User Experience
Users won't notice differences.
Dependencies
Required feature needs to be implemented in RPM and mock.
Contingency Plan
- Contingency mechanism: (What to do? Who will do it?) Proposal Owners might still ship feature disabled for Fedora buildsystem but have it available for end-users, and move full completion to the next release.
- Contingency deadline: Beta Freeze
- Blocks release? No.
- Blocks product? No.
Documentation
TBD.
Release Notes
TBD.