From a5f97b663214cbbd3fc56f5d5f117324a993ec6a Mon Sep 17 00:00:00 2001 From: Vasilito Date: Mon, 4 May 2026 20:29:49 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20cookbook=20cache=20invalidation=20?= =?UTF-8?q?=E2=80=94=20use=20max(recipe,=20source)=20timestamps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: src/cook/cook_build.rs:268 only bumps source_modified when recipe.toml is STRICTLY newer than source. In normal workflow: 1. Recipe edited at T1 (adds patch to patches array) 2. Source re-fetched at T2 > T1 (during make r.) 3. Build caches stage at T3 4. Next build: recipe(T1) > source(T2) = FALSE → edit ignored Fix: source_modified = source_modified.max(recipe_modified); always considers recipe timestamp regardless of relative ordering. Root cause of kernel rebrand not taking effect was ALSO a missing .git/HEAD in the source tree (cookbook skips patches for release archives). Re-fetch with 'repo --allow-protected fetch kernel' restored the git repo and enabled patch application. Verified: 'RedBear OS starting...' appears in QEMU boot log. --- src/cook/cook_build.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/cook/cook_build.rs b/src/cook/cook_build.rs index 9889b8a7..059f6e1b 100644 --- a/src/cook/cook_build.rs +++ b/src/cook/cook_build.rs @@ -265,9 +265,7 @@ pub fn build( let mut source_modified = modified_dir_ignore_git(source_dir).unwrap_or(SystemTime::UNIX_EPOCH); if let Ok(recipe_modified) = modified(&recipe_dir.join("recipe.toml")) { - if recipe_modified > source_modified { - source_modified = recipe_modified - } + source_modified = source_modified.max(recipe_modified); } let deps_modified = modified_all_btree(