]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Also fail early if default tools tree is out of date without --force
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 18 Nov 2024 20:06:17 +0000 (21:06 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 18 Nov 2024 20:14:54 +0000 (21:14 +0100)
We fail early if the tools tree does not exist and build or --force
was not specified, let's do the same if the tools tree is incremental
and the cache is out-of-date.

mkosi/__init__.py

index 565c2b85afe8c3ca17a7064664d50b572190c3c2..55ace22d48f5268b063aec646e44ad527cadf76a 100644 (file)
@@ -4647,13 +4647,17 @@ def run_verb(args: Args, images: Sequence[Config], *, resources: Path) -> None:
 
     if (
         tools
-        and not (tools.output_dir_or_cwd() / tools.output).exists()
+        and (
+            not (tools.output_dir_or_cwd() / tools.output).exists()
+            or (tools.incremental and not have_cache(tools))
+        )
         and args.verb != Verb.build
         and not args.force
     ):
         die(
-            f"Default tools tree requested for image '{last.name()}' but it has not been built yet",
-            hint="Make sure to build the image first with 'mkosi build' or use '--force'",
+            f"Default tools tree requested for image '{last.name()}' but it is out-of-date or has not been "
+            "built yet",
+            hint="Make sure to (re)build the image first with 'mkosi build' or use '--force'",
         )
 
     if not last.repart_offline and os.getuid() != 0: