]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Use "tools" as the cache key for the default tools tree
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 20 Dec 2024 08:56:48 +0000 (09:56 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 20 Dec 2024 09:42:16 +0000 (10:42 +0100)
Currently we still use "distribution~release~architecture", which
breaks checking if the cache is out of date, since we'll always check
against the cache of the currently configured tools tree distribution,
even if we used a different tools tree distribution to build the tools
tree. Let's fix this by using the same cache key for all default tools
trees.

This shouldn't introduce any performance regression as users are not
expected to change the default tools tree distribution all the time
unlike the target image distribution.

mkosi/__init__.py

index e7201548ff6fde29c0f121b9219ffdb64b7c7dc2..aec950af793368cdc159ece02b4c923bccfda029 100644 (file)
@@ -2394,12 +2394,15 @@ def print_output_size(path: Path) -> None:
 
 
 def cache_tree_paths(config: Config) -> tuple[Path, Path, Path]:
-    fragments = [config.distribution, config.release, config.architecture]
+    if config.image == "tools":
+        key = "tools"
+    else:
+        fragments = [config.distribution, config.release, config.architecture]
 
-    if config.image:
-        fragments += [config.image]
+        if config.image:
+            fragments += [config.image]
 
-    key = "~".join(str(s) for s in fragments)
+        key = "~".join(str(s) for s in fragments)
 
     assert config.cache_dir
     return (