Tristan Van Berkom pushed to branch valentindavid/inconsistant-workspace at BuildStream / buildstream
Commits:
-
91d62d2f
by Chandan Singh at 2018-08-22T18:38:01Z
-
cd0775eb
by Chandan Singh at 2018-08-22T23:44:36Z
-
b0d1aa83
by Tristan Van Berkom at 2018-08-23T05:54:05Z
-
2215859c
by Valentin David at 2018-08-23T06:40:19Z
4 changed files:
Changes:
... | ... | @@ -23,4 +23,4 @@ recursive-include tests *.expected |
23 | 23 |
recursive-include buildstream/_protos *.proto
|
24 | 24 |
|
25 | 25 |
# Requirements files
|
26 |
-dev-requirements.txt
|
|
26 |
+include dev-requirements.txt
|
... | ... | @@ -28,9 +28,9 @@ from .app import App |
28 | 28 |
#
|
29 | 29 |
def _osc_777_supported():
|
30 | 30 |
|
31 |
- term = os.environ['TERM']
|
|
31 |
+ term = os.environ.get('TERM')
|
|
32 | 32 |
|
33 |
- if term.startswith('xterm') or term.startswith('vte'):
|
|
33 |
+ if term and (term.startswith('xterm') or term.startswith('vte')):
|
|
34 | 34 |
|
35 | 35 |
# Since vte version 4600, upstream silently ignores
|
36 | 36 |
# the OSC 777 without printing garbage to the terminal.
|
... | ... | @@ -39,10 +39,10 @@ def _osc_777_supported(): |
39 | 39 |
# will trigger a desktop notification and bring attention
|
40 | 40 |
# to the terminal.
|
41 | 41 |
#
|
42 |
- vte_version = os.environ['VTE_VERSION']
|
|
42 |
+ vte_version = os.environ.get('VTE_VERSION')
|
|
43 | 43 |
try:
|
44 | 44 |
vte_version_int = int(vte_version)
|
45 |
- except ValueError:
|
|
45 |
+ except (ValueError, TypeError):
|
|
46 | 46 |
return False
|
47 | 47 |
|
48 | 48 |
if vte_version_int >= 4600:
|
... | ... | @@ -355,10 +355,14 @@ class Pipeline(): |
355 | 355 |
#
|
356 | 356 |
def assert_consistent(self, elements):
|
357 | 357 |
inconsistent = []
|
358 |
+ inconsistent_workspaced = []
|
|
358 | 359 |
with self._context.timed_activity("Checking sources"):
|
359 | 360 |
for element in elements:
|
360 | 361 |
if element._get_consistency() == Consistency.INCONSISTENT:
|
361 |
- inconsistent.append(element)
|
|
362 |
+ if element._get_workspace():
|
|
363 |
+ inconsistent_workspaced.append(element)
|
|
364 |
+ else:
|
|
365 |
+ inconsistent.append(element)
|
|
362 | 366 |
|
363 | 367 |
if inconsistent:
|
364 | 368 |
detail = "Exact versions are missing for the following elements:\n\n"
|
... | ... | @@ -372,6 +376,13 @@ class Pipeline(): |
372 | 376 |
|
373 | 377 |
raise PipelineError("Inconsistent pipeline", detail=detail, reason="inconsistent-pipeline")
|
374 | 378 |
|
379 |
+ if inconsistent_workspaced:
|
|
380 |
+ detail = "Some workspaces do not exist but are not closed\n" + \
|
|
381 |
+ "Try closing them with `bst workspace close`\n\n"
|
|
382 |
+ for element in inconsistent_workspaced:
|
|
383 |
+ detail += " " + element._get_full_name() + "\n"
|
|
384 |
+ raise PipelineError("Inconsistent pipeline", detail=detail, reason="inconsistent-pipeline-workspaced")
|
|
385 |
+ |
|
375 | 386 |
#############################################################
|
376 | 387 |
# Private Methods #
|
377 | 388 |
#############################################################
|
... | ... | @@ -767,3 +767,16 @@ def test_list_supported_workspace(cli, tmpdir, datafiles, workspace_cfg, expecte |
767 | 767 |
# Check that workspace config is converted correctly if necessary
|
768 | 768 |
loaded_config = _yaml.node_sanitize(_yaml.load(workspace_config_path))
|
769 | 769 |
assert loaded_config == parse_dict_as_yaml(expected)
|
770 |
+ |
|
771 |
+ |
|
772 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
773 |
+@pytest.mark.parametrize("kind", repo_kinds)
|
|
774 |
+def test_inconsitent_pipeline_message(cli, tmpdir, datafiles, kind):
|
|
775 |
+ element_name, project, workspace = open_workspace(cli, tmpdir, datafiles, kind, False)
|
|
776 |
+ |
|
777 |
+ shutil.rmtree(workspace)
|
|
778 |
+ |
|
779 |
+ result = cli.run(project=project, args=[
|
|
780 |
+ 'build', element_name
|
|
781 |
+ ])
|
|
782 |
+ result.assert_main_error(ErrorDomain.PIPELINE, "inconsistent-pipeline-workspaced")
|