summaryrefslogtreecommitdiff
path: root/buildstream/_loader.py
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2018-01-22 12:48:39 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2018-01-22 15:16:23 +0000
commite0072ed525ac239167d3f9753dc75e84deadfd0b (patch)
tree0947721a26ff42f54d6aefe51e5a246844e2f53c /buildstream/_loader.py
parent2e1cf4bf52821599776b42d2a66f54e8620a4200 (diff)
downloadbuildstream-sam/recursive-pipelines-in-subdir.tar.gz
Add a 'path' config option to junction elementssam/recursive-pipelines-in-subdir
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]
Diffstat (limited to 'buildstream/_loader.py')
-rw-r--r--buildstream/_loader.py13
1 files changed, 12 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)