From c7469b7d1f746675257bf856cdc9325e83a35617 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 24 Jul 2024 17:27:26 +0200 Subject: [PATCH] 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. --- mkosi/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 -- 2.47.2