Skip to content

Introduce variant dependency

Dominic Kempf requested to merge feature/variant-dependencies into master

The previous approach had the big downside of bypassing the specified variants through the specified dependencies of variants. E.g. dune+pdelab~functions would silently ignore the ~functions aspect, because +pdelab enforces the installation of dune-functions. This introduces even more subtle bugs as more Dune modules are added to the package as any Dune-module-dependent logic in the package needs to be duplicated for each Dune module that depends on the module that originally introduced that logic (yuck!).

There is no direct mechanism in Spack to specify such dependencies in a way that enforces the correct variants on dependent modules. I have now added conflicts between variants that reflect the Dune module dependencies. In that case dune+pdelab~functions would throw an error.

This comes at the cost that a command such as

spack install dune+pdelab

is not possible anymore. Instead the user needs to specify the dependent modules as well:

spack install dune+pdelab+functions+typetree

Note that in order to remove some burden from users, I removed the variants for the core modules - they are always installed.

Merge request reports