summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildstream/_artifactcache/artifactcache.py5
-rw-r--r--buildstream/_artifactcache/ostreecache.py13
2 files changed, 15 insertions, 3 deletions
diff --git a/buildstream/_artifactcache/artifactcache.py b/buildstream/_artifactcache/artifactcache.py
index 18fca86e0..17038105d 100644
--- a/buildstream/_artifactcache/artifactcache.py
+++ b/buildstream/_artifactcache/artifactcache.py
@@ -254,9 +254,12 @@ class ArtifactCache():
#
# Check whether any remote repositories are available for fetching.
#
+ # Args:
+ # element (Element): The Element to check
+ #
# Returns: True if any remote repositories are configured, False otherwise
#
- def has_fetch_remotes(self):
+ def has_fetch_remotes(self, *, element=None):
return False
# has_push_remotes():
diff --git a/buildstream/_artifactcache/ostreecache.py b/buildstream/_artifactcache/ostreecache.py
index b592ac4f2..dba6c5359 100644
--- a/buildstream/_artifactcache/ostreecache.py
+++ b/buildstream/_artifactcache/ostreecache.py
@@ -64,8 +64,17 @@ class OSTreeCache(ArtifactCache):
################################################
# Implementation of abstract methods #
################################################
- def has_fetch_remotes(self):
- return self._has_fetch_remotes
+ def has_fetch_remotes(self, *, element=None):
+ if not self._has_fetch_remotes:
+ # No project has push remotes
+ return False
+ elif element is None:
+ # At least one (sub)project has fetch remotes
+ return True
+ else:
+ # Check whether the specified element's project has fetch remotes
+ remotes_for_project = self._remotes[element._get_project()]
+ return bool(remotes_for_project)
def has_push_remotes(self, *, element=None):
if not self._has_push_remotes: