variant: allow for conditional booleans#32492
variant: allow for conditional booleans#32492skosukhin wants to merge 1 commit intospack:developfrom
Conversation
There was a problem hiding this comment.
The documentation on conditional variants says:
The variant directive accepts a when clause. The variant will only be present on specs that otherwise satisfy the spec listed as the when clause
so if spec.satisfies("~clang") the z3 variant doesn't exist. That explains the:
Now, what about
llvm~clang ~z3? As a user, I would expect it to be possible [ ... ]
If a boolean variant can take a single value under certain conditions, I think it is more appropriate to either remove the variant like done in llvm (to not clutter the spec) or use conflicts.
|
@alalazo thanks. I'm closing this then. I just noticed the trend to avoid conflicts whenever possible. However, the suggested modification hardly implies less work for the concretizer than just a simple conflict. |
|
@alalazo there is still something wrong, which annoyed me in the first place but I failed to describe it properly. I would expect the following two commands to produce similar error messages but that is not the case: $ spack spec llvm~clang~z3
==> Error: Cannot set variant 'z3' for package 'llvm' because the variant condition cannot be satisfied for the given spec
$ spack spec llvm~clang~z3~lldb
==> Error: 'llvm' required multiple values for single-valued variant 'clang'
Requested '~clang' and '+clang'The second one is rather misleading. But that's another story, I guess. |
Currently, we have the following in the
llvmpackage:spack/var/spack/repos/builtin/packages/llvm/package.py
Lines 210 to 212 in 8038991
What it means is that we can't have
llvm~clang+z3:Good. Now, what about
llvm~clang~z3? As a user, I would expect it to be possible but it is not:With the modifications from this PR, it is possible to declare the
z3variant differently:And it looks like we can have the expected behaviour. We still get an error for
llvm~clang+z3(with a different message though):And we can also explicitly disable
z3:@alalazo