diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2023-11-27 12:41:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-27 12:41:16 +0100 |
commit | 343517e7947f92ebed8969237bef4c3b0718c793 (patch) | |
tree | 648829ce4f5fd6bc96c1040e9ef510ee21203ccc /lib/spack/docs/packages_yaml.rst | |
parent | 6fff0d4aededec355f9bc3966f2fa6af8f61e4b4 (diff) | |
download | spack-343517e7947f92ebed8969237bef4c3b0718c793.tar.gz spack-343517e7947f92ebed8969237bef4c3b0718c793.tar.bz2 spack-343517e7947f92ebed8969237bef4c3b0718c793.tar.xz spack-343517e7947f92ebed8969237bef4c3b0718c793.zip |
Improve semantic for packages:all:require (#41239)
An `all` requirement is emitted for a package if all variants referenced are defined by it. Otherwise, the constraint is rejected.
Diffstat (limited to 'lib/spack/docs/packages_yaml.rst')
-rw-r--r-- | lib/spack/docs/packages_yaml.rst | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/lib/spack/docs/packages_yaml.rst b/lib/spack/docs/packages_yaml.rst index e08f51e612..af0acf0f9a 100644 --- a/lib/spack/docs/packages_yaml.rst +++ b/lib/spack/docs/packages_yaml.rst @@ -383,7 +383,33 @@ like this: which means every spec will be required to use ``clang`` as a compiler. -Note that in this case ``all`` represents a *default set of requirements* - +Requirements on variants for all packages are possible too, but note that they +are only enforced for those packages that define these variants, otherwise they +are disregarded. For example: + +.. code-block:: yaml + + packages: + all: + require: + - "+shared" + - "+cuda" + +will just enforce ``+shared`` on ``zlib``, which has a boolean ``shared`` variant but +no ``cuda`` variant. + +Constraints in a single spec literal are always considered as a whole, so in a case like: + +.. code-block:: yaml + + packages: + all: + require: "+shared +cuda" + +the default requirement will be enforced only if a package has both a ``cuda`` and +a ``shared`` variant, and will never be partially enforced. + +Finally, ``all`` represents a *default set of requirements* - if there are specific package requirements, then the default requirements under ``all`` are disregarded. For example, with a configuration like this: @@ -391,12 +417,18 @@ under ``all`` are disregarded. For example, with a configuration like this: packages: all: - require: '%clang' + require: + - 'build_type=Debug' + - '%clang' cmake: - require: '%gcc' + require: + - 'build_type=Debug' + - '%gcc' Spack requires ``cmake`` to use ``gcc`` and all other nodes (including ``cmake`` -dependencies) to use ``clang``. +dependencies) to use ``clang``. If enforcing ``build_type=Debug`` is needed also +on ``cmake``, it must be repeated in the specific ``cmake`` requirements. + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Setting requirements on virtual specs |