summaryrefslogtreecommitdiff
path: root/lib/spack/docs
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2022-08-26 22:17:40 +0200
committerGitHub <noreply@github.com>2022-08-26 13:17:40 -0700
commit51244abee9f849c0ad6437f47f9b20da26671a49 (patch)
treee5d9fdf02359193a45b8d67ac74ea2e97d8e0127 /lib/spack/docs
parenteb1c9c158330be898381980d0100d66066637a25 (diff)
downloadspack-51244abee9f849c0ad6437f47f9b20da26671a49.tar.gz
spack-51244abee9f849c0ad6437f47f9b20da26671a49.tar.bz2
spack-51244abee9f849c0ad6437f47f9b20da26671a49.tar.xz
spack-51244abee9f849c0ad6437f47f9b20da26671a49.zip
Configuration: Allow requirements for virtual packages (#32369)
Extend the semantics of package requirements to allow using them also under a virtual package attribute in packages.yaml These requirements are enforced whenever that virtual spec is present in the DAG.
Diffstat (limited to 'lib/spack/docs')
-rw-r--r--lib/spack/docs/build_settings.rst42
1 files changed, 36 insertions, 6 deletions
diff --git a/lib/spack/docs/build_settings.rst b/lib/spack/docs/build_settings.rst
index 6438c0735e..654473de9c 100644
--- a/lib/spack/docs/build_settings.rst
+++ b/lib/spack/docs/build_settings.rst
@@ -396,6 +396,16 @@ choose between a set of options using ``any_of`` or ``one_of``:
``mpich`` already includes a conflict, so this is redundant but
still demonstrates the concept).
+.. note::
+
+ For ``any_of`` and ``one_of``, the order of specs indicates a
+ preference: items that appear earlier in the list are preferred
+ (note that these preferences can be ignored in favor of others).
+
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Setting default requirements
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
You can also set default requirements for all packages under ``all``
like this:
@@ -422,13 +432,33 @@ under ``all`` are disregarded. For example, with a configuration like this:
Spack requires ``cmake`` to use ``gcc`` and all other nodes (including cmake dependencies)
to use ``clang``.
-Other notes about ``requires``:
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Setting requirements on virtual specs
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+A requirement on a virtual spec applies whenever that virtual is present in the DAG. This
+can be useful for fixing which virtual provider you want to use:
+
+.. code-block:: yaml
+
+ packages:
+ mpi:
+ require: 'mvapich2 %gcc'
+
+With the configuration above the only allowed ``mpi`` provider is ``mvapich2 %gcc``.
+
+Requirements on the virtual spec and on the specific provider are both applied, if present. For
+instance with a configuration like:
+
+.. code-block:: yaml
+
+ packages:
+ mpi:
+ require: 'mvapich2 %gcc'
+ mvapich2:
+ require: '~cuda'
-* You cannot specify requirements for virtual packages (e.g. you can
- specify requirements for ``openmpi`` but not ``mpi``).
-* For ``any_of`` and ``one_of``, the order of specs indicates a
- preference: items that appear earlier in the list are preferred
- (note that these preferences can be ignored in favor of others).
+you will use ``mvapich2~cuda %gcc`` as an ``mpi`` provider.
.. _package_permissions: