Chandan Singh pushed to branch chandan/element-filename-requirements at BuildStream / buildstream
Commits:
5 changed files:
- doc/source/format_declaring.rst
- tests/frontend/buildcheckout.py
- + tests/frontend/project/elements/invalid-chars-in-dep.bst
- + tests/frontend/project/elements/invalid-chars|<>-in-name.bst
- tests/frontend/project/project.conf
Changes:
| ... | ... | @@ -526,3 +526,27 @@ read-only variables are also dynamically declared by BuildStream: |
| 526 | 526 |
build, support for this is conditional on the element type
|
| 527 | 527 |
and the build system used (any element using 'make' can
|
| 528 | 528 |
implement this).
|
| 529 |
+ |
|
| 530 |
+ |
|
| 531 |
+Naming elements
|
|
| 532 |
+---------------
|
|
| 533 |
+When naming the element files, use the following rules:
|
|
| 534 |
+ |
|
| 535 |
+* The name of the file must have ``.bst`` extension.
|
|
| 536 |
+ |
|
| 537 |
+* All characters in the name must be printable 7-bit ASCII characters.
|
|
| 538 |
+ |
|
| 539 |
+* Following characters are reserved and must not be part of the name:
|
|
| 540 |
+ |
|
| 541 |
+ - ``<`` (less than)
|
|
| 542 |
+ - ``>`` (greater than)
|
|
| 543 |
+ - ``:`` (colon)
|
|
| 544 |
+ - ``"`` (double quote)
|
|
| 545 |
+ - ``/`` (forward slash)
|
|
| 546 |
+ - ``\`` (backslash)
|
|
| 547 |
+ - ``|`` (vertical bar)
|
|
| 548 |
+ - ``?`` (question mark)
|
|
| 549 |
+ - ``*`` (asterisk)
|
|
| 550 |
+ |
|
| 551 |
+BuildStream will attempt to raise warnings when any of these rules are violated
|
|
| 552 |
+but that may not always be possible.
|
| ... | ... | @@ -85,6 +85,20 @@ def test_build_invalid_suffix_dep(datafiles, cli, strict, hardlinks): |
| 85 | 85 |
result.assert_main_error(ErrorDomain.LOAD, "bad-element-suffix")
|
| 86 | 86 |
|
| 87 | 87 |
|
| 88 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
| 89 |
+def test_build_invalid_filename_chars(datafiles, cli):
|
|
| 90 |
+ project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
| 91 |
+ result = cli.run(project=project, args=strict_args(['build', 'invalid-chars|<>-in-name.bst'], 'non-strict'))
|
|
| 92 |
+ result.assert_main_error(ErrorDomain.LOAD, "bad-characters-in-name")
|
|
| 93 |
+ |
|
| 94 |
+ |
|
| 95 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
| 96 |
+def test_build_invalid_filename_chars_dep(datafiles, cli):
|
|
| 97 |
+ project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
| 98 |
+ result = cli.run(project=project, args=strict_args(['build', 'invalid-chars-in-dep.bst'], 'non-strict'))
|
|
| 99 |
+ result.assert_main_error(ErrorDomain.LOAD, "bad-characters-in-name")
|
|
| 100 |
+ |
|
| 101 |
+ |
|
| 88 | 102 |
@pytest.mark.datafiles(DATA_DIR)
|
| 89 | 103 |
@pytest.mark.parametrize("deps", [("run"), ("none"), ("build")])
|
| 90 | 104 |
def test_build_checkout_deps(datafiles, cli, deps):
|
| 1 |
+kind: stack
|
|
| 2 |
+description: |
|
|
| 3 |
+ |
|
| 4 |
+ This element itself has a valid name, but depends on elements that have
|
|
| 5 |
+ invalid names. This should also result in a warning.
|
|
| 6 |
+ |
|
| 7 |
+depends:
|
|
| 8 |
+- invalid-chars|<>-in-name.bst
|
| 1 |
+kind: stack
|
|
| 2 |
+description: |
|
|
| 3 |
+ The name of this files contains characters that are not allowed by
|
|
| 4 |
+ BuildStream, using it should raise a warning.
|
| ... | ... | @@ -5,3 +5,4 @@ element-path: elements |
| 5 | 5 |
|
| 6 | 6 |
fatal-warnings:
|
| 7 | 7 |
- bad-element-suffix
|
| 8 |
+- bad-characters-in-name
|
