This is an automated email from the ASF dual-hosted git repository. tvb pushed a commit to branch jennis/new_artifact_subcommands in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 38a09bf32ff4f80e8111ec88dfbec69b1cb1bc69 Author: James Ennis <[email protected]> AuthorDate: Fri Jan 11 15:49:48 2019 +0000 artifactcache.py: API Cleanup - Add contains_ref() method This ensures that we can determine whether an artifact is locally cached (as well as an element) using the ArtifactCache API. --- buildstream/_artifactcache.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/buildstream/_artifactcache.py b/buildstream/_artifactcache.py index 7bd5a53..24e6a3a 100644 --- a/buildstream/_artifactcache.py +++ b/buildstream/_artifactcache.py @@ -407,18 +407,30 @@ class ArtifactCache(): # contains(): # - # Check whether the artifact for the specified Element is already available - # in the local artifact cache. + # Check whether the (project state) artifact of the specified Element is + # already available in the local artifact cache. # # Args: # element (Element): The Element to check # key (str): The cache key to use # - # Returns: True if the artifact is in the cache, False otherwise + # Returns: True if the Element's (project state) artifact is in the cache, + # False otherwise # def contains(self, element, key): ref = self.get_artifact_fullname(element, key) + return self.contains_ref(ref) + # contains_ref(): + # + # Check whether an artifact is already available in the local artifact cache. + # + # Args: + # ref (str): The ref to check + # + # Returns: True if the artifact is in the cache, False otherwise + # + def contains_ref(self, ref): return self.cas.contains(ref) # contains_subdir_artifact():
