diff options
author | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2019-08-14 08:08:35 +0100 |
---|---|---|
committer | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2019-08-14 08:08:35 +0100 |
commit | 2a47d489575136c8dd12e99c2266f3459ba77a52 (patch) | |
tree | d2a861ecb7e749adbc25172c4a164566bc543fc8 /src/buildstream/sandbox | |
parent | 18fe6a4b01e7abe4fa49a49d4c8ce481a3c1d09e (diff) | |
download | buildstream-2a47d489575136c8dd12e99c2266f3459ba77a52.tar.gz |
sandbox/_sandbox*.py: Ensure missing-command is a SandboxCommandError
So that, should a sandbox be missing a command such as `sh`, we cache
failures to build, ensure that each sandbox which checks for the command
raises SandboxCommandError instead of SandboxError.
Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
Diffstat (limited to 'src/buildstream/sandbox')
-rw-r--r-- | src/buildstream/sandbox/_sandboxbuildbox.py | 8 | ||||
-rw-r--r-- | src/buildstream/sandbox/_sandboxbwrap.py | 8 | ||||
-rw-r--r-- | src/buildstream/sandbox/_sandboxchroot.py | 8 | ||||
-rw-r--r-- | src/buildstream/sandbox/_sandboxdummy.py | 8 |
4 files changed, 16 insertions, 16 deletions
diff --git a/src/buildstream/sandbox/_sandboxbuildbox.py b/src/buildstream/sandbox/_sandboxbuildbox.py index 417d2224d..99c7322a3 100644 --- a/src/buildstream/sandbox/_sandboxbuildbox.py +++ b/src/buildstream/sandbox/_sandboxbuildbox.py @@ -23,7 +23,7 @@ from contextlib import ExitStack import psutil from .. import utils, _signals, ProgramNotFoundError -from . import Sandbox, SandboxFlags +from . import Sandbox, SandboxFlags, SandboxCommandError from .._protos.build.bazel.remote.execution.v2 import remote_execution_pb2 from ..storage._casbaseddirectory import CasBasedDirectory from .._exceptions import SandboxError @@ -73,9 +73,9 @@ class SandboxBuildBox(Sandbox): scratch_directory = self._get_scratch_directory() if not self._has_command(command[0], env): - raise SandboxError("Staged artifacts do not provide command " - "'{}'".format(command[0]), - reason='missing-command') + raise SandboxCommandError("Staged artifacts do not provide command " + "'{}'".format(command[0]), + reason='missing-command') # Grab the full path of the buildbox binary try: diff --git a/src/buildstream/sandbox/_sandboxbwrap.py b/src/buildstream/sandbox/_sandboxbwrap.py index 81e9f34de..d8541354c 100644 --- a/src/buildstream/sandbox/_sandboxbwrap.py +++ b/src/buildstream/sandbox/_sandboxbwrap.py @@ -36,7 +36,7 @@ import psutil from .._exceptions import SandboxError from .. import utils, _signals -from . import Sandbox, SandboxFlags +from . import Sandbox, SandboxFlags, SandboxCommandError from .. import _site @@ -142,9 +142,9 @@ class SandboxBwrap(Sandbox): root_directory = self.get_virtual_directory()._get_underlying_directory() if not self._has_command(command[0], env): - raise SandboxError("Staged artifacts do not provide command " - "'{}'".format(command[0]), - reason='missing-command') + raise SandboxCommandError("Staged artifacts do not provide command " + "'{}'".format(command[0]), + reason='missing-command') # NOTE: MountMap transitively imports `_fuse/fuse.py` which raises an # EnvironmentError when fuse is not found. Since this module is diff --git a/src/buildstream/sandbox/_sandboxchroot.py b/src/buildstream/sandbox/_sandboxchroot.py index 084ed5b6c..eb8f53308 100644 --- a/src/buildstream/sandbox/_sandboxchroot.py +++ b/src/buildstream/sandbox/_sandboxchroot.py @@ -31,7 +31,7 @@ from .. import utils from .. import _signals from ._mounter import Mounter from ._mount import MountMap -from . import Sandbox, SandboxFlags +from . import Sandbox, SandboxFlags, SandboxCommandError class SandboxChroot(Sandbox): @@ -78,9 +78,9 @@ class SandboxChroot(Sandbox): def _run(self, command, flags, *, cwd, env): if not self._has_command(command[0], env): - raise SandboxError("Staged artifacts do not provide command " - "'{}'".format(command[0]), - reason='missing-command') + raise SandboxCommandError("Staged artifacts do not provide command " + "'{}'".format(command[0]), + reason='missing-command') stdout, stderr = self._get_output() diff --git a/src/buildstream/sandbox/_sandboxdummy.py b/src/buildstream/sandbox/_sandboxdummy.py index 750ddb05d..ae3d5e512 100644 --- a/src/buildstream/sandbox/_sandboxdummy.py +++ b/src/buildstream/sandbox/_sandboxdummy.py @@ -17,7 +17,7 @@ # Authors: from .._exceptions import SandboxError -from .sandbox import Sandbox +from .sandbox import Sandbox, SandboxCommandError class SandboxDummy(Sandbox): @@ -28,9 +28,9 @@ class SandboxDummy(Sandbox): def _run(self, command, flags, *, cwd, env): if not self._has_command(command[0], env): - raise SandboxError("Staged artifacts do not provide command " - "'{}'".format(command[0]), - reason='missing-command') + raise SandboxCommandError("Staged artifacts do not provide command " + "'{}'".format(command[0]), + reason='missing-command') raise SandboxError("This platform does not support local builds: {}".format(self._reason), reason="unavailable-local-sandbox") |