summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2018-01-22 12:48:39 +0000
committerJürg Billeter <j@bitron.ch>2018-02-08 14:04:39 +0100
commitd13dcdcdd57a55a6e65e8f82c7699b7010939cb1 (patch)
tree142d885901cb364917fc4fe8c5c055d816c055b1
parent6e9c1809631ab6f1560b0e65a99fa61cc3f5de2a (diff)
downloadbuildstream-juerg/recursive-pipelines.tar.gz
Add a 'path' config option to junction elementsjuerg/recursive-pipelines
This makes it possible to depend on a project which is in a subdirectory of a Git repository. The error message given when the expected project.conf file is not found has also been improved. Previously the error would look like this: Error loading pipeline: Could not find file at /home/sam/.cache/buildstream/build/freedesktop-sdk-junction-rvmn17s2/project.conf This is giving the path of an internal temporary directory where the foreign project's source is checked out. The new error gives more information: Error loading pipeline: Could not find the project.conf file for junction element at freedesktop-sdk-junction.bst [line 1 column 0]. Expecting a project at path '.' within git source at freedesktop-sdk-junction.bst [line 4 column 2]
-rw-r--r--buildstream/_loader.py13
-rw-r--r--buildstream/plugins/elements/junction.py4
2 files changed, 16 insertions, 1 deletions
diff --git a/buildstream/_loader.py b/buildstream/_loader.py
index 2cd143f49..2ced3abfa 100644
--- a/buildstream/_loader.py
+++ b/buildstream/_loader.py
@@ -362,7 +362,18 @@ class Loader():
source._stage(basedir)
- project = Project(basedir, self.context, junction=element)
+ project_dir = os.path.join(basedir, element.path)
+
+ try:
+ project = Project(project_dir, self.context, junction=element)
+ except LoadError as e:
+ if e.reason == LoadErrorReason.MISSING_FILE:
+ raise LoadError(reason=e.reason,
+ message="Could not find the project.conf file for {}. "
+ "Expecting a project at path '{}' within {}".
+ format(element, element.path or '.', source)) from e
+ else:
+ raise
loader = Loader(project, [], parent=self, tempdir=basedir)
diff --git a/buildstream/plugins/elements/junction.py b/buildstream/plugins/elements/junction.py
index c0fd67d17..9a08edcc3 100644
--- a/buildstream/plugins/elements/junction.py
+++ b/buildstream/plugins/elements/junction.py
@@ -45,6 +45,9 @@ Overview
machine_arch: "%{machine_arch}"
debug: True
+ # Optionally look in a subpath of the source repository for the project
+ path: projects/hello
+
.. note::
Junction elements may not specify any dependencies as they are simply
@@ -115,6 +118,7 @@ from buildstream._pipeline import PipelineError
class JunctionElement(Element):
def configure(self, node):
+ self.path = self.node_get_member(node, str, 'path', default='')
self.options = self.node_get_member(node, Mapping, 'options', default={})
def preflight(self):