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
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:
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)
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():
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