build-redbear: stop nuking entire repo when a low-level source is stale

Previously, when relibc/kernel/base/bootloader/installer had commits
newer than their pkgar, the script set NO_CACHE=1, which ran
'make repo_clean' and deleted the entire repo/ directory. This
forced rebuilding the full mesa/llvm21/qt6/kwin stack on every
base source change — adding 30+ minutes of wasted work to every
mini build.

Now we only delete the specific stale package's pkgar and target
dir. The cookbook rebuilds that package; downstream packages pick
up the new relibc/kernel/base via their own dependency tracking
without invalidating the rest of the repo. This is the primary
fix for the 'forever build' complaint: base source changes no
longer trigger a full mesa/llvm rebuild.
This commit is contained in:
2026-06-09 15:05:43 +03:00
parent 19763b3ce4
commit b6ed9cab19
+8 -5
View File
@@ -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