# mkosi Changelog
+## v25
+
+- Universal settings that take a collection of values cannot be
+ appended to anymore in subimages. Usage of package manager trees in
+ subimages will have to be moved to the top level image. Similarly,
+ repositories will have to be enabled in the top level image.
+
## v24
- The default kernel command line of `console=ttyS0` (or equivalent for
delattr(self.config, s.dest)
for s in SETTINGS:
+ if (
+ s.scope == SettingScope.universal and
+ (image := getattr(self.config, "image", None)) is not None
+ ):
+ continue
+
for f in s.paths:
extra = parse_path(
f,
die(f"Unknown setting {name}")
if (
s.scope == SettingScope.universal and
- not isinstance(s.parse(None, None), (list, set, dict)) and
(image := getattr(self.config, "image", None)) is not None
):
die(f"Setting {name} cannot be configured in subimage {image}")
# were specified on the CLI by copying them to the CLI namespace. Any settings
# that are not marked as "universal" are deleted from the CLI namespace.
for s in SETTINGS:
- if (
- s.scope == SettingScope.universal and (
- # For list-based settings, don't pass down empty lists unless it came
- # explicitly from the config file or the CLI. This makes sure that default
- # values from subimages are still used if no value is explicitly configured
- # in the main image or on the CLI.
- not isinstance(getattr(config, s.dest), (list, dict, set)) or
- getattr(config, s.dest) or
- hasattr(context.cli, s.dest) or
- hasattr(context.config, s.dest)
- )
- ):
+ if s.scope == SettingScope.universal:
setattr(context.cli, s.dest, copy.deepcopy(getattr(config, s.dest)))
elif hasattr(context.cli, s.dest):
delattr(context.cli, s.dest)
"--remove-files=/usr/lib/firmware/*-ucode",
"--kernel-modules-exclude=.*",
"--kernel-modules-include=host",
+ "--build-sources", "",
"--include=mkosi-initrd",
]
ManifestFormat=
[Content]
-BuildSources=
Bootable=no
MakeInitrd=yes
CleanPackageMetadata=yes
followed by the image specific configuration. Several "universal"
settings apply to the main image and all its subimages and cannot be
configured separately in subimages. The following settings are universal
-and cannot be configured in subimages (except for settings which take a
-collection of values which can be extended in subimages but not
-overridden):
+and cannot be configured in subimages:
- `Profile=`
- `Distribution=`
(d / "mkosi.images/one.conf").write_text(
"""\
- [Distribution]
- Repositories=append
-
[Content]
Packages=one
"""
(d / "mkosi.images/two/mkosi.skeleton").mkdir()
(d / "mkosi.images/two/mkosi.conf").write_text(
"""
- [Distribution]
- Repositories=append
-
[Content]
Packages=two
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"]
-
# Inherited settings should be passed down to subimages but overridable by subimages.
assert one.image_version == "1.2.3"
assert two.image_version == "4.5.6"
- # Default values from subimages should be picked up.
+ # Default values from subimages for univeral settings should not be picked up.
assert len(one.package_manager_trees) == 0
- assert len(two.package_manager_trees) == 1 and two.package_manager_trees[0].source.name == "mkosi.skeleton"
+ assert len(two.package_manager_trees) == 0
with chdir(d):
_, [one, two, config] = parse_config(["--image-version", "7.8.9"])