summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2017-07-19 08:03:33 +0200
committerJürg Billeter <j@bitron.ch>2017-07-20 07:24:56 +0200
commit4fdd4d5fa4df797a84272d9ffa4bedcc4baf8af0 (patch)
treea71fcb09f85b6b8f7ed879f5cde99e7339771e95
parent38a24fa7beff65d597db10a46b5bb35e760d2763 (diff)
downloadbuildstream-4fdd4d5fa4df797a84272d9ffa4bedcc4baf8af0.tar.gz
_artifactcache: Add remote_contains_key()
-rw-r--r--buildstream/_artifactcache/artifactcache.py24
1 files changed, 19 insertions, 5 deletions
diff --git a/buildstream/_artifactcache/artifactcache.py b/buildstream/_artifactcache/artifactcache.py
index 6be654210..e8ec28abc 100644
--- a/buildstream/_artifactcache/artifactcache.py
+++ b/buildstream/_artifactcache/artifactcache.py
@@ -87,21 +87,36 @@ class ArtifactCache():
ref = buildref(element, key)
return _ostree.exists(self.repo, ref)
- # remote_contains():
+ # remote_contains_key():
#
# Check whether the artifact for the specified Element is already available
# in the remote artifact cache.
#
# Args:
# element (Element): The Element to check
- # strength (_KeyStrength): Either STRONG or WEAK key strength, or None
+ # key (str): The key to use
#
# Returns: True if the artifact is in the cache, False otherwise
#
- def remote_contains(self, element, strength=None):
+ def remote_contains_key(self, element, key):
if not self.__remote_refs:
return False
+ ref = buildref(element, key)
+ return ref in self.__remote_refs
+
+ # remote_contains():
+ #
+ # Check whether the artifact for the specified Element is already available
+ # in the remote artifact cache.
+ #
+ # Args:
+ # element (Element): The Element to check
+ # strength (_KeyStrength): Either STRONG or WEAK key strength, or None
+ #
+ # Returns: True if the artifact is in the cache, False otherwise
+ #
+ def remote_contains(self, element, strength=None):
if strength is None:
strength = _KeyStrength.STRONG if self.context.strict_build_plan else _KeyStrength.WEAK
@@ -109,8 +124,7 @@ class ArtifactCache():
if not key:
return False
- ref = buildref(element, key)
- return ref in self.__remote_refs
+ return self.remote_contains_key(element, key)
# remove():
#