-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FR: An alternative API design for easier apt.install #123
Comments
This is serendipitous 😄 I didn't see this issue until I got notified when you mentioned it in #56 but last week I was also drafting an almost exact API! I've been thinking about it since my reviews to those old PRs and the issues I found with the architectures. I 200% love this, the current API conflates the architecture of TL;DRHere's a quick overview of how I was drafting a new API, incorporating some of your
apt = use_extension("@rules_distroless//apt:extensions.bzl", "apt")
apt.sources(
name = "bookworm",
file = "//apt/sources/bookworm.sources",
)
apt.sources(
name = "docker",
file = "//apt/sources/docker.list",
)
apt.install(
name = "base"
# architectures = ["arm64"],
sources = ["@apt//sources/bookworm"],
packages = "//apt/packages/bookworm.yaml",
lock = "//apt/packages/bookworm.lock.json",
)
# defaults to the "nolock = True" behavior
apt.install(
name = "docker"
# architectures = ["arm64"],
sources = ["@apt//sources/docker"],
packages = "//apt/packages/docker.yaml",
)
use_repo(apt, "apt")
# update sources repo
$ bazel run @apt//sources/bookworm:update
# make / update install lock
$ bazel run @apt//install/base:lock
Types: deb
Architectures: amd64 arm64
URIs: http://deb.debian.org/debian
Suites: bookworm bookworm-updates
Components: main contrib non-free non-free-firmware
Types: deb
Architectures: amd64 arm64
URIs: http://deb.debian.org/debian-security
Suites: bookworm-security
Components: main contrib non-free non-free-firmware
packages:
- coreutils # for commands like `ls`
# for apt list --installed
- dpkg
- apt
- perl
# docker packages
- docker
packages:
- docker
load("@rules_oci//oci:defs.bzl", "oci_image")
oci_image(
name = "base",
architecture = select({
"@platforms//cpu:arm64": "arm64",
"@platforms//cpu:x86_64": "amd64",
}),
os = "linux",
tars = [
"@apt//install/bookworm",
],
)
oci_image(
name = "docker",
base = ":base",
tars = [
"@apt//install/docker",
],
) CommentsHere's a long version of the TL;DR above with more explanations. Also, I've used folded sections to avoid a "wall of text". apt.sources: support DEB822 .sources format
|
The text was updated successfully, but these errors were encountered: