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 /buildstream/_artifact.py | |
parent | bd67fde9a2fa4490f715af0bba05b3fc0e14bded (diff) | |
download | buildstream-9bba8f45880684408c8eed53ed2050689c06306e.tar.gz |
_artifact.py: Transition element.py _cached_buildtree()
Diffstat (limited to 'buildstream/_artifact.py')
-rw-r--r-- | buildstream/_artifact.py | 27 |
1 files changed, 27 insertions, 0 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 |