diff options
author | Tom Pollard <tom.pollard@codethink.co.uk> | 2019-02-28 17:31:40 +0000 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-03-12 18:11:28 +0000 |
commit | 9bba8f45880684408c8eed53ed2050689c06306e (patch) | |
tree | ed365c17760fec69e8193bac64b37d276278269c | |
parent | bd67fde9a2fa4490f715af0bba05b3fc0e14bded (diff) | |
download | buildstream-9bba8f45880684408c8eed53ed2050689c06306e.tar.gz |
_artifact.py: Transition element.py _cached_buildtree()
-rw-r--r-- | buildstream/_artifact.py | 27 | ||||
-rw-r--r-- | buildstream/element.py | 12 |
2 files changed, 28 insertions, 11 deletions
diff --git a/buildstream/_artifact.py b/buildstream/_artifact.py index 12a7d9648..cf9529889 100644 --- a/buildstream/_artifact.py +++ b/buildstream/_artifact.py @@ -200,6 +200,33 @@ class Artifact(): return artifact_size + # cached_buildtree() + # + # Check if artifact is cached with expected buildtree. A + # buildtree will not be present if the res tof the partial artifact + # is not cached. + # + # Returns: + # (bool): True if artifact cached with buildtree, False if + # element not cached or missing expected buildtree. + # Note this only confirms if a buildtree is present, + # not its contents. + # + def cached_buildtree(self): + + context = self._context + element = self._element + + if not element._cached(): + return False + + key_strength = _KeyStrength.STRONG if context.get_strict() else _KeyStrength.WEAK + if not self._artifacts.contains_subdir_artifact(element, element._get_cache_key(strength=key_strength), + 'buildtree'): + return False + + return True + # _get_directory(): # # Get a virtual directory for the artifact contents diff --git a/buildstream/element.py b/buildstream/element.py index 24ff51f7f..c805a844c 100644 --- a/buildstream/element.py +++ b/buildstream/element.py @@ -2028,17 +2028,7 @@ class Element(Plugin): # not its contents. # def _cached_buildtree(self): - context = self._get_context() - - if not self._cached(): - return False - - key_strength = _KeyStrength.STRONG if context.get_strict() else _KeyStrength.WEAK - if not self.__artifacts.contains_subdir_artifact(self, self._get_cache_key(strength=key_strength), - 'buildtree'): - return False - - return True + return self.__artifact.cached_buildtree() # _fetch() # |