From 67bce0d53444ecc3f8a8066d3fc507f08f54a654 Mon Sep 17 00:00:00 2001 From: vasilito Date: Sun, 12 Jul 2026 18:00:45 +0300 Subject: [PATCH] fix: auto-repair broken recipe.toml symlinks in build preflight Detects broken recipe.toml symlinks in local/recipes/ (self-referencing corruption from unknown source) and auto-restores from git before build. Prevents 'Package not found' errors when recipe.toml files are unreadable. --- local/scripts/build-preflight.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/local/scripts/build-preflight.sh b/local/scripts/build-preflight.sh index ce26a19d33..28522acb7d 100755 --- a/local/scripts/build-preflight.sh +++ b/local/scripts/build-preflight.sh @@ -33,6 +33,20 @@ cd "$PROJECT_ROOT" echo ">>> Build preflight: $CONFIG" +# Defensive: detect and repair broken recipe.toml symlinks in local/recipes/. +# These are tracked as regular files in git — a broken symlink means corruption. +broken_recipes=$(find local/recipes -name "recipe.toml" -xtype l 2>/dev/null | wc -l) +if [ "$broken_recipes" -gt 0 ]; then + echo ">>> WARNING: $broken_recipes broken recipe.toml symlinks detected — auto-repairing from git..." >&2 + find local/recipes -name "recipe.toml" -xtype l -exec git checkout -q -- {} \; 2>/dev/null + remaining=$(find local/recipes -name "recipe.toml" -xtype l 2>/dev/null | wc -l) + if [ "$remaining" -gt 0 ]; then + echo ">>> ERROR: $remaining recipe.toml files could not be restored. Build may fail." >&2 + else + echo ">>> Repaired: all recipe.toml files restored from git." + fi +fi + if [ -x "$SCRIPT_DIR/verify-overlay-integrity.sh" ]; then if ! "$SCRIPT_DIR/verify-overlay-integrity.sh" --quiet; then echo ">>> Preflight note: overlay integrity script reported legacy issues; continuing with build-focused checks."