From: Daan De Meyer Date: Fri, 23 Aug 2024 18:34:23 +0000 (+0200) Subject: Make more trees required X-Git-Tag: v25~342^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2973%2Fhead;p=thirdparty%2Fmkosi.git Make more trees required - Tools tree is a universal setting and has to be available at the start - Sandbox trees are a universal setting and have to be available at the start - Skeleton trees should be available at the start to make sure caching works properly --- diff --git a/mkosi/config.py b/mkosi/config.py index 03b5407a5..60f3ba452 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -539,12 +539,12 @@ def config_parse_key(value: Optional[str], old: Optional[str]) -> Optional[Path] return parse_path(value, secret=True) if Path(value).exists() else Path(value) -def make_tree_parser(absolute: bool = True) -> Callable[[str], ConfigTree]: +def make_tree_parser(absolute: bool = True, required: bool = False) -> Callable[[str], ConfigTree]: def parse_tree(value: str) -> ConfigTree: src, sep, tgt = value.partition(':') return ConfigTree( - source=parse_path(src, required=False), + source=parse_path(src, required=required), target=parse_path( tgt, required=False, @@ -2017,7 +2017,7 @@ SETTINGS = ( compat_longs=("--package-manager-tree",), metavar="PATH", section="Distribution", - parse=config_make_list_parser(delimiter=",", parse=make_tree_parser()), + parse=config_make_list_parser(delimiter=",", parse=make_tree_parser(required=True)), help="Use a sandbox tree to configure the various tools that mkosi executes", paths=("mkosi.sandbox", "mkosi.sandbox.tar", "mkosi.pkgmngr", "mkosi.pkgmngr.tar",), scope=SettingScope.universal, @@ -2285,7 +2285,7 @@ SETTINGS = ( long="--skeleton-tree", metavar="PATH", section="Content", - parse=config_make_list_parser(delimiter=",", parse=make_tree_parser()), + parse=config_make_list_parser(delimiter=",", parse=make_tree_parser(required=True)), paths=("mkosi.skeleton", "mkosi.skeleton.tar"), help="Use a skeleton tree to bootstrap the image before installing anything", ), @@ -2394,7 +2394,7 @@ SETTINGS = ( dest="build_sources", metavar="PATH", section="Content", - parse=config_make_list_parser(delimiter=",", parse=make_tree_parser(absolute=False)), + parse=config_make_list_parser(delimiter=",", parse=make_tree_parser(absolute=False, required=True)), match=config_match_build_sources, default_factory=lambda ns: [ConfigTree(ns.directory, None)] if ns.directory else [], help="Path for sources to build", @@ -2890,7 +2890,7 @@ SETTINGS = ( dest="tools_tree", metavar="PATH", section="Host", - parse=config_make_path_parser(required=False, constants=("default",)), + parse=config_make_path_parser(constants=("default",)), paths=("mkosi.tools",), help="Look up programs to execute inside the given tree", nargs="?", @@ -2939,7 +2939,7 @@ SETTINGS = ( compat_longs=("--tools-tree-package-manager-tree",), metavar="PATH", section="Host", - parse=config_make_list_parser(delimiter=",", parse=make_tree_parser()), + parse=config_make_list_parser(delimiter=",", parse=make_tree_parser(required=True)), help="Sandbox trees for the default tools tree", ), ConfigSetting( diff --git a/mkosi/resources/mkosi.md b/mkosi/resources/mkosi.md index 43f51349e..7692b2a83 100644 --- a/mkosi/resources/mkosi.md +++ b/mkosi/resources/mkosi.md @@ -2518,10 +2518,7 @@ for the following options, mkosi will only check whether the inputs exist just before building the image: - `BaseTrees=` -- `SandboxTrees=` -- `SkeletonTrees=` - `ExtraTrees=` -- `ToolsTree=` - `Initrds=` To refer to outputs of a image's dependencies, simply configure any of