Skip to content

rpm: Install BuildRequires from the spec - #397

Open
daandemeyer wants to merge 8 commits into
amutable:mainfrom
daandemeyer:in-place-buildrequires
Open

daandemeyer wants to merge 8 commits into
amutable:mainfrom
daandemeyer:in-place-buildrequires

Conversation

@daandemeyer

@daandemeyer daandemeyer commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

A hand-written rpm.package, or an in-place build, only gets the BuildRequires that its BUCK file lists.
systemd lists 66 of them by hand, and the list goes stale whenever the pin moves.

Let's run rpmspec on the spec in the buildroot with the same options as rpmbuild, and install what it
reports as an extra layer. Imported packages keep using their recorded BuildRequires, since rpm.branch()
derives their buildroot_packages from them.

build.py stages the spec and builds the rpmbuild command line inline. The
BuildRequires query needs to do the same, so let's move both into
rpmbuild.py. Pinned packaging now comes in as a directory in sources, and
a strict_subpackages flag replaces the packaging field.

Signed-off-by: Daan De Meyer <daan@amutable.com>
We write the frozen copy of an in-place spec over the spec in the checkout,
so staging needs a writable checkout. rpm resolves %include from its
working directory, not from the spec, so let's write the copy to SPECS like
any other spec.

Signed-off-by: Daan De Meyer <daan@amutable.com>
@daandemeyer
daandemeyer force-pushed the in-place-buildrequires branch from 728907f to 2d19e78 Compare November 10, 2026 12:25
@daandemeyer daandemeyer changed the title rpm: Install the BuildRequires of the spec that a build parses rpm: Install BuildRequires from the spec Nov 10, 2026
Nothing reads the BuildRequires of the spec that a build uses. The
buildroot only gets what the BUCK file lists. Let's add a driver that
stages the spec like build.py and runs rpmbuild -br in the buildroot with
the same arguments as the build. That also picks up what
%generate_buildrequires reports.

Signed-off-by: Daan De Meyer <daan@amutable.com>
rpm.branch() takes buildroot_packages from the BuildRequires of all
architectures, but build_requires only has those of the current one. A
package can then end up with buildroot_packages and nothing to install,
and the solve fails with "a solve needs at least one install spec". Let's
skip the solve when there's nothing to install.

Signed-off-by: Daan De Meyer <daan@amutable.com>
undelivered() checks that each install spec ended up in the transaction.
For a rich dependency like (A if B), resolve_pkg_spec() assumes B holds,
so the check fails when B isn't installed. Let's skip rich dependencies in
that check.

Signed-off-by: Daan De Meyer <daan@amutable.com>
A build with in_place_spec or in_place_packaging only gets the
BuildRequires that the BUCK file lists. systemd lists 66 of them by hand,
and the list goes stale whenever the pin moves. Let's query the spec and
install what it needs as an extra layer on top of the declared ones.

Imported packages keep their recorded BuildRequires. rpm.branch() derives
buildroot_packages from them, so anything new would come from the
distribution instead of the branch.

Signed-off-by: Daan De Meyer <daan@amutable.com>
The generated BUCK passes each property of _properties.json on its own
line, so a new property does nothing until the BUCK is regenerated. Let's
pass the whole dict instead.

Signed-off-by: Daan De Meyer <daan@amutable.com>
A hand-written rpm.package only installs the build_requires from its BUCK
file, which goes out of sync with the spec. Let's query the spec for every
build of a package that wasn't imported.

Signed-off-by: Daan De Meyer <daan@amutable.com>
@daandemeyer
daandemeyer force-pushed the in-place-buildrequires branch from 2d19e78 to 70f2928 Compare November 10, 2026 12:39
@martinpitt

Copy link
Copy Markdown
Member

For the first round, bot-to-bot review: pr-in-place-buildrequires-review.md

Sorry, in a long meeting, not much human review on that report -- can do in ~ 1 h.

This branch has not been deployed

No deployments
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.

2 participants