From: Daan De Meyer Date: Wed, 24 Jul 2024 15:27:26 +0000 (+0200) Subject: Don't clean tools tree unless at least -f is specified X-Git-Tag: v24~8^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2908%2Fhead;p=thirdparty%2Fmkosi.git Don't clean tools tree unless at least -f is specified Otherwise if we run mkosi qemu and the cache is out of date we remove the tools tree which we shouldn't do. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index cf201065f..a6639262f 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -4854,9 +4854,13 @@ def run_verb(args: Args, images: Sequence[Config], *, resources: Path) -> None: if last.tools_tree and last.tools_tree == Path("default"): tools = finalize_default_tools(args, last, resources=resources) - # If we're doing an incremental tools tree and the cache is not out of date, don't clean up the tools tree + # If we're doing an incremental build and the cache is not out of date, don't clean up the tools tree # so that we can reuse the previous one. - if not tools.incremental or not have_cache(tools) or needs_clean(args, tools, force=2): + if ( + not tools.incremental or + ((args.verb == Verb.build or args.force > 0) and not have_cache(tools)) or + needs_clean(args, tools, force=2) + ): fork_and_wait(run_clean, args, tools, resources=resources) else: tools = None