From: Jacob Emmert-Aronson Date: Wed, 27 Jul 2022 04:43:32 +0000 (-0700) Subject: Emit configfile arguments in key=val format X-Git-Tag: v14~99^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1080%2Fhead;p=thirdparty%2Fmkosi.git Emit configfile arguments in key=val format This ensures that argparse treats all values read from configfiles as explicit arguments associated with their respective keys, rather than attempting to parse them as options in their options in their own right. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 0755e1060..432a9e7f1 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -5005,7 +5005,7 @@ class ArgumentParserMkosi(argparse.ArgumentParser): if cli_arg in action.option_strings: if isinstance(action, ListAction): value = value.replace(os.linesep, action.delimiter) - new_arg_strings.extend([cli_arg, value]) + new_arg_strings.append(f"{cli_arg}={value}") except OSError as e: self.error(str(e)) # return the modified argument list diff --git a/tests/test_config_parser.py b/tests/test_config_parser.py index d68e0ed62..5b99ba6f8 100644 --- a/tests/test_config_parser.py +++ b/tests/test_config_parser.py @@ -600,7 +600,7 @@ class MkosiConfigManyParams(MkosiConfigOne): "Host": { "ExtraSearchPaths": "search/here:search/there", "QemuHeadless": True, - "QemuArgs": "-vga none -device virtio-vga-gl", + "QemuArgs": "-device virtio-vga-gl -vga none", "Netdev": True, }, } @@ -734,7 +734,7 @@ class MkosiConfigManyParams(MkosiConfigOne): "Host": { "ExtraSearchPaths": "search/debi", "QemuHeadless": True, - "QemuArgs": "-nic user,model=virtio-net-pci", + "QemuArgs": "-device virtio-vga-gl,xres=1920,yres=1080 -display sdl,gl=on", "Netdev": True, }, }