diff options
author | Raoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk> | 2019-03-14 13:50:08 +0000 |
---|---|---|
committer | Raoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk> | 2019-03-22 16:02:08 +0000 |
commit | a7c9ed182883149da270a231f6502ec826806399 (patch) | |
tree | 9f027176f1f5d6fff2cb39c833a06c17b4d57ba0 | |
parent | 7173e13044b1172601734d53fb117be092a6ab81 (diff) | |
download | buildstream-a7c9ed182883149da270a231f6502ec826806399.tar.gz |
element.py: Add source push methods to Element
Part of #440
-rw-r--r-- | buildstream/element.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/buildstream/element.py b/buildstream/element.py index b29a9d64b..a0a6b59ae 100644 --- a/buildstream/element.py +++ b/buildstream/element.py @@ -1856,6 +1856,25 @@ class Element(Plugin): # Notify successfull download return True + def _skip_source_push(self): + if not self.__sources or self._get_workspace(): + return True + return not (self.__sourcecache.has_push_remotes(plugin=self) and + self._source_cached()) + + def _source_push(self): + # try and push sources if we've got them + if self.__sourcecache.has_push_remotes(plugin=self) and self._source_cached(): + sources = list(self.sources()) + if sources: + source_pushed = self.__sourcecache.push(sources[-1]) + + if not source_pushed: + return False + + # Notify successful upload + return True + # _skip_push(): # # Determine whether we should create a push job for this element. |