`-kernel` or `QemuKernel=`
- We don't create subdirectories beneath the configured cache directory
anymore.
-- Source directories are now made ephemeral when running scripts. This
- means any changes made to source directories while running scripts
- will be undone after the scripts have finished executing.
+- Added `BuildSourcesEphemeral=` to make source directories ephemeral
+ when running scripts. This means any changes made to source
+ directories while running scripts will be undone after the scripts
+ have finished executing.
- Workspace directories are now created outside of any source
directories. mkosi will either use `XDG_CACHE_HOME`, `$HOME/.cache` or
`/var/tmp` depending on the situation.
def finalize_mounts(config: MkosiConfig) -> Iterator[list[PathString]]:
with contextlib.ExitStack() as stack:
sources = [
- (stack.enter_context(mount_overlay([source])), target)
+ (stack.enter_context(mount_overlay([source])) if config.build_sources_ephemeral else source, target)
for source, target
in [(Path.cwd(), Path.cwd())] + [t.with_prefix(Path.cwd()) for t in config.build_sources]
]
postinst_scripts: list[Path]
finalize_scripts: list[Path]
build_sources: list[ConfigTree]
+ build_sources_ephemeral: bool
environment: dict[str, str]
with_tests: bool
with_network: bool
match=config_match_build_sources,
help="Path for sources to build",
),
+ MkosiConfigSetting(
+ dest="build_sources_ephemeral",
+ metavar="BOOL",
+ section="Content",
+ parse=config_parse_boolean,
+ help="Make build sources ephemeral when running scripts",
+ ),
MkosiConfigSetting(
dest="environment",
short="-E",
Postinstall Scripts: {line_join_list(config.postinst_scripts)}
Finalize Scripts: {line_join_list(config.finalize_scripts)}
Build Sources: {line_join_tree_list(config.build_sources)}
+ Build Sources Ephemeral: {yes_no(config.build_sources_ephemeral)}
Script Environment: {line_join_list(env)}
Run Tests in Build Scripts: {yes_no(config.with_tests)}
Scripts With Network: {yes_no(config.with_network)}
with all build sources mounted in it is mounted to `/work/src` inside
the image's root directory.
+`BuildSourcesEphemeral=`, `--build-sources-ephemeral=`
+
+: Takes a boolean. Disabled by default. Configures whether changes to
+ source directories (The working directory and configured using
+ `BuildSources=`) are persisted. If enabled, all source directories
+ will be reset to their original state after scripts finish executing.
+
`Environment=`, `--environment=`
: Adds variables to the environment that package managers and the
"target": "/frob"
}
],
+ "BuildSourcesEphemeral": true,
"CacheDirectory": "/is/this/the/cachedir",
"CacheOnly": true,
"Checksum": false,
build_packages = ["pkg1", "pkg2"],
build_scripts = [Path("/path/to/buildscript")],
build_sources = [ConfigTree(Path("/qux"), Path("/frob"))],
+ build_sources_ephemeral = True,
cache_dir = Path("/is/this/the/cachedir"),
cache_only = True,
checksum = False,