Configure requirements for a package#27987
Conversation
…ition group members (this already appears to be the case)
…s (so I don't need to redefine individual constraints for version, compiler, etc.)
…ill be that multiple specs in a group can still match since the spec matching doesn't imply cfg_required (only the other way around)
|
At this point |
…ples you can test with 'spack -C'
…odo to ask about build_priority
|
This now
|
|
@becker33 this appears to be passing unit tests and I have mostly addressed #27987 (review) minus a couple issues I have questions about:
This still needs tests, but I wanted to make sure we agreed on the schema (now added with examples) and overall implementation first. |
See the explanation here: abda8a4 If reuse is enabled, build_priority is set to some number greater than the number of optimization criteria, and it gets added to the priority of each criterion for packages that will be built. So if a package is to be built, we prioritize its defaults higher than minimizing the total number of builds. If a package is being reused and it satisfies any other imposed constraints, we prefer to take it as-is than to force its variants, versions, etc. to be the preferred/default ones. For some intuition: if you don’t do this, and instead make minimizing total builds the absolute top priority, then if you have to build, say, CMake, then the solver will disable variants on the new CMake to reduce the total dependencies. E.g. it’ll give you a CMake without openssl and with other optional but still default features disabled. This is different than what a typical |
|
@alalazo I added scheibelp#21 here, added a test which reproduces #27987 (comment),
|
|
I don't think 1d733af makes sense (or at least, it doesn't seem like it should be necessary to enforce the constraints we want). The test should still be useful (I'll be using it to debug the issue with "one_of"). |
I agree. Concrete specs derive the |
|
These modifications should fix the unit-tests and take care of #27987 (comment) : scheibelp#23 |
Also switch requirements and deprecated versions priority
tgamblin
left a comment
There was a problem hiding this comment.
@scheibelp this looks great -- thanks!
| require: "@1.13.2" | ||
| openmpi: | ||
| require: | ||
| - any_of: ["~cuda", "gcc"] |
There was a problem hiding this comment.
| - any_of: ["~cuda", "gcc"] | |
| - any_of: ["~cuda", "%gcc"] |
|
I'm afraid one_of/any_of can be somewhat confusing. Maybe what's missing is some docs on how to combine one_of/any_of with unconditional requirements, like always use |
|
Close/reopen to restart docs build |
|
We should do a follow-on doc PR to address @haampie's concerns, but this LGTM. |
) Spack doesn't have an easy way to say something like "If I build package X, then I *need* version Y": * If you specify something on the command line, then you ensure that the constraints are applied, but the package is always built * Likewise if you `spack add X...`` to your environment, the constraints are guaranteed to hold, but the environment always builds the package * You can add preferences to packages.yaml, but these are not guaranteed to hold (Spack can choose other settings) This commit adds a 'require' subsection to packages.yaml: the specs added there are guaranteed to hold. The commit includes documentation for the feature. Co-authored-by: Massimiliano Culpo <[email protected]>
Spack doesn't have an easy way to say something like "If I build package X, then I
wantneed version Y":spack add X...to your environment, the constraints are guaranteed to hold, but the environment always builds the packagepackages.yaml, but these are not guaranteed (Spack can choose other settings)For example, you might want to specify that when you build
openmpi, that you build@4.0.1: you want to allow building with other specs, but always use@4.0.1if buildingopenmpi.This PR adds ASP rules (and logic to
asp.py) which can generate conditional constraints.My current guess is that it should be "consolidated" with(EDIT: this last part is now addressed)asp_spec_clauses(or rather, that function should be made more generic to support this case).(Update from Jan) The schema for expressing this is a new
packages.yamlsection:For any given
<package>subsection, you can now add arequiresubsection, where you can add demands for the spec. The details you add there must be respected by Spack (i.e. it will either match the spec there, or fail to concretize).TODOs:
packages.yaml(or some config file). (EDIT 1/7/22: that is now done)For now, since I'm experimenting with the ASP rules, I am manually generating what would be parsed from the config