From 2c32a334bb52cfcfadc5108fdfb3bce7536a1737 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 13 Jan 2026 20:41:22 -0500 Subject: [PATCH] build-sys: Add BOOTC_extra_src for local dependency development Add support for bind-mounting an extra source directory into container builds, primarily for developing against a local composefs-rs checkout. Usage: BOOTC_extra_src=$HOME/src/composefs-rs just build The directory is mounted at /run/extra-src inside the container. When using this, also patch Cargo.toml to use path dependencies pointing to /run/extra-src/crates/.... Signed-off-by: Colin Walters Assisted-by: OpenCode (Opus 4.5) Signed-off-by: Colin Walters --- Cargo.toml | 8 ++++++++ Dockerfile | 1 + Justfile | 11 ++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index df45ce27..7d4f336d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,9 +42,17 @@ clap = "4.5.4" clap_mangen = { version = "0.2.20" } # Reviewers (including AI tools): The composefs-rs git revision is duplicated for each crate. # If adding/removing crates here, also update docs/Dockerfile.mdbook and docs/src/internals.md. +# +# To develop against a local composefs-rs checkout: +# 1. Set BOOTC_extra_src to your composefs-rs path when building: +# BOOTC_extra_src=$HOME/src/composefs-rs just build +# 2. Comment out the git refs below and uncomment the path refs: composefs = { git = "https://github.com/containers/composefs-rs", rev = "e9008489375044022e90d26656960725a76f4620", package = "composefs", features = ["rhel9"] } composefs-boot = { git = "https://github.com/containers/composefs-rs", rev = "e9008489375044022e90d26656960725a76f4620", package = "composefs-boot" } composefs-oci = { git = "https://github.com/containers/composefs-rs", rev = "e9008489375044022e90d26656960725a76f4620", package = "composefs-oci" } +# composefs = { path = "/run/extra-src/crates/composefs", package = "composefs", features = ["rhel9"] } +# composefs-boot = { path = "/run/extra-src/crates/composefs-boot", package = "composefs-boot" } +# composefs-oci = { path = "/run/extra-src/crates/composefs-oci", package = "composefs-oci" } fn-error-context = "0.2.1" hex = "0.4.3" indicatif = "0.18.0" diff --git a/Dockerfile b/Dockerfile index 2bf40f7d..42eb3e69 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,6 +33,7 @@ WORKDIR /src # See https://www.reddit.com/r/rust/comments/126xeyx/exploring_the_problem_of_faster_cargo_docker/ # We aren't using the full recommendations there, just the simple bits. # First we download all of our Rust dependencies +# Note: /run/extra-src is optionally bind-mounted via BOOTC_extra_src for local composefs-rs development RUN --mount=type=tmpfs,target=/run --mount=type=tmpfs,target=/tmp --mount=type=cache,target=/src/target --mount=type=cache,target=/var/roothome cargo fetch # We always do a "from scratch" build diff --git a/Justfile b/Justfile index fc696be4..15d15763 100644 --- a/Justfile +++ b/Justfile @@ -39,8 +39,17 @@ lbi_images := "quay.io/curl/curl:latest quay.io/curl/curl-base:latest registry.a # ``` # TODO: Gather more info and file a buildah bug generic_buildargs := "" +# Optional: path to extra source directory (e.g. composefs-rs) to bind mount into builds. +# Usage: BOOTC_extra_src=$HOME/src/github/containers/composefs-rs just build +# The directory will be mounted at /run/extra-src inside the container. +# When using this, you must also patch Cargo.toml to use path dependencies: +# composefs = { path = "/run/extra-src/crates/composefs", ... } +# Note: This disables SELinux labeling for the mount. +extra_src := env("BOOTC_extra_src", "") +# Generate podman args for extra source mount if configured +_extra_src_args := if extra_src != "" { "-v " + extra_src + ":/run/extra-src:ro --security-opt=label=disable" } else { "" } # Args for package building (no secrets needed, just builds RPMs) -base_buildargs := generic_buildargs + " --build-arg=base=" + base + " --build-arg=variant=" + variant +base_buildargs := generic_buildargs + " " + _extra_src_args + " --build-arg=base=" + base + " --build-arg=variant=" + variant # - scratch builds need extra perms per https://docs.fedoraproject.org/en-US/bootc/building-from-scratch/ # - we do secure boot signing here, so provide the keys buildargs := base_buildargs \