Add syntactic sugar for "strong preferences" and "conflicts" (#41832)

Currently requirements allow to express "strong preferences" and "conflicts" from
configuration using a convoluted syntax:
```yaml
packages:
  zlib-ng:
    require:
    # conflict on %clang
    - one_of: ["%clang", "@:"]
    # Strong preference for +shared
    - any_of: ["+shared", "@:"]
```
This PR adds syntactic sugar so that the same can be written as:
```yaml
packages:
  zlib-ng:
    conflict:
    - "%clang"
    prefer:
    - "+shared"
```
Preferences written in this way are "stronger" that the ones documented at:
- https://spack.readthedocs.io/en/latest/packages_yaml.html#package-preferences
This commit is contained in:
Massimiliano Culpo
2024-01-22 22:18:00 +01:00
committed by GitHub
parent ed9d495915
commit 66813460c0
6 changed files with 358 additions and 115 deletions

View File

@@ -10,8 +10,8 @@ spack:
packages:
all:
require:
- any_of: ["%cce", "@:"] # cce as a strong preference; not all packages support it
prefer:
- "%cce"
compiler: [cce]
providers:
blas: [cray-libsci]

View File

@@ -8,8 +8,9 @@ spack:
packages:
all:
require:
- any_of: ["%oneapi", "@:"] # oneapi as a strong preference; not all packages support it
- "target=x86_64_v3"
prefer:
- "%oneapi"
providers:
blas: [openblas]
mpi: [mpich]