Phillip Smyth pushed to branch mandatory_suffix at BuildStream / buildstream
Commits:
-
2e8b43b4
by Phillip Smyth at 2018-11-23T10:51:35Z
-
60bad232
by Phillip Smyth at 2018-11-23T10:53:41Z
-
cdabece9
by Phillip Smyth at 2018-11-23T10:53:53Z
3 changed files:
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 |
+ extension, 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,11 @@ 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_files = []
|
|
100 | 101 |
for filename in targets:
|
102 |
+ if not filename.endswith(".bst"):
|
|
103 |
+ invalid_files.append(filename)
|
|
104 |
+ |
|
101 | 105 |
if os.path.isabs(filename):
|
102 | 106 |
# XXX Should this just be an assertion ?
|
103 | 107 |
# Expect that the caller gives us the right thing at least ?
|
... | ... | @@ -106,6 +110,12 @@ class Loader(): |
106 | 110 |
"path to the base project directory: {}"
|
107 | 111 |
.format(filename, self._basedir))
|
108 | 112 |
|
113 |
+ if invalid_files:
|
|
114 |
+ raise LoadError(LoadErrorReason.INVALID_DATA,
|
|
115 |
+ "Target elements '{}' do not have expected file extension `.bst`\n"
|
|
116 |
+ "Improperly named elements will not be discoverable by commands"
|
|
117 |
+ .format(invalid_files))
|
|
118 |
+ |
|
109 | 119 |
# First pass, recursively load files and populate our table of LoadElements
|
110 | 120 |
#
|
111 | 121 |
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):
|