]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Only pass arguments to build script when verb is "build"
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 15 Jul 2022 00:37:48 +0000 (02:37 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 27 Jul 2022 17:56:40 +0000 (19:56 +0200)
When we're building the image because it's required for another verb,
any passed arguments are most likely intended for the target verb,
and not for "build", so don't add them in that case.

mkosi/__init__.py

index eb2b799d0809ea5b841ac7b68e197811856c09d6..319e6386cd99ef6e0fd6fdd1de082a52cf91b0dc 100644 (file)
@@ -7382,7 +7382,11 @@ def run_build_script(args: MkosiArgs, root: Path, raw: Optional[BinaryIO]) -> No
             cmdline += ["--keep-unit"]
 
         cmdline += [f"/root/{args.build_script.name}"]
-        cmdline += args.cmdline
+
+        # When we're building the image because it's required for another verb, any passed arguments are most
+        # likely intended for the target verb, and not for "build", so don't add them in that case.
+        if args.verb == Verb.build:
+            cmdline += args.cmdline
 
         # build-script output goes to stdout so we can run language servers from within mkosi build-scripts.
         # See https://github.com/systemd/mkosi/pull/566 for more information.