Skip to content

Commit

Permalink
Don't call have_cache() in reuse_cache()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DaanDeMeyer committed Jan 29, 2025
1 parent b0265d7 commit daa20dd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mkosi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit daa20dd

Please sign in to comment.