diff options
-rw-r--r-- | src/buildstream/_artifact.py | 9 | ||||
-rw-r--r-- | src/buildstream/element.py | 17 |
2 files changed, 12 insertions, 14 deletions
diff --git a/src/buildstream/_artifact.py b/src/buildstream/_artifact.py index c353a5151..b3ef005f0 100644 --- a/src/buildstream/_artifact.py +++ b/src/buildstream/_artifact.py @@ -398,15 +398,8 @@ class Artifact(): # Allow the Artifact to query the filesystem to determine whether it # is cached or not. # - # NOTE: Due to the fact that a normal buildstream run does not make an - # artifact *not* cached (`bst artifact delete` can do so, but doesn't - # query the Artifact afterwards), it does not update_cached if the - # artifact is already cached. If a cached artifact ever has its key - # changed, this will need to be revisited. - # def reset_cached(self): - if self._cached is False: - self._cached = None + self._cached = None # _get_proto() # diff --git a/src/buildstream/element.py b/src/buildstream/element.py index 70158f778..08326c6f3 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -1566,6 +1566,12 @@ class Element(Plugin): self.__assemble_scheduled = False self.__assemble_done = True + # Artifact may have a cached success now. + if self.__strict_artifact: + self.__strict_artifact.reset_cached() + if self.__artifact: + self.__artifact.reset_cached() + self.__update_state_recursively() if self._get_workspace() and self._cached_success(): @@ -1817,6 +1823,11 @@ class Element(Plugin): def _pull_done(self): self.__pull_done = True + # Artifact may become cached after pulling, so let it query the + # filesystem again to check + self.__strict_artifact.reset_cached() + self.__artifact.reset_cached() + self.__update_state_recursively() # _pull(): @@ -2967,12 +2978,6 @@ class Element(Plugin): self.__cache_key = self.__strict_cache_key self.__artifact = self.__strict_artifact - # Allow caches to be queried, since they may now be cached - # The next invocation of Artifact.cached() will access the filesystem. - # Note that this will safely do nothing if the artifacts are already cached. - self.__strict_artifact.reset_cached() - self.__artifact.reset_cached() - # __update_cache_key_non_strict() # # Calculates the strong cache key if it hasn't already been set. |