From daa20ddeedec4aae4adf663613822051c9fedc62 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 28 Jan 2025 20:47:30 +0100 Subject: [PATCH] Don't call have_cache() in reuse_cache() 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mkosi/__init__.py b/mkosi/__init__.py index bb11dc991..863a72722 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -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( -- 2.47.2