concretizer: print out virtuals

This commit is contained in:
Todd Gamblin 2019-10-06 15:34:44 -07:00
parent 8a6207aa70
commit 3f93553a08
2 changed files with 12 additions and 2 deletions

View file

@ -678,7 +678,7 @@ def installed_upstream(self):
@classmethod
def possible_dependencies(
cls, transitive=True, expand_virtuals=True, deptype='all',
visited=None, missing=None):
visited=None, missing=None, virtuals=None):
"""Return dict of possible dependencies of this package.
Args:
@ -691,6 +691,7 @@ def possible_dependencies(
far, mapped to their immediate dependencies' names.
missing (dict, optional): dict to populate with packages and their
*missing* dependencies.
virtuals (set): if provided, populate with virtuals seen so far.
Returns:
(dict): dictionary mapping dependency names to *their*
@ -727,6 +728,8 @@ def possible_dependencies(
# expand virtuals if enabled, otherwise just stop at virtuals
if spack.repo.path.is_virtual(name):
if virtuals is not None:
virtuals.add(name)
if expand_virtuals:
providers = spack.repo.path.providers_for(name)
dep_names = [spec.name for spec in providers]
@ -759,7 +762,8 @@ def possible_dependencies(
continue
dep_cls.possible_dependencies(
transitive, expand_virtuals, deptype, visited, missing)
transitive, expand_virtuals, deptype, visited, missing,
virtuals)
return visited

View file

@ -346,6 +346,11 @@ def arch_defaults(self):
self.fact(fn.arch_os_default(default_arch.os))
self.fact(fn.arch_target_default(default_arch.target))
def virtual_providers(self, virtuals):
for vspec in virtuals:
providers = spack.repo.path.providers_for(vspec)
print("PROVIDE", providers, [type(t) for t in providers])
def generate_asp_program(self, specs):
"""Write an ASP program for specs.
@ -373,6 +378,7 @@ def generate_asp_program(self, specs):
self.h1('General Constraints')
self.compiler_defaults()
self.arch_defaults()
self.virtual_providers(virtuals)
self.h1('Package Constraints')
for pkg in pkgs: