diff options
-rw-r--r-- | lib/spack/spack/solver/asp.py | 18 | ||||
-rw-r--r-- | lib/spack/spack/variant.py | 5 |
2 files changed, 18 insertions, 5 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index fe72b777d6..74bdeb69a3 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -198,6 +198,11 @@ class AspGenerator(object): v for v in self.possible_versions[spec.name] if v.satisfies(spec.versions) ] + + # don't bother restricting anything if all versions are allowed + if len(allowed_versions) == len(self.possible_versions[spec.name]): + return [] + predicates = [fn.version(spec.name, v) for v in allowed_versions] # conflict with any versions that do not satisfy the spec @@ -288,9 +293,6 @@ class AspGenerator(object): """ clauses = [] - if spec.name: - clauses.append(fn.node(spec.name)) - clauses.extend(self.spec_versions(spec)) # seed architecture at the root (we'll propagate later) @@ -428,8 +430,14 @@ class ResultParser(object): def variant_value(self, pkg, name, value): pkg_class = spack.repo.path.get_pkg_class(pkg) - variant = pkg_class.variants[name].make_variant(value) - self._specs[pkg].variants[name] = variant + + variant = self._specs[pkg].variants.get(name) + if variant: + # it's multi-valued + variant.append(value) + else: + variant = pkg_class.variants[name].make_variant(value) + self._specs[pkg].variants[name] = variant def version(self, pkg, version): self._specs[pkg].versions = ver([version]) diff --git a/lib/spack/spack/variant.py b/lib/spack/spack/variant.py index 280f2346dd..e50c34a07d 100644 --- a/lib/spack/spack/variant.py +++ b/lib/spack/spack/variant.py @@ -389,6 +389,11 @@ class MultiValuedVariant(AbstractVariant): return super_sat and (all(v in self.value for v in other.value) or '*' in other or '*' in self) + def append(self, value): + """Add another value to this multi-valued variant.""" + self._value = tuple(sorted((value,) + self._value)) + self._original_value = ",".join(self._value) + class SingleValuedVariant(AbstractVariant): """A variant that can hold multiple values, but one at a time.""" |