summaryrefslogtreecommitdiff
path: root/buildstream/source.py
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-04-16 16:35:42 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-04-16 16:45:04 +0900
commitca2331c3f314ff53428b5ca9c8c2efc9d2dbd7cc (patch)
treea4250ee0787c7f834390d48731d9a1b6760898a9 /buildstream/source.py
parent7c2a43d103e3034aa25ac7bd8571758a50526e61 (diff)
downloadbuildstream-ca2331c3f314ff53428b5ca9c8c2efc9d2dbd7cc.tar.gz
source.py, element.py, _pipeline.py: Streamling preflighting.
Instead of having the pipeline preflight all sources separately from elements, have the element preflight it's sources. This is in order to simplify the shared code path for the pipeline and the loader to use for instantiating elements. Also updated tests to expect the new ElementError and SourceError instead of the PipelineError which was raised for preflighting before.
Diffstat (limited to 'buildstream/source.py')
-rw-r--r--buildstream/source.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/buildstream/source.py b/buildstream/source.py
index d626fea35..9af17210e 100644
--- a/buildstream/source.py
+++ b/buildstream/source.py
@@ -344,6 +344,15 @@ class Source(Plugin):
# Private Methods used in BuildStream #
#############################################################
+ # Wrapper around preflight() method
+ #
+ def _preflight(self):
+ try:
+ self.preflight()
+ except BstError as e:
+ # Prepend provenance to the error
+ raise SourceError("{}: {}".format(self, e), reason=e.reason) from e
+
# Update cached consistency for a source
#
# This must be called whenever the state of a source may have changed.