]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Add ToolsTreeRepositories= and ToolsTreePackageManagerTrees= 2447/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 2 Mar 2024 13:29:54 +0000 (14:29 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 2 Mar 2024 14:46:17 +0000 (15:46 +0100)
Fixes #2430

mkosi/__init__.py
mkosi/config.py
mkosi/resources/mkosi.md
tests/test_json.py

index 27786d6174684f67d958c457f92c1f38d16b260b..acbfc13dbbbb8da7cdcfe96a436489a295abe234 100644 (file)
@@ -3584,6 +3584,8 @@ def finalize_default_tools(args: Args, config: Config, *, resources: Path) -> Co
         "--distribution", str(config.tools_tree_distribution),
         *(["--release", config.tools_tree_release] if config.tools_tree_release else []),
         *(["--mirror", config.tools_tree_mirror] if config.tools_tree_mirror else []),
+        "--repositories", ",".join(config.tools_tree_repositories),
+        "--package-manager-tree", ",".join(str(t) for t in config.tools_tree_package_manager_trees),
         "--repository-key-check", str(config.repository_key_check),
         "--cache-only", str(config.cacheonly),
         *(["--output-dir", str(config.output_dir)] if config.output_dir else []),
index d5fc961b8d9328c38052040d97b8dd09d8cfab30..ec8bebce35d51e412dad7f71c89b8945a6812e04 100644 (file)
@@ -1305,6 +1305,8 @@ class Config:
     tools_tree_distribution: Optional[Distribution]
     tools_tree_release: Optional[str]
     tools_tree_mirror: Optional[str]
+    tools_tree_repositories: list[str]
+    tools_tree_package_manager_trees: list[ConfigTree]
     tools_tree_packages: list[str]
     runtime_trees: list[ConfigTree]
     runtime_size: Optional[int]
@@ -2469,6 +2471,22 @@ SETTINGS = (
         default_factory=lambda ns: ns.mirror if ns.mirror and ns.distribution == ns.tools_tree_distribution else None,
         help="Set the mirror to use for the default tools tree",
     ),
+    ConfigSetting(
+        dest="tools_tree_repositories",
+        long="--tools-tree-repository",
+        metavar="REPOS",
+        section="Host",
+        parse=config_make_list_parser(delimiter=","),
+        help="Repositories to use for the default tools tree",
+    ),
+    ConfigSetting(
+        dest="tools_tree_package_manager_trees",
+        long="--tools-tree-package-manager-tree",
+        metavar="PATH",
+        section="Host",
+        parse=config_make_list_parser(delimiter=",", parse=make_tree_parser()),
+        help="Package manager trees for the default tools tree",
+    ),
     ConfigSetting(
         dest="tools_tree_packages",
         long="--tools-tree-package",
@@ -3595,6 +3613,8 @@ def summary(config: Config) -> str:
             Tools Tree Distribution: {none_to_none(config.tools_tree_distribution)}
                  Tools Tree Release: {none_to_none(config.tools_tree_release)}
                   Tools Tree Mirror: {none_to_default(config.tools_tree_mirror)}
+            Tools Tree Repositories: {line_join_list(config.tools_tree_repositories)}
+   Tools Tree Package Manager Trees: {line_join_list(config.tools_tree_package_manager_trees)}
                 Tools Tree Packages: {line_join_list(config.tools_tree_packages)}
                       Runtime Trees: {line_join_list(config.runtime_trees)}
                        Runtime Size: {format_bytes_or_none(config.runtime_size)}
index 475534e9a8d6ec14b6476e7023709d9b38dff39f..dccc1526d7c21646475a68a2bdb2363416996266 100644 (file)
@@ -1654,6 +1654,14 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`,
 : Set the mirror to use for the default tools tree. By default, the
   default mirror for the tools tree distribution is used.
 
+`ToolsTreeRepositories=`, `--tools-tree-repository`
+
+: Same as `Repositories=` but for the default tools tree.
+
+`ToolsTreePackageManagerTrees=`, `--tools-tree-package-manager-tree=`
+
+: Same as `PackageManagerTrees=` but for the default tools tree.
+
 `ToolsTreePackages=`, `--tools-tree-packages=`
 
 : Extra packages to install into the default tools tree. Takes a comma
index 2d0f2b880268a1cef03ec8e041a2116bd2acb144..83f6bcade9462df7323db493e3577d68b7a08b09 100644 (file)
@@ -285,8 +285,17 @@ def test_config() -> None:
             "ToolsTree": null,
             "ToolsTreeDistribution": null,
             "ToolsTreeMirror": null,
+            "ToolsTreePackageManagerTrees": [
+                {
+                    "source": "/a/b/c",
+                    "target": "/"
+                }
+            ],
             "ToolsTreePackages": [],
             "ToolsTreeRelease": null,
+            "ToolsTreeRepositories": [
+                "abc"
+            ],
             "UseSubvolumes": "auto",
             "VerityCertificate": "/path/to/cert",
             "VerityKey": null,
@@ -416,8 +425,10 @@ def test_config() -> None:
         tools_tree = None,
         tools_tree_distribution = None,
         tools_tree_mirror = None,
+        tools_tree_package_manager_trees = [ConfigTree(Path("/a/b/c"), Path("/"))],
         tools_tree_packages = [],
         tools_tree_release = None,
+        tools_tree_repositories = ["abc"],
         use_subvolumes = ConfigFeature.auto,
         verity_certificate = Path("/path/to/cert"),
         verity_key = None,