From Fedora Project Wiki
No edit summary
Line 1: Line 1:
= BuildRequires Generators =
= Dynamic BuildRequires =


== Summary ==
== Summary ==
Line 21: Line 21:
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.
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.


Q: How will it work under the hood?
=== rpmbuild ===
A: When you build RPM, something like this will happen under the hood…
# rpm would perform %prep (which is supposed to abort if some dependencies missing and print them)
# mock would install those dependencies and resume build


Q: Will src.rpm contain all generated dependencies?
* New <code>%generate_buildrequires</code> section ("script" later in text) in spec file
A: This is not known yet, we'll update page once it is known.
* New option <code>-br</code> which will run script, check dynamic BuildRequires
** If all of them are satisfied, generate <code>src.rpm</code>
** If some of them are not satisfied or <code>--nodeps</code> is present, generate <code>buildreqs.nosrc.rpm</code>
* <code>src.rpm</code> produced by <code>rpmbuild -ba</code> will contain dynamic BuildRequires
* Option <code>-bs</code> does not change behavior


Q: Does this mean that package builds won't be reproducible anymore?
=== mock ===
A: No, as long as you have same buildroot and tool which is generating BuildRequires is doing so in reproducible manner, it should not affect reproducibility.
 
* New option in config <code>dynamic_buildrequires</code> which controls support of new features
* Support for rpmbuild changes if this option enabled


== Benefit to Fedora ==
== Benefit to Fedora ==
Line 42: Line 45:


== Scope ==
== Scope ==
* Proposal owners: Implement support for a feature in RPM and mock (if implemented properly, Koji should just work). Make use of it in interested ecosystems.
* 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.
* Other developers: Maintainers of language stacks are advised to use this feature.
* Release engineering: [https://pagure.io/releng/issue/8129 #8129]
* Release engineering: [https://pagure.io/releng/issue/8129 #8129]
Line 53: Line 56:


== How To Test ==
== How To Test ==
<!-- This does not need to be a full-fledged document. Describe the dimensions of tests that this change implementation is expected to pass when it is done.  If it needs to be tested with different hardware or software configurations, indicate them. The more specific you can be, the better the community testing can be.
0. Make sure you have new <code>rpm-build</code> (OPTION 1) or <code>mock</code> (OPTION 2).
 
1. Add <code>%generate_buildrequires</code> script into spec file which prints dependencies, remove static BuildRequires
Remember that you are writing this how to for interested testers to use to check out your change implementation - documenting what you do for testing is OK, but it's much better to document what *I* can do to test your change.
2. OPTION1: Run <code>rpmbuild -ba</code> with your usual workflow
 
2. OPTION2: Run <code>mock -r fedora-rawhide-x86_64</code> with your usual workflow
A good "how to test" should answer these four questions:
3. Check that your package builds fine, dependencies are getting checked/installed and final src.rpm contains generated BuildRequires
 
0. What special hardware / data / etc. is needed (if any)?
1. How do I prepare my system to test this change? What packages
need to be installed, config files edited, etc.?
2. What specific actions do I perform to check that the change is
working like it's supposed to?
3. What are the expected results of those actions?
-->
TBD.  


== User Experience ==
== User Experience ==

Revision as of 07:17, 12 April 2019

Dynamic BuildRequires

Summary

Add possibility to generate build-time dependencies within RPM spec file and teach RPM and mock how to handle this.

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, generate buildreqs.nosrc.rpm
  • src.rpm produced by rpmbuild -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
  • 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.