summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbst-marge-bot <marge-bot@buildstream.build>2020-04-08 14:17:22 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2020-04-08 14:17:22 +0000
commitf42dd713ecc9ae696b90fb5c91d838f7f4f9848f (patch)
tree711f1deda68221873b03314118282ce2f7ef60af
parent9ba60e6c42058e6e5d46056a395fe50fcad267d2 (diff)
parentd3e32297814fa7e3f9b4aede4b9ecb83abea00c2 (diff)
downloadbuildstream-f42dd713ecc9ae696b90fb5c91d838f7f4f9848f.tar.gz
Merge branch 'abderrahim/public-data' into 'master'
Fix expiry of public data of artifact Closes #1264 See merge request BuildStream/buildstream!1837
-rw-r--r--src/buildstream/_artifact.py5
-rw-r--r--src/buildstream/_cas/cascache.py8
2 files changed, 12 insertions, 1 deletions
diff --git a/src/buildstream/_artifact.py b/src/buildstream/_artifact.py
index a9cd56c2a..659facba4 100644
--- a/src/buildstream/_artifact.py
+++ b/src/buildstream/_artifact.py
@@ -443,6 +443,11 @@ class Artifact:
self._cached = False
return False
+ # Check whether public data is available
+ if not self._cas.contains_file(artifact.public_data):
+ self._cached = False
+ return False
+
self._cached = True
return True
diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py
index 48b700c68..03be75c72 100644
--- a/src/buildstream/_cas/cascache.py
+++ b/src/buildstream/_cas/cascache.py
@@ -175,7 +175,13 @@ class CASCache:
# Returns: True if the file is in the cache, False otherwise
#
def contains_file(self, digest):
- return os.path.exists(self.objpath(digest))
+ cas = self.get_cas()
+
+ request = remote_execution_pb2.FindMissingBlobsRequest()
+ request.blob_digests.append(digest)
+
+ response = cas.FindMissingBlobs(request)
+ return len(response.missing_blob_digests) == 0
# contains_directory():
#