]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Fix needs_build() logic
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 14 Feb 2022 14:24:14 +0000 (14:24 +0000)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 14 Feb 2022 17:36:06 +0000 (17:36 +0000)
We should only check the -f option if the verb is one of the verbs
that needs a build. With the current check, we start rebuilding an
image even if the verb is "summary".

mkosi/__init__.py

index 188309e5e60a5838f2fb0ce8ae1ec45a282bd1eb..a2c9ae76362206c6e83036672ee2bc873833ea4b 100644 (file)
@@ -7845,7 +7845,7 @@ def expand_specifier(s: str) -> str:
 
 
 def needs_build(args: Union[argparse.Namespace, MkosiArgs]) -> bool:
-    return args.verb == "build" or (not args.output.exists() and args.verb in MKOSI_COMMANDS_NEED_BUILD) or args.force > 0
+    return args.verb == "build" or (args.verb in MKOSI_COMMANDS_NEED_BUILD and (not args.output.exists() or args.force > 0))
 
 
 def run_verb(raw: argparse.Namespace) -> None: