508432e0e5
check-unwired-patches.sh: scans local/patches/ for .patch files not referenced in any recipe.toml patches = [...] array. Detects 262 unwired patches (most intentionally kept for reference/rebase). P2-rebrand-start-message.patch: minimal 39-line patch changing 'Redox OS starting' to 'RedBear OS starting' in x86_64, aarch64, and riscv64 arch start files. Wired into kernel recipe after P8-msi.patch. Verified: make r.kernel builds with all 3 patches. Build system issues surfaced by the detector: - 250+ kernel individual patches kept for reference (absorbed/) - ~50 base individual patches — many intentionally unwired - ~30 relibc patches — may need wiring into relibc recipe - build-system patches applied by scripts, not recipes
61 lines
2.0 KiB
Bash
Executable File
61 lines
2.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# check-unwired-patches.sh — detect patch files not referenced in any recipe.toml
|
|
#
|
|
# Scans local/patches/ for .patch files that exist on disk but are NOT listed
|
|
# in any recipe's patches = [...] array. Also detects patches that are symlinked
|
|
# into recipes/ but whose recipe.toml entry no longer exists.
|
|
#
|
|
# Usage: ./local/scripts/check-unwired-patches.sh [--strict]
|
|
# --strict: exit non-zero if any unwired patches found (for CI)
|
|
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
STRICT=false
|
|
[[ "${1:-}" == "--strict" ]] && STRICT=true
|
|
|
|
UNWIRED=0
|
|
|
|
echo "=== Unwired Patch Check ==="
|
|
|
|
# Map patch file → list of recipe.toml files that reference it
|
|
declare -A PATCH_REFS
|
|
|
|
# Find all recipe.toml files
|
|
while IFS= read -r -d '' recipe; do
|
|
# Extract patch filenames from patches = [...] array
|
|
# Handles both local/patches/... and relative paths
|
|
while IFS= read -r patch_ref; do
|
|
# Resolve the patch path relative to the recipe directory
|
|
recipe_dir="$(dirname "$recipe")"
|
|
patch_path="$(cd "$recipe_dir" && realpath -m "$patch_ref" 2>/dev/null || echo "$recipe_dir/$patch_ref")"
|
|
PATCH_REFS["$patch_path"]+="$recipe "
|
|
done < <(grep -oP '"[^"]+\.patch"' "$recipe" | tr -d '"')
|
|
done < <(find "$ROOT/recipes" "$ROOT/local/recipes" -name 'recipe.toml' -print0 2>/dev/null)
|
|
|
|
# Find all patch files in local/patches/
|
|
while IFS= read -r -d '' patch; do
|
|
patch_real="$(realpath "$patch")"
|
|
found=false
|
|
for ref in "${!PATCH_REFS[@]}"; do
|
|
ref_real="$(realpath "$ref" 2>/dev/null || echo "$ref")"
|
|
if [[ "$ref_real" == "$patch_real" ]]; then
|
|
found=true
|
|
break
|
|
fi
|
|
done
|
|
if ! $found; then
|
|
UNWIRED=$((UNWIRED + 1))
|
|
echo " UNWIRED: $patch"
|
|
fi
|
|
done < <(find "$ROOT/local/patches" -name '*.patch' -print0 2>/dev/null)
|
|
|
|
echo ""
|
|
if [[ $UNWIRED -eq 0 ]]; then
|
|
echo "✅ All patches wired"
|
|
else
|
|
echo "⚠️ $UNWIRED unwired patch(es) found"
|
|
$STRICT && exit 1
|
|
fi
|
|
exit 0
|