From 7606343765f34d16748ea959c813b2042863bf1f Mon Sep 17 00:00:00 2001 From: vasilito Date: Fri, 19 Jun 2026 01:05:08 +0300 Subject: [PATCH] =?UTF-8?q?build:=20fix=20source=20reversion=20root=20caus?= =?UTF-8?q?e=20=E2=80=94=20stop=20applying=20patches=20to=20local=20fork?= =?UTF-8?q?=20paths?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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//source is a SYMLINK to local/sources/. 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) --- local/scripts/apply-patches.sh | 9 +++------ local/scripts/build-redbear.sh | 5 ----- local/scripts/verify-overlay-integrity.sh | 5 +---- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/local/scripts/apply-patches.sh b/local/scripts/apply-patches.sh index f8361f6d50..c2067bd1aa 100755 --- a/local/scripts/apply-patches.sh +++ b/local/scripts/apply-patches.sh @@ -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/..." diff --git a/local/scripts/build-redbear.sh b/local/scripts/build-redbear.sh index 454536e9f9..461ffe157f 100755 --- a/local/scripts/build-redbear.sh +++ b/local/scripts/build-redbear.sh @@ -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)" diff --git a/local/scripts/verify-overlay-integrity.sh b/local/scripts/verify-overlay-integrity.sh index 3a7de2a58d..a48b977f8e 100755 --- a/local/scripts/verify-overlay-integrity.sh +++ b/local/scripts/verify-overlay-integrity.sh @@ -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"