asp.py: make %foo=bar in when condition strict#51923
Merged
Conversation
Signed-off-by: Harmen Stoppels <me@harmenstoppels.nl>
c83a35c to
eef95dd
Compare
Currently, `depends_on("x", when="%foo=bar")` triggers the dependency if
`foo` is provided by `bar` to *any* of its dependents, and the current
package just happens to depend on `bar` without depending on the
virtual.
That's causes concretization failure in `CMakePackage` on Windows, where
we want to express:
```python
depends_on("cmake@4.1:", when="%cxx,fortran=msvc", type="build")
```
Now, most packages don't depend on `fortran` but do have `msvc` as a
provider for `c` or `cxx`. If only one of their dependencies happens to
depend on `msvc` for `fortran` and the same or another for `cxx`, the
`when` condition would trigger.
With this commit, the when condition only triggers if the *current*
package depends on `msvc` for `cxx` and `fortran`.
Signed-off-by: Harmen Stoppels <me@harmenstoppels.nl>
eef95dd to
e75c168
Compare
Member
Author
|
Confirmed that this fixes the failure in spack/spack-packages#3259. |
Signed-off-by: Harmen Stoppels <me@harmenstoppels.nl>
Signed-off-by: Harmen Stoppels <me@harmenstoppels.nl>
5d1c0a5 to
42258d1
Compare
alalazo
approved these changes
Feb 9, 2026
Member
alalazo
left a comment
There was a problem hiding this comment.
LGTM. The performance is not impacted in general:
- Spack: 1.2.0.dev0 (b6f6969)
- Builtin repo: spack/spack-packages@ac1af39
- Python: 3.12.3
- Platform: linux-ubuntu24.04-broadwell
While reviewing this I found other small bugs, but they're also in `develop, so they can be dealt with separately.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently,
depends_on("x", when="%foo=bar")triggers the dependency iffoois provided bybarto any of its dependents, and the currentpackage just happens to depend on
barwithout depending on thevirtual.
That causes concretization failure in
CMakePackageon Windows, wherewe want to express:
Now, most packages don't depend on
fortranbut do havemsvcas aprovider for
corcxx. If only one of their dependencies happens todepend on
msvcforfortranand the same or another forcxx, thewhencondition would trigger.With this commit, the when condition only triggers if the current
package depends on
msvcforcxxandfortran.