Martin Blanchard pushed to branch mablanch/447-stack-trace-checkout at BuildStream / buildstream
Commits:
-
87edf67e
by Martin Blanchard at 2018-08-01T11:07:05Z
-
d10e4668
by Phillip Smyth at 2018-08-01T12:05:40Z
-
425f3b87
by Martin Blanchard at 2018-08-01T12:06:42Z
-
b254ba71
by Martin Blanchard at 2018-08-01T12:06:42Z
10 changed files:
- buildstream/_frontend/complete.py
- buildstream/_stream.py
- buildstream/element.py
- tests/completions/completions.py
- + tests/completions/sub-folders/base/unwanted.bst
- + tests/completions/sub-folders/elements/base.bst
- + tests/completions/sub-folders/elements/base/wanted.bst
- + tests/completions/sub-folders/elements/hello.bst
- + tests/completions/sub-folders/project.conf
- tests/frontend/buildcheckout.py
Changes:
... | ... | @@ -68,9 +68,10 @@ def complete_path(path_type, incomplete, base_directory='.'): |
68 | 68 |
# If there was nothing on the left of the last separator,
|
69 | 69 |
# we are completing files in the filesystem root
|
70 | 70 |
base_path = os.path.join(base_directory, base_path)
|
71 |
- |
|
72 |
- elif os.path.isdir(incomplete):
|
|
73 |
- base_path = incomplete
|
|
71 |
+ else:
|
|
72 |
+ incomplete_base_path = os.path.join(base_directory, incomplete)
|
|
73 |
+ if os.path.isdir(incomplete_base_path):
|
|
74 |
+ base_path = incomplete_base_path
|
|
74 | 75 |
|
75 | 76 |
try:
|
76 | 77 |
if base_path:
|
... | ... | @@ -435,7 +435,7 @@ class Stream(): |
435 | 435 |
|
436 | 436 |
except BstError as e:
|
437 | 437 |
raise StreamError("Error while staging dependencies into a sandbox"
|
438 |
- ": '{}'".format(e), reason=e.reason) from e
|
|
438 |
+ ": '{}'".format(e), detail=e.detail, reason=e.reason) from e
|
|
439 | 439 |
|
440 | 440 |
# workspace_open
|
441 | 441 |
#
|
... | ... | @@ -614,6 +614,12 @@ class Element(Plugin): |
614 | 614 |
dep.stage_artifact(sandbox)
|
615 | 615 |
"""
|
616 | 616 |
|
617 |
+ if not self._cached():
|
|
618 |
+ detail = "No artifacts have been cached yet for that element\n" + \
|
|
619 |
+ "Try building the element first with `bst build`\n"
|
|
620 |
+ raise ElementError("No artifacts to stage",
|
|
621 |
+ detail=detail, reason="uncached-checkout-attempt")
|
|
622 |
+ |
|
617 | 623 |
if update_mtimes is None:
|
618 | 624 |
update_mtimes = []
|
619 | 625 |
|
... | ... | @@ -212,6 +212,10 @@ def test_option_directory(datafiles, cli, cmd, word_idx, expected, subdir): |
212 | 212 |
# Also try multi arguments together
|
213 | 213 |
('no-element-path', 'bst --directory ../ checkout t ', 4, ['target.bst '], 'files'),
|
214 | 214 |
('no-element-path', 'bst --directory ../ checkout target.bst ', 5, ['bin-files/', 'dev-files/'], 'files'),
|
215 |
+ |
|
216 |
+ # When element-path have sub-folders
|
|
217 |
+ ('sub-folders', 'bst show base', 2, ['base/wanted.bst '], None),
|
|
218 |
+ ('sub-folders', 'bst show base/', 2, ['base/wanted.bst '], None),
|
|
215 | 219 |
])
|
216 | 220 |
def test_argument_element(datafiles, cli, project, cmd, word_idx, expected, subdir):
|
217 | 221 |
cwd = os.path.join(str(datafiles), project)
|
1 |
+kind: autotools
|
|
2 |
+description: |
|
|
3 |
+ |
|
4 |
+ Not auto-completed element
|
1 |
+kind: stack
|
|
2 |
+description: Base stack
|
|
3 |
+ |
|
4 |
+depends:
|
|
5 |
+- base/wanted.bst
|
1 |
+kind: autotools
|
|
2 |
+description: |
|
|
3 |
+ |
|
4 |
+ Auto-completed element
|
1 |
+kind: autotools
|
|
2 |
+description: |
|
|
3 |
+ |
|
4 |
+ Hello world
|
1 |
+# Project config for frontend build test
|
|
2 |
+name: test
|
|
3 |
+ |
|
4 |
+element-path: elements
|
... | ... | @@ -96,6 +96,16 @@ def test_build_checkout_deps(datafiles, cli, deps): |
96 | 96 |
assert not os.path.exists(filename)
|
97 | 97 |
|
98 | 98 |
|
99 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
100 |
+def test_build_checkout_unbuilt(datafiles, cli):
|
|
101 |
+ project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
102 |
+ checkout = os.path.join(cli.directory, 'checkout')
|
|
103 |
+ |
|
104 |
+ # Check that checking out an unbuilt element fails nicely
|
|
105 |
+ result = cli.run(project=project, args=['checkout', 'target.bst', checkout])
|
|
106 |
+ result.assert_main_error(ErrorDomain.STREAM, "uncached-checkout-attempt")
|
|
107 |
+ |
|
108 |
+ |
|
99 | 109 |
@pytest.mark.datafiles(DATA_DIR)
|
100 | 110 |
def test_build_checkout_tarball(datafiles, cli):
|
101 | 111 |
project = os.path.join(datafiles.dirname, datafiles.basename)
|