Assign priorities to configuration scopes (#48420)

Currently, environments can end up with higher priority than `-C` custom
config scopes and `-c` command line arguments sometimes. This shouldn't
happen -- those explicit CLI scopes should override active environments.

Up to now configuration behaved like a stack, where scopes could be only be
pushed at the top. This PR allows to assign priorities to scopes, and ensures
that scopes of lower priorities are always "below" scopes of higher priorities.

When scopes have the same priority, what matters is the insertion order.

Modifications:
- [x] Add a mapping that iterates over keys according to priorities set when
      adding the key/value pair
- [x] Use that mapping to allow assigning priorities to configuration scopes
- [x] Assign different priorities for different kind of scopes, to fix a bug, and
      add a regression test
- [x] Simplify `Configuration` constructor
- [x] Remove `Configuration.pop_scope`
- [x] Remove `unify:false` from custom `-C` scope in pipelines

On the last modification: on `develop`, pipelines are relying on the environment
being able to override `-C` scopes, which is a bug. After this fix, we need to be
explicit about the unification strategy in each stack, and remove the blanket
`unify:false` from the highest priority scope

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
This commit is contained in:
Massimiliano Culpo
2025-02-25 09:58:16 +01:00
committed by GitHub
parent b79c01077d
commit 3ad99d75f9
29 changed files with 343 additions and 109 deletions

View File

@@ -1,3 +1,2 @@
concretizer:
reuse: false
unify: false

View File

@@ -1,5 +1,8 @@
spack:
view: false
concretizer:
unify: false
definitions:
- apps:
- gromacs

View File

@@ -1,5 +1,8 @@
spack:
view: false
concretizer:
unify: false
definitions:
- apps:
- gromacs %oneapi

View File

@@ -1,6 +1,9 @@
spack:
view: false
concretizer:
unify: false
packages:
all:
require: target=aarch64

View File

@@ -1,5 +1,7 @@
spack:
view: false
concretizer:
unify: false
packages:
all:

View File

@@ -1,5 +1,7 @@
spack:
view: false
concretizer:
unify: false
packages:
all:
require: target=x86_64_v3

View File

@@ -1,5 +1,7 @@
spack:
view: false
concretizer:
unify: false
packages:
all:

View File

@@ -1,5 +1,7 @@
spack:
view: false
concretizer:
unify: false
packages:
all:
require:

View File

@@ -1,5 +1,7 @@
spack:
view: false
concretizer:
unify: false
packages:
all:
require:

View File

@@ -1,5 +1,7 @@
spack:
view: false
concretizer:
unify: false
packages:
all:
require:

View File

@@ -1,5 +1,7 @@
spack:
view: false
concretizer:
unify: false
packages:
all:
require:

View File

@@ -1,5 +1,7 @@
spack:
view: false
concretizer:
unify: false
packages:
all:
require:

View File

@@ -1,5 +1,7 @@
spack:
view: false
concretizer:
unify: false
packages:
all:
providers:

View File

@@ -1,5 +1,7 @@
spack:
view: false
concretizer:
unify: false
packages:
all:
providers:

View File

@@ -1,5 +1,7 @@
spack:
view: false
concretizer:
unify: false
packages:
all:
require: target=x86_64_v3

View File

@@ -1,5 +1,7 @@
spack:
view: false
concretizer:
unify: false
packages:
all:
require: target=x86_64_v3

View File

@@ -5,6 +5,8 @@
spack:
view: false
concretizer:
unify: false
specs:
- vtk~mpi