summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2017-07-18 11:09:26 +0200
committerJürg Billeter <j@bitron.ch>2017-07-20 07:24:56 +0200
commit33a337c4b7006d8d7e653c504bb42a45febaa65c (patch)
tree694e17b40a5f29469e80acdc5d6b45c9ede3dc29
parentd31d1759defb56db94541e3a8adcd297e81ad7e5 (diff)
downloadbuildstream-33a337c4b7006d8d7e653c504bb42a45febaa65c.tar.gz
_artifactcache: Add fetch_remote_refs()
-rw-r--r--buildstream/_artifactcache/artifactcache.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/buildstream/_artifactcache/artifactcache.py b/buildstream/_artifactcache/artifactcache.py
index a5321b528..6f95586fc 100644
--- a/buildstream/_artifactcache/artifactcache.py
+++ b/buildstream/_artifactcache/artifactcache.py
@@ -61,6 +61,8 @@ class ArtifactCache():
else:
self.remote = None
+ self.__remote_refs = None
+
# contains():
#
# Check whether the artifact for the specified Element is already available
@@ -236,6 +238,20 @@ class ArtifactCache():
raise _ArtifactError("Failed to pull artifact for element {}: {}"
.format(element.name, e)) from e
+ # fetch_remote_refs():
+ #
+ # Fetch list of artifacts from remote repository.
+ #
+ def fetch_remote_refs(self):
+ if self.context.artifact_pull.startswith("/"):
+ remote = "file://" + self.context.artifact_pull
+ elif self.remote is not None:
+ remote = self.remote
+ else:
+ raise _ArtifactError("Attempt to fetch remote refs without any pull URL")
+
+ self.__remote_refs = _ostree.list_remote_refs(self.repo, remote=remote)
+
# can_push():
#
# Check whether remote repository is available for pushing.