summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJonathon Anderson <17242663+blue42u@users.noreply.github.com>2023-08-09 02:46:59 -0500
committerGitHub <noreply@github.com>2023-08-09 09:46:59 +0200
commit9aa3b4619b867e195ba74b0da6ed1db0039c331d (patch)
treeaec2c4750b4c47dfd2e1cb32ebc39a837dad0999 /lib
parent3d733da70a0b7d2749378eecf8ff882bd9b9f8e3 (diff)
downloadspack-9aa3b4619b867e195ba74b0da6ed1db0039c331d.tar.gz
spack-9aa3b4619b867e195ba74b0da6ed1db0039c331d.tar.bz2
spack-9aa3b4619b867e195ba74b0da6ed1db0039c331d.tar.xz
spack-9aa3b4619b867e195ba74b0da6ed1db0039c331d.zip
containerize: ensure bootstrap images contain all system dependencies (#36818)
This also makes `spack bootstrap status` exit 1 if some dependency is missing
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/docs/bootstrapping.rst9
-rw-r--r--lib/spack/spack/cmd/bootstrap.py2
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/spack/docs/bootstrapping.rst b/lib/spack/docs/bootstrapping.rst
index dec548e9c6..8eca492413 100644
--- a/lib/spack/docs/bootstrapping.rst
+++ b/lib/spack/docs/bootstrapping.rst
@@ -32,9 +32,14 @@ can't be found. You can readily check if any prerequisite for using Spack is mis
Spack will take care of bootstrapping any missing dependency marked as [B]. Dependencies marked as [-] are instead required to be found on the system.
+ % echo $?
+ 1
+
In the case of the output shown above Spack detected that both ``clingo`` and ``gnupg``
are missing and it's giving detailed information on why they are needed and whether
-they can be bootstrapped. Running a command that concretize a spec, like:
+they can be bootstrapped. The return code of this command summarizes the results, if any
+dependencies are missing the return code is ``1``, otherwise ``0``. Running a command that
+concretizes a spec, like:
.. code-block:: console
@@ -44,7 +49,7 @@ they can be bootstrapped. Running a command that concretize a spec, like:
==> Installing "clingo-bootstrap@spack%apple-clang@12.0.0~docs~ipo+python build_type=Release arch=darwin-catalina-x86_64" from a buildcache
[ ... ]
-triggers the bootstrapping of clingo from pre-built binaries as expected.
+automatically triggers the bootstrapping of clingo from pre-built binaries as expected.
Users can also bootstrap all the dependencies needed by Spack in a single command, which
might be useful to setup containers or other similar environments:
diff --git a/lib/spack/spack/cmd/bootstrap.py b/lib/spack/spack/cmd/bootstrap.py
index be2e64dbce..672d152565 100644
--- a/lib/spack/spack/cmd/bootstrap.py
+++ b/lib/spack/spack/cmd/bootstrap.py
@@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os.path
import shutil
+import sys
import tempfile
import llnl.util.filesystem
@@ -326,6 +327,7 @@ def _status(args):
if missing:
print(llnl.util.tty.color.colorize(legend))
print()
+ sys.exit(1)
def _add(args):