summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/solver/asp.py6
-rw-r--r--lib/spack/spack/solver/concretize.lp6
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py
index 4975bcd452..f23fe351cd 100644
--- a/lib/spack/spack/solver/asp.py
+++ b/lib/spack/spack/solver/asp.py
@@ -366,10 +366,7 @@ class AspGenerator(object):
clauses.append(f.node_compiler_version(
spec.name, spec.compiler.name, spec.compiler.version))
-# if spec.dependencies:
-
# TODO
- # dependencies
# external_path
# external_module
# compiler_flags
@@ -404,7 +401,8 @@ class AspGenerator(object):
for vspec in virtuals:
self.fact(fn.virtual(vspec))
for provider in spack.repo.path.providers_for(vspec):
- self.fact(fn.provides_virtual(provider, vspec))
+ # TODO: handle versioned virtuals
+ self.fact(fn.provides_virtual(provider.name, vspec))
def generate_asp_program(self, specs):
"""Write an ASP program for specs.
diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp
index 006a5e39ed..041ea76e31 100644
--- a/lib/spack/spack/solver/concretize.lp
+++ b/lib/spack/spack/solver/concretize.lp
@@ -24,6 +24,12 @@ depends_on(P, D) :- declared_dependency(P, D), not virtual(D), node(P).
1 { depends_on(P, Q) : provides_virtual(Q, V) } 1
:- declared_dependency(P, V), virtual(V), node(P).
+% for any virtual, there can only be one node providing it in the DAG
+provider(P, V) :- node(P), provides_virtual(P, V).
+1 { provider(P, V) : node(P) } 1 :- virtual(V).
+
+% all nodes must be reachable from some root
+% TODO: this doesn't seem to be working yet
needed(D) :- depends_on(_, D), node(D).
needed(P) :- root(P).
:- node(P), not needed(P).