diff --git a/local/scripts/build-redbear.sh b/local/scripts/build-redbear.sh index 2b1210b7b1..88802314ef 100755 --- a/local/scripts/build-redbear.sh +++ b/local/scripts/build-redbear.sh @@ -188,9 +188,13 @@ fi echo ">>> Building Red Bear OS with config: $CONFIG" echo ">>> This may take 30-60 minutes on first build..." -# Stale-build prevention: if any source repo has commits newer than its -# pkgar, force a clean rebuild. This prevents the cookbook from using -# cached packages with stale binaries. +# Stale-build prevention: if a low-level source repo has commits newer +# than its pkgar, delete only that package's pkgar and target dir. The +# cookbook will rebuild it; downstream packages will pick up the new +# relibc/kernel/base via their own dependency tracking. We deliberately +# avoid nuking the entire repo — that would force rebuilding the full +# mesa/llvm21/qt6/kwin stack on every base source change, which is the +# primary cause of multi-hour "forever" rebuilds. if [ "$NO_CACHE" != "1" ]; then for src in relibc kernel base bootloader installer; do src_dir="$PROJECT_ROOT/local/sources/$src" @@ -206,10 +210,9 @@ try: except: pass " 2>/dev/null || echo "") if [ -n "$src_commit" ] && [ "$src_commit" != "$pkgar_commit" ] && [ -n "$pkgar_commit" ]; then - echo ">>> Stale $src detected (source newer than pkgar), force-rebuilding..." + echo ">>> Stale $src detected (source newer than pkgar); invalidating pkgar only..." rm -f "$PROJECT_ROOT/repo/x86_64-unknown-redox/$src".* find "$PROJECT_ROOT/recipes" -path "*/$src/target" -type d -exec rm -rf {} + 2>/dev/null || true - NO_CACHE=1 fi fi done