We moved this to reuse_cache() before the introduction of mkosi-sandbox
because we would change uids during execution. Now that we don't do that
anymore, we can move the check back to have_cache().
logging.debug(f"{final} does not exist, not reusing cached images")
return False
+ if (uid := final.stat().st_uid) != os.getuid():
+ logging.debug(
+ f"{final} uid ({uid}) does not match user uid ({os.getuid()}), not reusing cached images"
+ )
+ return False
+
if need_build_overlay(config) and not build.exists():
logging.debug(f"{build} does not exist, not reusing cached images")
return False
final, build, _ = cache_tree_paths(context.config)
- if final.stat().st_uid != os.getuid():
- return False
-
with complete_step("Copying cached trees"):
copy_tree(
final,