From b6ed9cab1995dc06fd1426383854051afd3998e5 Mon Sep 17 00:00:00 2001 From: Admin Pupkin Date: Tue, 9 Jun 2026 15:05:43 +0300 Subject: [PATCH] build-redbear: stop nuking entire repo when a low-level source is stale MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- local/scripts/build-redbear.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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