summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorscheibelp <scheibel1@llnl.gov>2017-11-01 18:44:31 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2017-11-01 18:44:31 -0700
commit60a485591c48e534f28ebe55c92f18834c4ca819 (patch)
tree83edac8204fbf0efea7ca078043577251f94718d /lib
parent7d0c6361ee05c25e67c72a39ce5b4a293a6ae91d (diff)
downloadspack-60a485591c48e534f28ebe55c92f18834c4ca819.tar.gz
spack-60a485591c48e534f28ebe55c92f18834c4ca819.tar.bz2
spack-60a485591c48e534f28ebe55c92f18834c4ca819.tar.xz
spack-60a485591c48e534f28ebe55c92f18834c4ca819.zip
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')
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/spec.py5
-rw-r--r--lib/spack/spack/variant.py3
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 2d097bc739..0752908a38 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -2225,7 +2225,10 @@ class Spec(object):
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)
diff --git a/lib/spack/spack/variant.py b/lib/spack/spack/variant.py
index 4553bf53e4..dc47b5a65f 100644
--- a/lib/spack/spack/variant.py
+++ b/lib/spack/spack/variant.py
@@ -31,6 +31,7 @@ import inspect
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)