Phillip Smyth pushed to branch mandatory_suffix at BuildStream / buildstream
Commits:
-
0bb05aa0
by Phillip Smyth at 2018-11-23T10:26:01Z
-
dcfb3a8c
by Phillip Smyth at 2018-11-23T10:26:04Z
-
98c23475
by Phillip Smyth at 2018-11-23T10:26:04Z
4 changed files:
- NEWS
- buildstream/_loader/loader.py
- tests/frontend/buildcheckout.py
- + tests/frontend/project/elements/target.foo
Changes:
... | ... | @@ -2,6 +2,10 @@ |
2 | 2 |
buildstream 1.3.1
|
3 | 3 |
=================
|
4 | 4 |
|
5 |
+ o BREAKING CHANGE: Attempting to use an element that does not have the `.bst`
|
|
6 |
+ entension, will result in an error message.
|
|
7 |
+ All elements must now be suffixed with `.bst`
|
|
8 |
+ |
|
5 | 9 |
o BREAKING CHANGE: The 'manual' element lost its default 'MAKEFLAGS' and 'V'
|
6 | 10 |
environment variables. There is already a 'make' element with the same
|
7 | 11 |
variables. Note that this is a breaking change, it will require users to
|
... | ... | @@ -97,7 +97,13 @@ class Loader(): |
97 | 97 |
# Returns: The toplevel LoadElement
|
98 | 98 |
def load(self, targets, rewritable=False, ticker=None, fetch_subprojects=False):
|
99 | 99 |
|
100 |
+ invalid_file_extension = False
|
|
101 |
+ invalid_files = []
|
|
100 | 102 |
for filename in targets:
|
103 |
+ if not filename.endswith(".bst"):
|
|
104 |
+ invalid_file_extension = True
|
|
105 |
+ invalid_files.append(filename)
|
|
106 |
+ |
|
101 | 107 |
if os.path.isabs(filename):
|
102 | 108 |
# XXX Should this just be an assertion ?
|
103 | 109 |
# Expect that the caller gives us the right thing at least ?
|
... | ... | @@ -106,6 +112,12 @@ class Loader(): |
106 | 112 |
"path to the base project directory: {}"
|
107 | 113 |
.format(filename, self._basedir))
|
108 | 114 |
|
115 |
+ if invalid_file_extension:
|
|
116 |
+ raise LoadError(LoadErrorReason.INVALID_DATA,
|
|
117 |
+ "Target elements '{}' do not have expected file extension `.bst`\n"
|
|
118 |
+ "Improperly named elements will not be discoverable by commands"
|
|
119 |
+ .format(invalid_files))
|
|
120 |
+ |
|
109 | 121 |
# First pass, recursively load files and populate our table of LoadElements
|
110 | 122 |
#
|
111 | 123 |
deps = []
|
... | ... | @@ -60,6 +60,18 @@ def test_build_checkout(datafiles, cli, strict, hardlinks): |
60 | 60 |
assert os.path.exists(filename)
|
61 | 61 |
|
62 | 62 |
|
63 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
64 |
+@pytest.mark.parametrize("strict,hardlinks", [
|
|
65 |
+ ("non-strict", "hardlinks"),
|
|
66 |
+])
|
|
67 |
+def test_build_invalid_suffix(datafiles, cli, strict, hardlinks):
|
|
68 |
+ project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
69 |
+ checkout = os.path.join(cli.directory, 'checkout')
|
|
70 |
+ |
|
71 |
+ result = cli.run(project=project, args=strict_args(['build', 'target.foo'], strict))
|
|
72 |
+ result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA)
|
|
73 |
+ |
|
74 |
+ |
|
63 | 75 |
@pytest.mark.datafiles(DATA_DIR)
|
64 | 76 |
@pytest.mark.parametrize("deps", [("run"), ("none")])
|
65 | 77 |
def test_build_checkout_deps(datafiles, cli, deps):
|
1 |
+kind: stack
|
|
2 |
+description: |
|
|
3 |
+ |
|
4 |
+ Main stack target for the bst build test
|
|
5 |
+ |
|
6 |
+depends:
|
|
7 |
+- import-bin.bst
|
|
8 |
+- compose-all.bst
|