Sysroot support - #254
Open
LittleHuba wants to merge 2 commits into
Open
Sysroot support#254LittleHuba wants to merge 2 commits into
LittleHuba wants to merge 2 commits into
Conversation
Adds apt.sysroot(), a repository rule that unpacks a dependency_set's packages into a flat, fetch-time sysroot directory for a single target architecture, for use with toolchains like toolchains_llvm. - New apt/private/sysroot_repository.bzl: for each transitively required package, downloads the .deb, extracts its data.tar member, and materializes the contents into a flat `sysroot/` directory with a generated BUILD.bazel exposing it as a `:sysroot` filegroup. Extraction uses a hermetic, prebuilt bsdtar binary (resolved per exec platform via @bazel_lib//lib:repo_utils.bzl and tar.bzl's bsd_tar_toolchains repos) rather than the host's `ar`/`tar`, since bsdtar/libarchive natively reads both the `ar` container format used by .deb files and the nested data.tar.* payload, making the unpack reproducible across machines regardless of what's installed on the host. - apt.sysroot(name, dependency_set, architecture) tag class; wired up in the module extension alongside the existing apt.install() dependency sets. Fails with a clear error if the referenced dependency_set wasn't declared via apt.install(). - translate_dependency_set.bzl gains dependency_set_transitive_package_keys, which computes the architecture-scoped transitive closure of package keys for a dependency_set (used by sysroot_repository.bzl to decide which packages to unpack). Includes a renamed/expanded test (no_mixed_architectures_deps_test) plus new coverage for the transitive closure helper. - MODULE.bazel: use_repo the per-platform bsd_tar_toolchains_* repos from tar.bzl so sysroot_repository.bzl can reference a concrete bsdtar binary label for the exec platform. - README.md and new examples/sysroot/ example, plus e2e/smoke and examples/MODULE.bazel wiring, showing apt.sysroot() paired with toolchains_llvm's llvm.sysroot() for a hermetic C++ toolchain. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Restructuring to avoid code duplication while keeping the same checks for both public call flows. Some checks were shifted to lockfile.bzl since it is a globally verifiable condition that all later logic should benefit from. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
LittleHuba
force-pushed
the
sysroot_support
branch
from
August 26, 2026 10:03
73fe393 to
21de6f1
Compare
LittleHuba
marked this pull request as ready for review
August 26, 2026 18:54
Contributor
Author
|
@thesayyn anything I can do to help this progress? |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is finally the PR to add sysroot support to rules_distroless.
This PR consits of two commits:
I think the second piece is crucial to not end up with bugs appearing on one path while they were already fixed on the other.
An example and smoke test were added to exercise the new functionality in CI and show users how to create the sysroot and inject it into a toolchain.