Skip to content

pkg_rpm: add autoreqprov attribute - #1100

Merged
cgrindel merged 1 commit into
bazelbuild:mainfrom
chouquette:chouquette/rpm-autoreqprov
Nov 18, 2026
Merged

cgrindel merged 1 commit into
bazelbuild:mainfrom
chouquette:chouquette/rpm-autoreqprov

Conversation

@chouquette

@chouquette chouquette commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Unless the spec sets AutoReqProv: no, rpmbuild runs its dependency generators on every packaged file.

For packages that declare their dependencies explicitly this is wasted work: on a package with about 16k
files it took 6 of the 9 minutes of the rpmbuild run. Filtering the result with __requires_exclude and __provides_exclude does not avoid it, since the generators still run.

Add an autoreqprov attribute to pkg_rpm. It defaults to True, matching rpm's default. When False, the spec preamble gets AutoReqProv: no.

Relates to #935.

@chouquette

Copy link
Copy Markdown
Contributor Author

Interactions with reviewers will be handled by a human

@chouquette
chouquette marked this pull request as ready for review November 17, 2026 15:23
gh-worker-dd-mergequeue-cf854d Bot pushed a commit to DataDog/datadog-agent that referenced this pull request Nov 18, 2026
### What does this PR do?

Speeds up the `MakeRpm` step of the Bazel rpms: the agent rpm goes from about 12 to under 5 minutes locally.

- Bump rules_pkg to pick up the new `autoreqprov` attribute (bazelbuild/rules_pkg#1100) and the batched `%install` commands (bazelbuild/rules_pkg#1101).
- Use `autoreqprov = False` (bazelbuild/rules_pkg#1100) to set `AutoReqProv: no`, like omnibus does, instead of filtering the generated dependencies afterwards.
- Skip the steps rpmbuild runs after `%install` (`brp-strip`, `brp-compress`, ...), like omnibus does.

| Before | After |
| --- | --- |
| rpmbuild scans every packaged file for dependencies, then `__requires_exclude`/`__provides_exclude` discard them all | No scan; same Requires and Provides |
| `%install` runs `install`, `cp` and `chmod` for each file | Commands are batched per directory |
| dogstatsd, ddot, installer and iot rpms go through `brp-*` steps | Skipped, as for the agent rpm (whose `__strip` override is removed) and in omnibus |

Unchanged: omnibus packages, and the agent rpm's metadata and file list.

### Motivation

`MakeRpm` took 736s of a local agent rpm build, mostly spent generating dependencies we then threw away.

### Describe how you validated your changes

Built the agent rpm locally: `MakeRpm` went from 736s to 285s, with identical Requires, Provides, Conflicts and file list.


Co-authored-by: hugo.beauzee <[email protected]>
@cgrindel
cgrindel merged commit e1c15ce into bazelbuild:main Nov 18, 2026
6 checks passed
@chouquette
chouquette deleted the chouquette/rpm-autoreqprov branch November 18, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants