]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Add ToolsTreeMirror= setting
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 18 Oct 2023 21:28:11 +0000 (23:28 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 18 Oct 2023 22:00:01 +0000 (00:00 +0200)
Complete the trio of ToolsTreeDistribution=, ToolsTreeRelease= with
ToolsTreeMirror=.

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

index 5793b0cfadba8fc8b31b728eb5751221cf8c0311..6ff7a01b7dcb1aead432bc8e5d7f32e7a5a3f40b 100644 (file)
@@ -2382,12 +2382,13 @@ def finalize_tools(args: MkosiArgs, presets: Sequence[MkosiConfig]) -> Sequence[
                 hint="use ToolsTreeDistribution= to set one explicitly")
 
         release = p.tools_tree_release or distribution.default_release()
+        mirror = p.tools_tree_mirror or (p.mirror if p.mirror and p.distribution == distribution else None)
 
         cmdline = [
             "--directory", "",
             "--distribution", str(distribution),
             *(["--release", release] if release else []),
-            *(["--mirror", p.mirror] if p.mirror and p.distribution == distribution else []),
+            *(["--mirror", mirror] if mirror else []),
             "--repository-key-check", str(p.repository_key_check),
             "--cache-only", str(p.cache_only),
             *(["--output-dir", str(p.output_dir)] if p.output_dir else []),
index 664dee8cda02ba35eb7870b26138ef8e0ab63671..4b06af7353b8de7c0c3397e1f261be721c5ddbda 100644 (file)
@@ -797,6 +797,7 @@ class MkosiConfig:
     tools_tree: Optional[Path]
     tools_tree_distribution: Optional[Distribution]
     tools_tree_release: Optional[str]
+    tools_tree_mirror: Optional[str]
     tools_tree_packages: list[str]
     runtime_trees: list[tuple[Path, Optional[Path]]]
     runtime_size: Optional[int]
@@ -1843,6 +1844,12 @@ SETTINGS = (
         parse=config_parse_string,
         help="Set the release to use for the default tools tree",
     ),
+    MkosiConfigSetting(
+        dest="tools_tree_mirror",
+        metavar="MIRROR",
+        section="Host",
+        help="Set the mirror to use for the default tools tree",
+    ),
     MkosiConfigSetting(
         dest="tools_tree_packages",
         long="--tools-tree-package",
@@ -2730,6 +2737,7 @@ Clean Package Manager Metadata: {yes_no_auto(config.clean_package_metadata)}
                     Tools Tree: {config.tools_tree}
        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 Packages: {line_join_list(config.tools_tree_packages)}
                  Runtime Trees: {line_join_source_target_list(config.runtime_trees)}
                   Runtime Size: {format_bytes_or_none(config.runtime_size)}
index f68f8e77d3a534b180754f78a32e84fce4e20852..6dac4b24961a7fe2ab14ca081490d42300e1c666 100644 (file)
@@ -1262,6 +1262,11 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`,
   default, the hardcoded default release in mkosi for the distribution
   is used.
 
+`ToolsTreeMirror=`, `--tools-tree-mirror=`
+
+: Set the mirror to use for the default tools tree. By default, the
+  default mirror for the tools tree distribution is used.
+
 `ToolsTreePackages=`, `--tools-tree-packages=`
 
 : Extra packages to install into the default tools tree. Takes a comma
index ccfa26b009bf87294da8412f939b65566209dff8..b8e87cfefca86979a040073a97e62a61467f21e1 100644 (file)
@@ -235,6 +235,7 @@ def test_config() -> None:
             "Timezone": null,
             "ToolsTree": null,
             "ToolsTreeDistribution": null,
+            "ToolsTreeMirror": null,
             "ToolsTreePackages": [],
             "ToolsTreeRelease": null,
             "UseSubvolumes": "auto",
@@ -343,6 +344,7 @@ def test_config() -> None:
         timezone = None,
         tools_tree = None,
         tools_tree_distribution = None,
+        tools_tree_mirror = None,
         tools_tree_packages = [],
         tools_tree_release = None,
         use_subvolumes = ConfigFeature.auto,