From: Daan De Meyer Date: Mon, 8 Jan 2024 16:38:11 +0000 (+0100) Subject: Reset default values when assigning the empty string to list setting X-Git-Tag: v20~6^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ddae0ccbff4218147f7b753ec3e063309163570;p=thirdparty%2Fmkosi.git Reset default values when assigning the empty string to list setting For list based settings, it makes more sense for the empty string to get rid of any default value as well. --- diff --git a/NEWS.md b/NEWS.md index d34e565d9..df02819f6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,8 @@ ## v20 +- Assigning the empty string to a setting that takes a list of values + now overrides any configured default value as well. - The github action does not build and install systemd from source anymore. Instead, `ToolsTree=default` can be used to make sure a recent version of systemd is used to do the image build. diff --git a/mkosi/config.py b/mkosi/config.py index 7834a6073..442c96a66 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -636,7 +636,7 @@ def config_make_list_parser(delimiter: str, # Empty strings reset the list. if reset and len(values) == 1 and values[0] == "": - return None + return [] return new + [parse(v) for v in values if v] diff --git a/mkosi/resources/mkosi.md b/mkosi/resources/mkosi.md index 2fd346f59..76bc2ee14 100644 --- a/mkosi/resources/mkosi.md +++ b/mkosi/resources/mkosi.md @@ -303,7 +303,8 @@ the earlier assignment would be used instead of later assignments. Settings that take a list of values are merged by appending the new values to the previously configured values. Assigning the empty string -to such a setting removes all previously assigned values. +to such a setting removes all previously assigned values, and overrides +any configured default values as well. If a setting's name in the configuration file is prefixed with `@`, it configures the default value used for that setting if no explicit