From: Daan De Meyer Date: Sat, 16 Nov 2024 14:47:43 +0000 (+0100) Subject: Add ToolsTreePackageDirectories= X-Git-Tag: v25~167^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f447553d170db47d74e3dc02f74bb40c2bf207c3;p=thirdparty%2Fmkosi.git Add ToolsTreePackageDirectories= Sometimes, we want to add locally built rpm packages to the default tools tree. For example, systemd-repart depends on mkfs binaries that might not be available on the host system, so the only way to run it is from within the tools tree, which means we need a way to install systemd-repart built from source within the tools tree. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 9c6d92a41..928a973db 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -4161,6 +4161,7 @@ def finalize_default_tools(args: Args, config: Config, *, resources: Path) -> Co *(["--package-cache-dir", str(config.package_cache_dir)] if config.package_cache_dir else []), "--incremental", str(config.incremental), *([f"--package={package}" for package in config.tools_tree_packages]), + *([f"--package-directory={directory}" for directory in config.tools_tree_package_directories]), "--output=tools", *(["--source-date-epoch", str(config.source_date_epoch)] if config.source_date_epoch is not None else []), # noqa: E501 *([f"--environment={k}='{v}'" for k, v in config.environment.items()]), diff --git a/mkosi/config.py b/mkosi/config.py index 960705fc2..16d0e7288 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -1818,6 +1818,7 @@ class Config: tools_tree_repositories: list[str] tools_tree_sandbox_trees: list[ConfigTree] tools_tree_packages: list[str] + tools_tree_package_directories: list[Path] tools_tree_certificates: bool incremental: Incremental cacheonly: Cacheonly @@ -3166,6 +3167,14 @@ SETTINGS = ( parse=config_make_list_parser(delimiter=","), help="Add additional packages to the default tools tree", ), + ConfigSetting( + dest="tools_tree_package_directories", + long="--tools-tree-package-directory", + metavar="PATH", + section="Build", + parse=config_make_list_parser(delimiter=",", parse=make_path_parser()), + help="Specify a directory containing extra tools tree packages", + ), ConfigSetting( dest="tools_tree_certificates", metavar="BOOL", @@ -4813,6 +4822,7 @@ def summary(config: Config) -> str: Tools Tree Repositories: {line_join_list(config.tools_tree_repositories)} Tools Tree Sandbox Trees: {line_join_list(config.tools_tree_sandbox_trees)} Tools Tree Packages: {line_join_list(config.tools_tree_packages)} + Tools Tree Package Directories: {line_join_list(config.tools_tree_package_directories)} Tools Tree Certificates: {yes_no(config.tools_tree_certificates)} Incremental: {config.incremental} diff --git a/mkosi/resources/man/mkosi.1.md b/mkosi/resources/man/mkosi.1.md index 6de5aecc8..70506757d 100644 --- a/mkosi/resources/man/mkosi.1.md +++ b/mkosi/resources/man/mkosi.1.md @@ -1331,6 +1331,9 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`, separated list of package specifications. This option may be used multiple times in which case the specified package lists are combined. +`ToolsTreePackageDirectories=`, `--tools-tree-package-directory=` +: Same as `PackageDirectories=`, but for the default tools tree. + `ToolsTreeCertificates=`, `--tools-tree-certificates=` : Specify whether to use certificates and keys from the tools tree. Enabled by default. If enabled, `/etc/pki`, `/etc/ssl`, diff --git a/tests/test_json.py b/tests/test_json.py index 5a43ed234..4097951d8 100644 --- a/tests/test_json.py +++ b/tests/test_json.py @@ -363,6 +363,9 @@ def test_config() -> None: "ToolsTreeCertificates": true, "ToolsTreeDistribution": "fedora", "ToolsTreeMirror": null, + "ToolsTreePackageDirectories": [ + "/abc" + ], "ToolsTreePackages": [], "ToolsTreeRelease": null, "ToolsTreeRepositories": [ @@ -570,6 +573,7 @@ def test_config() -> None: tools_tree_mirror=None, tools_tree_sandbox_trees=[ConfigTree(Path("/a/b/c"), Path("/"))], tools_tree_packages=[], + tools_tree_package_directories=[Path("/abc")], tools_tree_release=None, tools_tree_repositories=["abc"], unified_kernel_image_format="myuki",