From: Daan De Meyer Date: Tue, 1 Oct 2024 20:31:03 +0000 (+0200) Subject: Evaluate tools_tree earlier X-Git-Tag: v25~245^2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92f7e30f014c49b52847e79d7f8173bb67d038bd;p=thirdparty%2Fmkosi.git Evaluate tools_tree earlier We now call have_cache() in run_clean() so let's make sure we evaluate the tools tree stuff earlier as have_cache() depends on it. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index b1a73fe43..4d53cef4a 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -4300,6 +4300,19 @@ def run_verb(args: Args, images: Sequence[Config], *, resources: Path) -> None: else: tools = None + for i, config in enumerate(images): + images[i] = config = dataclasses.replace( + config, + tools_tree=( + tools.output_dir_or_cwd() / tools.output + if tools and config.tools_tree == Path("default") + else config.tools_tree + ), + ) + + # The images array has been modified so we need to reevaluate last again. + last = images[-1] + if args.verb == Verb.clean: if tools: run_clean(args, tools, resources=resources) @@ -4397,15 +4410,6 @@ def run_verb(args: Args, images: Sequence[Config], *, resources: Path) -> None: fork_and_wait(run_build, args, tools, resources=resources, metadata_dir=Path(metadata_dir)) for i, config in enumerate(images): - images[i] = config = dataclasses.replace( - config, - tools_tree=( - tools.output_dir_or_cwd() / tools.output - if tools and config.tools_tree == Path("default") - else config.tools_tree - ), - ) - with prepend_to_environ_path(config): check_tools(config, args.verb) images[i] = config = run_configure_scripts(config)