build: REDBEAR_SKIP_ABI_STALENESS for fast single-recipe iteration

Iterating on one recipe (e.g. redbear-iwlwifi) forced a ~30-min re-churn every
rerun: the relibc-consumer invalidation (build/sysroot wipe + pkgar/target
deletion) re-cooked dozens of cached packages before reaching the edited one,
even when relibc was unchanged. Add REDBEAR_SKIP_ABI_STALENESS=1 to skip both
the layer-B build/sysroot clean and the layer-C invalidation loops. The
cookbook BLAKE3 dep-hash cache still re-cooks recipes whose sources changed, so
the edited package rebuilds while everything else stays cached — the rerun goes
straight to it. Safe only when relibc ABI is unchanged (documented + escape is
opt-in); unset to restore the stale-binary safety net when bumping relibc/base.
Documented in --help alongside REDBEAR_FORCE_TOOLCHAIN_RECOOK.
This commit is contained in:
2026-07-24 15:39:21 +09:00
parent a023241e6b
commit a8d1f472b8
+21 -2
View File
@@ -284,6 +284,15 @@ Configs:
Environment:
REDBEAR_RELEASE If set, builds from immutable release archives.
Override to empty for development builds.
REDBEAR_SKIP_ABI_STALENESS=1
Fast iteration: skip the relibc-consumer invalidation
churn so a rerun goes straight to the recipe you changed
(the cookbook cache still re-cooks changed sources). Safe
ONLY when relibc's ABI is unchanged. Unset it whenever you
bump relibc/base, or stale binaries may ship.
REDBEAR_FORCE_TOOLCHAIN_RECOOK=1
Force a full re-cook of preserved toolchain packages
(llvm21/clang21/lld21/rust) on a relibc change.
EOF
}
@@ -652,7 +661,7 @@ if [ "$NO_CACHE" != "1" ]; then
done
if [ "$USERSPACE_RUNTIME_STALE" = "1" ]; then
if [ "$USERSPACE_RUNTIME_STALE" = "1" ] && [ "${REDBEAR_SKIP_ABI_STALENESS:-0}" != "1" ]; then
echo ">>> Cleaning stale build/sysroot dirs (userspace-linked runtime changed)..."
find "$PROJECT_ROOT/recipes" "$PROJECT_ROOT/local/recipes" \
\( -path "*/target/x86_64-unknown-redox/build" \
@@ -736,7 +745,17 @@ if [ "$NO_CACHE" != "1" ]; then
find "$PROJECT_ROOT/recipes" "$PROJECT_ROOT/local/recipes" \
-path "*/$pkg/target" -type d -exec rm -rf {} + 2>/dev/null || true
}
if [ "$relibc_rebuilding" = "1" ]; then
if [ "${REDBEAR_SKIP_ABI_STALENESS:-0}" = "1" ]; then
# Fast-iteration escape hatch: skip the entire relibc-consumer
# invalidation. Safe ONLY when relibc's ABI is unchanged (e.g. iterating
# on a single driver/app recipe). The cookbook's own BLAKE3 dep-hash
# cache still rebuilds recipes whose sources changed, so your edited
# package re-cooks while everything else stays cached — no 30-min churn
# to re-reach it. Unset to restore the stale-binary safety net (which is
# required whenever relibc/base actually changed).
echo ">>> REDBEAR_SKIP_ABI_STALENESS=1 — skipping relibc-consumer invalidation"
echo ">>> (fast iteration; assumes relibc ABI unchanged). Unset to restore it."
elif [ "$relibc_rebuilding" = "1" ]; then
echo ">>> relibc is rebuilding — it is statically linked into every"
echo ">>> userspace binary, so ALL packages are invalidated to force a"
echo ">>> clean relink (correctness over speed; prevents stale-binary skew)."