diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/buildstream/_frontend/cli.py | 2 | ||||
-rw-r--r-- | src/buildstream/_stream.py | 6 | ||||
-rw-r--r-- | src/buildstream/testing/__init__.py | 2 | ||||
-rw-r--r-- | src/buildstream/testing/runcli.py | 7 |
4 files changed, 9 insertions, 8 deletions
diff --git a/src/buildstream/_frontend/cli.py b/src/buildstream/_frontend/cli.py index 5e42bda68..ab06e8a8a 100644 --- a/src/buildstream/_frontend/cli.py +++ b/src/buildstream/_frontend/cli.py @@ -640,7 +640,7 @@ def shell(app, element, mount, isolate, build_, cli_buildtree, pull_, command): pull_=pull_, ) except BstError as e: - raise AppError("Error launching shell: {}".format(e), detail=e.detail) from e + raise AppError("Error launching shell: {}".format(e), detail=e.detail, reason=e.reason) from e # If there were no errors, we return the shell's exit code here. sys.exit(exitcode) diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py index 0aff5fb94..e91ee882c 100644 --- a/src/buildstream/_stream.py +++ b/src/buildstream/_stream.py @@ -221,6 +221,7 @@ class Stream: raise StreamError( "Elements need to be built or downloaded before staging a shell environment", detail="\n".join(list(map(lambda x: x._get_full_name(), missing_deps))), + reason="shell-missing-deps", ) # Check if we require a pull queue attempt, with given artifact state and context @@ -229,11 +230,14 @@ class Stream: remotes_message = " or in available remotes" if pull_ else "" if not element._cached(): message = "Artifact not cached locally" + remotes_message + reason = "missing-buildtree-artifact-not-cached" elif element._buildtree_exists(): message = "Buildtree is not cached locally" + remotes_message + reason = "missing-buildtree-artifact-buildtree-not-cached" else: message = "Artifact was created without buildtree" - raise StreamError(message) + reason = "missing-buildtree-artifact-created-without-buildtree" + raise StreamError(message, reason=reason) # Raise warning if the element is cached in a failed state if element._cached_failure(): diff --git a/src/buildstream/testing/__init__.py b/src/buildstream/testing/__init__.py index 19c19a64c..3474ded82 100644 --- a/src/buildstream/testing/__init__.py +++ b/src/buildstream/testing/__init__.py @@ -24,7 +24,7 @@ from collections import OrderedDict from buildstream.exceptions import ErrorDomain, LoadErrorReason from ._yaml import generate_project, generate_element, load_yaml from .repo import Repo -from .runcli import cli, cli_integration, cli_remote_execution +from .runcli import cli, cli_integration, cli_remote_execution, Cli from .integration import integration_cache from ._cachekeys import check_cache_key_stability diff --git a/src/buildstream/testing/runcli.py b/src/buildstream/testing/runcli.py index 7a69191ed..6a170a469 100644 --- a/src/buildstream/testing/runcli.py +++ b/src/buildstream/testing/runcli.py @@ -247,6 +247,8 @@ class Cli: self.verbose = verbose self.artifact = TestArtifact() + os.makedirs(directory) + if default_options is None: default_options = [] @@ -734,7 +736,6 @@ class TestArtifact: @pytest.fixture() def cli(tmpdir): directory = os.path.join(str(tmpdir), "cache") - os.makedirs(directory) return Cli(directory) @@ -747,8 +748,6 @@ def cli(tmpdir): @pytest.fixture() def cli_integration(tmpdir, integration_cache): directory = os.path.join(str(tmpdir), "cache") - os.makedirs(directory) - fixture = CliIntegration(directory) # We want to cache sources for integration tests more permanently, @@ -778,8 +777,6 @@ def cli_integration(tmpdir, integration_cache): @pytest.fixture() def cli_remote_execution(tmpdir, remote_services): directory = os.path.join(str(tmpdir), "cache") - os.makedirs(directory) - fixture = CliRemote(directory) artifacts = [] |