diff options
author | Tristan Maat <tristan.maat@codethink.co.uk> | 2019-08-23 11:55:00 +0100 |
---|---|---|
committer | Tristan Maat <tristan.maat@codethink.co.uk> | 2019-08-23 11:55:00 +0100 |
commit | 9fbfa9b1e02ea64f9967aa1136fa75c2b3a30446 (patch) | |
tree | 89977f02c778bc63057d5b782457734c64c1b628 /src/buildstream/element.py | |
parent | 1abf4ab51c4227841d5d6805dfa71675604b95d0 (diff) | |
download | buildstream-tlater/source-pushll.tar.gz |
Add `bst source push/pull` commandstlater/source-pushll
Diffstat (limited to 'src/buildstream/element.py')
-rw-r--r-- | src/buildstream/element.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py index ca573bee1..0bac84617 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -1836,6 +1836,22 @@ class Element(Plugin): # Notify successfull download return True + def _skip_source_pull(self): + if not self.__sources or self._get_workspace(): + return True + return self._source_cached() or not self.__sourcecache.has_fetch_remotes(plugin=self) + + def _source_pull(self): + if self.__sourcecache.has_fetch_remotes(plugin=self) and not self._source_cached(): + for source in self.sources(): + if self.__sourcecache.pull(source): + # Once we find a cache with the source and manage + # to pull from it, we're done + return True + + # If no caches gave us the source, this failed + return False + def _skip_source_push(self): if not self.__sources or self._get_workspace(): return True |