summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>2019-03-14 13:50:08 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2019-03-25 11:46:44 +0000
commit46bc1d597cb14e3971a642a8cb99a58e58ca6893 (patch)
treed47cc76b0636eb22afced65b9f95f1a5df90ed88
parentbcd1a3b766dc311d3e809c6f5176990c73b9c481 (diff)
downloadbuildstream-46bc1d597cb14e3971a642a8cb99a58e58ca6893.tar.gz
element.py: Add source push methods to Element
Part of #440
-rw-r--r--buildstream/element.py19
1 files changed, 19 insertions, 0 deletions
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.