summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-04-01 13:28:52 +0200
committerJürg Billeter <j@bitron.ch>2019-04-12 11:17:33 +0200
commita16a5cfc1b91eb09b22baff63571c88f03381dfe (patch)
treee4961a6a3cb13e3a7354c4f0c9293c81b54db636
parent4ea1ae62a42ebbaa0b8ba9fbee2c1629b2f73b28 (diff)
downloadbuildstream-a16a5cfc1b91eb09b22baff63571c88f03381dfe.tar.gz
_artifactcache.py: Add find_missing_blobs() method
-rw-r--r--buildstream/_artifactcache.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/buildstream/_artifactcache.py b/buildstream/_artifactcache.py
index fb0670e3e..7a6f2ea0c 100644
--- a/buildstream/_artifactcache.py
+++ b/buildstream/_artifactcache.py
@@ -436,3 +436,30 @@ class ArtifactCache(BaseCache):
if missing_blobs:
raise ArtifactError("Blobs not found on configured artifact servers")
+
+ # find_missing_blobs():
+ #
+ # Find missing blobs from configured push remote repositories.
+ #
+ # Args:
+ # project (Project): The current project
+ # missing_blobs (list): The Digests of the blobs to check
+ #
+ # Returns:
+ # (list): The Digests of the blobs missing on at least one push remote
+ #
+ def find_missing_blobs(self, project, missing_blobs):
+ if not missing_blobs:
+ return []
+
+ push_remotes = [r for r in self._remotes[project] if r.spec.push]
+
+ remote_missing_blobs_set = set()
+
+ for remote in push_remotes:
+ remote.init()
+
+ remote_missing_blobs = self.cas.remote_missing_blobs(remote, missing_blobs)
+ remote_missing_blobs_set.update(remote_missing_blobs)
+
+ return list(remote_missing_blobs_set)