From: Daan De Meyer Date: Sun, 4 Sep 2022 13:13:53 +0000 (+0200) Subject: Derive cleanup value from state X-Git-Tag: v14~43^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3cfbc2505e77e9607a3e06888b1983cee43dfdc;p=thirdparty%2Fmkosi.git Derive cleanup value from state --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 88d713e13..276e8479e 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -7062,7 +7062,6 @@ def build_image( state: MkosiState, *, manifest: Optional[Manifest] = None, - cleanup: bool = False, ) -> BuildOutput: # If there's no build script set, there's no point in executing # the build script iteration. Let's quit early. @@ -7136,6 +7135,8 @@ def build_image( secure_boot_sign(state, state.root / 'usr/lib/systemd/boot/efi', cached, mount=contextlib.nullcontext) + cleanup = not state.for_cache and not state.do_run_build_script + if cleanup: remove_packages(state) @@ -7407,7 +7408,7 @@ def build_stuff(config: MkosiConfig) -> Manifest: if not config.skip_final_phase: with complete_step("Running second (final) stage…"): state = dataclasses.replace(state, do_run_build_script=False, for_cache=False) - image = build_image(state, manifest=manifest, cleanup=True) + image = build_image(state, manifest=manifest) else: MkosiPrinter.print_step("Skipping (second) final image build phase.")