apt-get
deb_index(name, manifest, lock, package_template, resolve_transitive)
A convience repository macro for apt rules.
This documentation provides an overview of the convenience repository macro around package_index and resolve repository rules.
load("@rules_distroless//apt:index.bzl", "deb_index")
deb_index(
name = "bullseye",
# For the initial setup, the lockfile attribute can be omitted and generated by running
# bazel run @bullseye//:lock
# This will generate the lock.json file next to the manifest file by replacing `.yaml` with `.lock.json`
lock = "//examples/apt:bullseye.lock.json",
manifest = "//examples/apt:bullseye.yaml",
)
load("@bullseye//:packages.bzl", "bullseye_packages")
bullseye_packages()apt = use_extension("@rules_distroless//apt:extensions.bzl", "apt")
apt.deb_index(
name = "bullseye",
lock = "//examples/apt:bullseye.lock.json",
manifest = "//examples/apt:bullseye.yaml",
)
use_repo(apt, "bullseye")This macro will expand to two repositories: #name and #name#_resolve.
A typical workflow for deb_index involves the generation of a lockfile (deb_resolve) and the consumption of the lockfile by deb_package_index for generating a DAG.
The lockfile generation can be on-demand by omitting the lock attribute. However, this comes with the cost of performing a new package resolution on repository cache misses.
While we strongly encourage users to check in the generated lockfile, it's not always possible because Debian repositories are rolling by default. Therefore, a lockfile generated today might not work later if the upstream repository removes or publishes a new version of a package.
Users can still use a snapshot repository and check in the generated lockfiles. This is possible because snapshot.debian.org is an immutable point-in-time snapshot of the upstream repositories, meaning packages never get deleted or updated in a specific snapshot.
An example of this can be found at /examples/debian_snapshot.
Ubuntu also has a similar point-in-time snapshot service hosted at snapshot.ubuntu.com, which can be used similarly.
An example of this can be found at /examples/ubuntu_snapshot.
PARAMETERS