]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Add ToolsTreePackageDirectories=
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 16 Nov 2024 14:47:43 +0000 (15:47 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 17 Nov 2024 16:29:49 +0000 (17:29 +0100)
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.

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

index 9c6d92a417d065b86f624b9113133d4dfa7aa6ce..928a973db5a297ef16f1e64495157943c39c2f1e 100644 (file)
@@ -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()]),
index 960705fc2936e1eae710b818fce7a803513050f5..16d0e72887ea0b658ff0e8e381ee49793631a387 100644 (file)
@@ -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}
index 6de5aecc8078dcc08618e5c88fdc9b529dd7bebb..70506757dabba8e338d89cef93df7edae0fee121 100644 (file)
@@ -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`,
index 5a43ed2342932d1da67fa5e87ef0cf873e1aeccc..4097951d8ff353ccf619729c3cd6637effac7216 100644 (file)
@@ -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",