if not (s := SETTINGS_LOOKUP_BY_NAME.get(name)):
die(f"Unknown setting {name}")
+ if (
+ s.universal and
+ not isinstance(s.parse(None, None), (list, set, dict)) and
+ (image := getattr(ParseContext.config, "image", None)) is not None
+ ):
+ die(f"Setting {name} cannot be configured in subimage {image}")
if name in ParseContext.immutable:
die(f"Setting {name} cannot be modified anymore at this point")
(d / "mkosi.images" / f"{n}.conf").write_text(
f"""\
[Distribution]
- Release=bla
+ Repositories=append
[Content]
Packages={n}
)
with chdir(d):
- _, [one, two, config] = parse_config(["--package", "qed", "--build-package", "def"])
+ _, [one, two, config] = parse_config(["--package", "qed", "--build-package", "def", "--repositories", "cli"])
# Universal settings should always come from the main image.
assert one.distribution == config.distribution
assert config.packages == ["qed"]
assert config.build_packages == ["def"]
+ # list based settings should be appended to in subimages
+ assert one.repositories == ["append", "epel", "epel-next", "cli"]
+ assert two.repositories == ["append", "epel", "epel-next", "cli"]
+
def test_parse_includes_once(tmp_path: Path) -> None:
d = tmp_path