build: fix source reversion root cause — stop applying patches to local fork paths

The build-redbear.sh script was applying patches from local/patches/ to
recipes/core/{kernel,base,relibc,installer}/source/ via apply_patch_dir().
For path= (local fork) components, recipes/core/<comp>/source is a SYMLINK
to local/sources/<comp>. The patches went through the symlink and modified
the fork directly — re-adding old code like SchedPolicy that was already
removed from the fork.

This was the root cause of the kernel source reversion bug that caused
intermittent build failures (V157, V159): old patches re-applying stale
code to the synced fork through symlinks.

Fix:
- Remove apply_patch_dir calls for kernel, base, relibc, installer
  (all use path= local fork model — changes are committed to the fork)
- Keep apply_patch_dir for bootloader (still uses git= + patches)
- Remove stash_nested_repo_if_dirty for relibc (no patches to stash)
- Update verify-overlay-integrity.sh expected patch symlinks
- Update apply-patches.sh to not create kernel/base patch symlinks
- Fix 005-qtbase signature marker (wrong path: libs → wip/qt)
- Remove 78 old patch symlinks from recipes/core/kernel/ (cleanup)
This commit is contained in:
2026-06-19 01:05:08 +03:00
parent 3333dc1867
commit 7606343765
3 changed files with 4 additions and 15 deletions
+3 -6
View File
@@ -109,8 +109,7 @@ for patch_file in "$PATCHES_DIR"/build-system/[0-9]*.patch; do
grep -q 'Red Bear OS' README.md 2>/dev/null && already_applied=1
;;
005-qtbase-toolchain-elf-header.patch)
# This patch touches recipes/libs/qtbase; check for our marker
grep -q 'REDBEAR' recipes/libs/qtbase/recipe.toml 2>/dev/null && already_applied=1
[ -f recipes/wip/qt/qtbase/recipe.toml ] && already_applied=1
;;
esac
if [ "$already_applied" -eq 1 ]; then
@@ -145,11 +144,9 @@ for patch_file in "$PATCHES_DIR"/build-system/[0-9]*.patch; do
fi
done
# ── 2. Recipe patches (kernel, base) ───────────────────────────────
# ── 2. Recipe patches ──────────────────────────────────────────────
echo "==> Linking recipe patches from local/patches/..."
symlink "../../../local/patches/kernel/redox.patch" "recipes/core/kernel/redox.patch"
symlink "../../../local/patches/base/redox.patch" "recipes/core/base/redox.patch"
symlink "../../../local/patches/base/P2-boot-runtime-fixes.patch" "recipes/core/base/P2-boot-runtime-fixes.patch"
# kernel, relibc, installer, base use path= (local fork model) — no patch symlinks needed.
# ── 3. Custom recipe symlinks ──────────────────────────────────────
echo "==> Linking custom recipes from local/recipes/..."
-5
View File
@@ -168,13 +168,8 @@ if [ "$APPLY_PATCHES" = "1" ] && [ -z "${REDBEAR_RELEASE:-}" ]; then
done
}
apply_patch_dir "$PROJECT_ROOT/local/patches/kernel" "$PROJECT_ROOT/recipes/core/kernel/source" "kernel"
apply_patch_dir "$PROJECT_ROOT/local/patches/base" "$PROJECT_ROOT/recipes/core/base/source" "base"
apply_patch_dir "$PROJECT_ROOT/local/patches/relibc" "$PROJECT_ROOT/recipes/core/relibc/source" "relibc"
apply_patch_dir "$PROJECT_ROOT/local/patches/bootloader" "$PROJECT_ROOT/recipes/core/bootloader/source" "bootloader"
apply_patch_dir "$PROJECT_ROOT/local/patches/installer" "$PROJECT_ROOT/recipes/core/installer/source" "installer"
stash_nested_repo_if_dirty "$PROJECT_ROOT/recipes/core/relibc/source" "relibc"
echo ""
elif [ -n "${REDBEAR_RELEASE:-}" ]; then
echo ">>> Release mode: skipping patch application (patches pre-applied in archived sources)"
+1 -4
View File
@@ -101,11 +101,8 @@ log "==> Checking patch symlinks (recipes/ → local/patches/)..."
PATCH_SYMLINK_COUNT=0
BROKEN_PATCH_SYMLINKS=0
# Components using path= (local fork): kernel, relibc, installer, base — no patch symlinks.
EXPECTED_PATCH_SYMLINKS=(
"recipes/core/kernel/redox.patch"
"recipes/core/base/P2-boot-runtime-fixes.patch"
"recipes/core/relibc/redox.patch"
"recipes/core/installer/redox.patch"
"recipes/core/bootloader/redox.patch"
"recipes/core/bootloader/P2-live-preload-guard.patch"
"recipes/core/bootloader/P3-uefi-live-image-safe-read.patch"