Skip to content

package: build each remote repository once per architecture - #295

Closed
martinpitt wants to merge 5 commits into
amutable-systems:mainfrom
martinpitt:repository-exec
Closed

martinpitt wants to merge 5 commits into
amutable-systems:mainfrom
martinpitt:repository-exec

Conversation

@martinpitt

@martinpitt martinpitt commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

A box lock, the box and an image each reach a repository in their own configuration, so each of these downloaded every repo file again. To avoid that, reach the target of each architecture through an execution dependency, same pattern as commit 20176b6 did for boxes.


This is quite a hairy issue, see #292 . There are other ways to fix this, but I chose the pattern that we already do for boxes. It's just annoyingly noisy.

Sadly, what-ran does not show downloads, and as downloads happen in parallel, this is hard to measure with execution times. But it can be demoed like this. With this branch:

❱❱❱ bin/tine buck build tine//catalog:arch.rolling.box.lock.x86_64 tine//examples/image:base.arch
Network:  up 0B  down 210MiB
[...]
BUILD SUCCEEDED

On current main, that command fails, and already downloads more than the above, and didn't even download everything yet before it crashes:

Network:  up 0B  down 227MiB
[...]
tarfile.ReadError: not a gzip file

The tar error is because of a Buck2 bug: multiple parallel download_files() are not atomic, and write into the same file. I sent facebook/buck2#1561 for that, but I want to avoid downloading every repo file and rpm/pkg/deb three times.

Fixes #292

Only boxes currently use this, but we are about to do the same for
remote repositories.

Signed-off-by: Martin Pitt <martin@amutable.com>
A remote repository used its target name as its id, carried to lock
entries and the snapshot spec. The next commit declares one target per
architecture, such as `arch.rolling.core.repository.x86_64`, so a
repository's target name stops being unique. Pass the id as an
explicit attribute instead.

Signed-off-by: Martin Pitt <martin@amutable.com>
The next commit moves remote repositories to the execution
configuration, which no longer says what architecture a caller needs.
Prepare for that by declaring one target per served architecture with
that architecture as an attribute, and give the repository's name to an
alias that picks the caller's.

The alias reaches them as plain dependencies still, so there is no
effective change yet.

Signed-off-by: Martin Pitt <martin@amutable.com>
The "repo matches package system" check previously compared the
configured labels. The next commit moves repositories to be an
`exec_dep`, so their target configuration will change and break this
check.

This was only ever meant to compare e.g. `rpm:package_system` to
`pacman:package_system`, which is what `raw_target()` provides (the
unconfigured target name).

Signed-off-by: Martin Pitt <martin@amutable.com>
A box lock, the box and an image each reach a repository in their own
configuration, so each of these downloaded every repo file again.
To avoid that, reach the target of each architecture through an
execution dependency, same pattern as commit 20176b6 did for boxes.

Signed-off-by: Martin Pitt <martin@amutable.com>
@martinpitt

Copy link
Copy Markdown
Member Author

Let's go with #300 and shelve this.

@martinpitt martinpitt closed this Oct 12, 2026
@martinpitt
martinpitt deleted the repository-exec branch October 12, 2026 10:27
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.

refresh-catalog is failing

1 participant