Fix user specs which include already-installed packages (#5939)
* when a user-provided spec refers to an already-installed package, packages with patches applied were causing validation errors based on the recorded variants in the package's class * avoid checks on all reserved variants (not just 'patches')
This commit is contained in:
parent
7d0c6361ee
commit
60a485591c
@ -2225,7 +2225,10 @@ def validate_or_raise(self):
|
||||
if not spec.virtual:
|
||||
pkg_cls = spec.package_class
|
||||
pkg_variants = pkg_cls.variants
|
||||
not_existing = set(spec.variants) - set(pkg_variants)
|
||||
# reserved names are variants that may be set on any package
|
||||
# but are not necessarily recorded by the package's class
|
||||
not_existing = set(spec.variants) - (
|
||||
set(pkg_variants) | set(spack.directives.reserved_names))
|
||||
if not_existing:
|
||||
raise UnknownVariantError(spec.name, not_existing)
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
import re
|
||||
|
||||
import llnl.util.lang as lang
|
||||
import spack
|
||||
import spack.error as error
|
||||
from six import StringIO
|
||||
|
||||
@ -592,6 +593,8 @@ def substitute_abstract_variants(spec):
|
||||
spec: spec on which to operate the substitution
|
||||
"""
|
||||
for name, v in spec.variants.items():
|
||||
if name in spack.directives.reserved_names:
|
||||
continue
|
||||
pkg_variant = spec.package_class.variants[name]
|
||||
new_variant = pkg_variant.make_variant(v._original_value)
|
||||
pkg_variant.validate_or_raise(new_variant, spec.package_class)
|
||||
|
Loading…
Reference in New Issue
Block a user