From 46bc1d597cb14e3971a642a8cb99a58e58ca6893 Mon Sep 17 00:00:00 2001 From: Raoul Hidalgo Charman Date: Thu, 14 Mar 2019 13:50:08 +0000 Subject: element.py: Add source push methods to Element Part of #440 --- buildstream/element.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/buildstream/element.py b/buildstream/element.py index 9432aa018..b27f3e7df 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. -- cgit v1.2.1