clan_cli flake caching: fix caching of store files

This commit is contained in:
lassulus
2025-05-01 13:40:12 +09:00
parent 4ef8ef4542
commit fc1f563f7a

View File

@@ -344,9 +344,6 @@ class FlakeCacheEntry:
def is_cached(self, selectors: list[Selector]) -> bool: def is_cached(self, selectors: list[Selector]) -> bool:
selector: Selector selector: Selector
if selectors == []:
return self.fetched_all
selector = selectors[0]
# for store paths we have to check if they still exist, otherwise they have to be rebuild and are thus not cached # for store paths we have to check if they still exist, otherwise they have to be rebuild and are thus not cached
if isinstance(self.value, str) and self.value.startswith("/nix/store/"): if isinstance(self.value, str) and self.value.startswith("/nix/store/"):
@@ -356,6 +353,10 @@ class FlakeCacheEntry:
if isinstance(self.value, str | float | int | None): if isinstance(self.value, str | float | int | None):
return True return True
if selectors == []:
return self.fetched_all
selector = selectors[0]
# we just fetch all subkeys, so we need to check of we inserted all keys at this level before # we just fetch all subkeys, so we need to check of we inserted all keys at this level before
if selector.type == SelectorType.ALL: if selector.type == SelectorType.ALL:
assert isinstance(self.value, dict) assert isinstance(self.value, dict)