From: Daan De Meyer Date: Wed, 18 Oct 2023 21:28:11 +0000 (+0200) Subject: Add ToolsTreeMirror= setting X-Git-Tag: v19~66^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4acffd27e9bf6f8d36694b7131c30aeffd262643;p=thirdparty%2Fmkosi.git Add ToolsTreeMirror= setting Complete the trio of ToolsTreeDistribution=, ToolsTreeRelease= with ToolsTreeMirror=. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 5793b0cfa..6ff7a01b7 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -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 []), diff --git a/mkosi/config.py b/mkosi/config.py index 664dee8cd..4b06af735 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -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)} diff --git a/mkosi/resources/mkosi.md b/mkosi/resources/mkosi.md index f68f8e77d..6dac4b249 100644 --- a/mkosi/resources/mkosi.md +++ b/mkosi/resources/mkosi.md @@ -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 diff --git a/tests/test_json.py b/tests/test_json.py index ccfa26b00..b8e87cfef 100644 --- a/tests/test_json.py +++ b/tests/test_json.py @@ -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,