]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Don't call have_cache() in reuse_cache() 3446/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 28 Jan 2025 19:47:30 +0000 (20:47 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 29 Jan 2025 09:56:25 +0000 (10:56 +0100)
By the time reuse_cache() is called, we've already cleaned up old
cached images if needed, so just check if they still exist and reuse
them if they do.

mkosi/__init__.py

index bb11dc9919726625f4d76c96ba0bbb027d3599ec..863a72722f877371019ae84f77b489c8b7dc1cc1 100644 (file)
@@ -3114,10 +3114,12 @@ def have_cache(config: Config) -> bool:
 
 
 def reuse_cache(context: Context) -> bool:
-    if not have_cache(context.config):
+    if not context.config.incremental or context.config.base_trees or context.config.overlay:
         return False
 
     final, build, _ = cache_tree_paths(context.config)
+    if not final.exists() or (need_build_overlay(context.config) and not build.exists()):
+        return False
 
     with complete_step("Copying cached trees"):
         copy_tree(