]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Fix missing build overlay
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 23 Oct 2023 20:33:32 +0000 (22:33 +0200)
committerJörg Behrmann <behrmann@physik.fu-berlin.de>
Tue, 24 Oct 2023 07:51:28 +0000 (09:51 +0200)
We also need a build overlay if there are prepare scripts but no
build packages, so let's replace need_build_packages() with a new
function need_build_overlay() that also checks for that.

mkosi/__init__.py

index 9c9be89420f19fedc1251b459d31b37c96ec4e18..0091a98f741487e80953c793fe37639f3a5cc4f2 100644 (file)
@@ -161,7 +161,7 @@ def install_distribution(state: MkosiState) -> None:
 
 
 def install_build_packages(state: MkosiState) -> None:
-    if not need_build_packages(state.config):
+    if not state.config.build_scripts or not state.config.build_packages:
         return
 
     # TODO: move to parenthesised context managers once on 3.10
@@ -1836,8 +1836,8 @@ def run_selinux_relabel(state: MkosiState) -> None:
         run(["setfiles", "-mFr", state.root, "-c", binpolicy, fc, state.root])
 
 
-def need_build_packages(config: MkosiConfig) -> bool:
-    return bool(config.build_scripts and config.build_packages)
+def need_build_overlay(config: MkosiConfig) -> bool:
+    return bool(config.build_scripts and (config.build_packages or config.prepare_scripts))
 
 
 def save_cache(state: MkosiState) -> None:
@@ -1856,7 +1856,7 @@ def save_cache(state: MkosiState) -> None:
         else:
             move_tree(state.config, state.root, final)
 
-        if need_build_packages(state.config) and (state.workspace / "build-overlay").exists():
+        if need_build_overlay(state.config) and (state.workspace / "build-overlay").exists():
             rmtree(build)
             move_tree(state.config, state.workspace / "build-overlay", build)
 
@@ -1868,7 +1868,7 @@ def reuse_cache(state: MkosiState) -> bool:
         return False
 
     final, build, manifest = cache_tree_paths(state.config)
-    if not final.exists() or (need_build_packages(state.config) and not build.exists()):
+    if not final.exists() or (need_build_overlay(state.config) and not build.exists()):
         return False
 
     if manifest.exists():
@@ -1887,7 +1887,7 @@ def reuse_cache(state: MkosiState) -> bool:
 
     with complete_step("Copying cached trees"):
         copy_tree(state.config, final, state.root)
-        if need_build_packages(state.config):
+        if need_build_overlay(state.config):
             (state.workspace / "build-overlay").symlink_to(build)
 
     return True