Skip to content

Comments

asp.py: make %foo=bar in when condition strict#51923

Merged
alalazo merged 4 commits intodevelopfrom
hs/fix/direct-dep-concretization-struggles
Feb 9, 2026
Merged

asp.py: make %foo=bar in when condition strict#51923
alalazo merged 4 commits intodevelopfrom
hs/fix/direct-dep-concretization-struggles

Conversation

@haampie
Copy link
Member

@haampie haampie commented Feb 6, 2026

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 causes concretization failure in CMakePackage on Windows, where
we want to express:

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>
@haampie haampie force-pushed the hs/fix/direct-dep-concretization-struggles branch from c83a35c to eef95dd Compare February 6, 2026 16:01
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>
@haampie
Copy link
Member Author

haampie commented Feb 6, 2026

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>
@haampie haampie force-pushed the hs/fix/direct-dep-concretization-struggles branch from 5d1c0a5 to 42258d1 Compare February 7, 2026 08:58
@alalazo alalazo self-assigned this Feb 9, 2026
Copy link
Member

@alalazo alalazo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The performance is not impacted in general:

Image

While reviewing this I found other small bugs, but they're also in `develop, so they can be dealt with separately.

@alalazo alalazo merged commit b1da499 into develop Feb 9, 2026
78 of 88 checks passed
@alalazo alalazo deleted the hs/fix/direct-dep-concretization-struggles branch February 9, 2026 08:32
@haampie haampie added the v1.1.2 label Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants