diff options
author | Jürg Billeter <j@bitron.ch> | 2018-05-10 13:00:25 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2018-05-11 07:57:37 +0200 |
commit | e2c150f3f9c19b192c287d87185c8d381ad10e17 (patch) | |
tree | b2e6031aee66756c5ac947e520a4f0f21d508227 | |
parent | db503a42f2fb6d84d8254e09bcea308b601952ea (diff) | |
download | buildstream-e2c150f3f9c19b192c287d87185c8d381ad10e17.tar.gz |
_artifactcache: Add element paramater to has_fetch_remotes()
-rw-r--r-- | buildstream/_artifactcache/artifactcache.py | 5 | ||||
-rw-r--r-- | buildstream/_artifactcache/ostreecache.py | 13 |
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: |