b0f440c47e
Replace the inline `for p in ${REDBEAR_PATCHES_DIR}/[0-9]*.patch; do
git apply ...; done` loop in each of the 4 Rule 2 migration recipes
with a single call to cookbook_apply_patches (added in the previous
commit to src/cook/script.rs).
Before (9 lines per recipe):
REDBEAR_PATCHES_DIR="${REDBEAR_PATCHES_DIR:-...}/local/patches/<component>"
cd "${COOKBOOK_SOURCE}"
for p in "${REDBEAR_PATCHES_DIR}"/[0-9]*.patch; do
[ -f "$p" ] || continue
echo "Applying Red Bear <component> patch: $p"
git apply "$p" || { echo "Failed to apply $p"; exit 1; }
done
cd "${COOKBOOK_BUILD}"
After (1 line per recipe):
REDBEAR_PATCHES_DIR="${REDBEAR_PATCHES_DIR:-...}/local/patches/<component>"
cookbook_apply_patches "${REDBEAR_PATCHES_DIR}"
Behavior change: the helper is now idempotent (skips already-applied
patches via `git apply --reverse --check`), so a partial re-cook
after a previous successful build no longer fails with 'patch already
applied'. This was the primary motivation for the refactor.
Per-recipe path depth notes (for the record):
* mesa — recipes/libs/mesa/ (depth 2) — 2 dots
* libdrm — local/recipes/libs/libdrm/ (depth 3) — 4 dots
* pipewire — local/recipes/libs/pipewire/ (depth 3) — 4 dots
* wireplumber — local/recipes/libs/wireplumber/ (depth 3) — 4 dots
All four recipes parse as valid TOML and use the cookbook's
[source].script (libdrm) or [build].script (mesa/pipewire/wireplumber)
hook, both of which load cookbook shell functions including the new
cookbook_apply_patches helper.