summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2020-03-31 18:38:32 +0200
committerJürg Billeter <j@bitron.ch>2020-03-31 18:44:31 +0200
commitf3726a71f54c90d1605ec6522e24e0b1d3983d52 (patch)
treeaadda01e54c05fd2abd00bea73008a9c1686bbc2
parentceb38d1eadf724b980c9e523c57b44ff8ea6a320 (diff)
downloadbuildstream-juerg/buildbox-run-error.tar.gz
_sandboxbuildboxrun.py: Check for buildbox-run initialization errorsjuerg/buildbox-run-error
If `buildbox-run --capabilities` reports an error, we should consider the sandbox to be unavailable, forwarding the error message from buildbox-run.
-rw-r--r--src/buildstream/sandbox/_sandboxbuildboxrun.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/buildstream/sandbox/_sandboxbuildboxrun.py b/src/buildstream/sandbox/_sandboxbuildboxrun.py
index d0907a713..d3b9e4da6 100644
--- a/src/buildstream/sandbox/_sandboxbuildboxrun.py
+++ b/src/buildstream/sandbox/_sandboxbuildboxrun.py
@@ -47,13 +47,17 @@ class SandboxBuildBoxRun(SandboxREAPI):
cls._dummy_reasons += ["buildbox-run not found"]
raise SandboxError(" and ".join(cls._dummy_reasons), reason="unavailable-local-sandbox") from Error
- exit_code, output = utils._call([path, "--capabilities"], stdout=subprocess.PIPE)
+ exit_code, output = utils._call([path, "--capabilities"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if exit_code == 0:
# buildbox-run --capabilities prints one capability per line
cls._capabilities = set(output.split("\n"))
- else:
+ elif "Invalid option --capabilities" in output:
# buildbox-run is too old to support extra capabilities
cls._capabilities = set()
+ else:
+ # buildbox-run is not functional
+ cls._dummy_reasons += ["buildbox-run: {}".format(output)]
+ raise SandboxError(" and ".join(cls._dummy_reasons), reason="unavailable-local-sandbox")
@classmethod
def check_sandbox_config(cls, platform, config):