From: Daan De Meyer Date: Mon, 23 Oct 2023 20:33:32 +0000 (+0200) Subject: Fix missing build overlay X-Git-Tag: v19~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d8c170388d7f3429a74c0e947efeef87d9016322;p=thirdparty%2Fmkosi.git Fix missing build overlay 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. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 9c9be8942..0091a98f7 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -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