]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Special case tools image in keyring_cache() and metadata_cache()
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 22 Jan 2025 11:15:42 +0000 (12:15 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 22 Jan 2025 11:34:10 +0000 (12:34 +0100)
Similar to cache_tree_paths(), give the metadata and keyring cache
for the default tools tree a custom name to avoid conflicts with the
other image caches.

mkosi/__init__.py

index 6d1ea1f1fd1a21cb7a04fdc1a9f597ee3803fd18..1233b44031cb0fac414e93526336b817f7c39570 100644 (file)
@@ -2472,17 +2472,23 @@ def cache_tree_paths(config: Config) -> tuple[Path, Path, Path]:
 
 
 def keyring_cache(config: Config) -> Path:
-    assert config.cache_dir
-    fragments = [config.distribution, config.release, config.architecture]
+    if config.image == "tools":
+        key = "tools"
+    else:
+        key = f"{'~'.join(str(s) for s in (config.distribution, config.release, config.architecture))}"
 
-    return config.cache_dir / f"{'~'.join(str(s) for s in fragments)}.keyring.cache"
+    assert config.cache_dir
+    return config.cache_dir / f"{key}.keyring.cache"
 
 
 def metadata_cache(config: Config) -> Path:
-    assert config.cache_dir
-    fragments = [config.distribution, config.release, config.architecture]
+    if config.image == "tools":
+        key = "tools"
+    else:
+        key = f"{'~'.join(str(s) for s in (config.distribution, config.release, config.architecture))}"
 
-    return config.cache_dir / f"{'~'.join(str(s) for s in fragments)}.metadata.cache"
+    assert config.cache_dir
+    return config.cache_dir / f"{key}.metadata.cache"
 
 
 def check_inputs(config: Config) -> None: