concretizer: modified weights for providers and matching for externals

This commit address the case of concretizing a root spec with a
transitive conditional dependency on a virtual package, provided
by an external. Before these modifications default variant values
for the dependency bringing in the virtual package were not
respected, and the external package providing the virtual was added
to the DAG.

The issue stems from two facts:
- Selecting a provider has higher precedence than selecting default variants
- To ensure that an external is preferred, we used a negative weight

To solve it we shift all the providers weight so that:
- External providers have a weight of 0
- Non external provider have a weight of 10 or more

Using a weight of zero for external providers is such that having
an external provider, if present, or not having a provider at all
has the same effect on the higher priority minimization.

Also fixed a few minor bugs in concretize.lp, that were causing
spurious entries in the final answer set.

Cleaned concretize.lp from leftover rules.
This commit is contained in:
Massimiliano Culpo
2020-11-17 11:32:21 +01:00
committed by Todd Gamblin
parent ca31f52be3
commit 7ffad278d3
6 changed files with 56 additions and 35 deletions

View File

@@ -0,0 +1,15 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class ConditionalVirtualDependency(Package):
"""Brings in a virtual dependency if certain conditions are met."""
homepage = "https://dev.null"
version('1.0')
variant('stuff', default=True, description='nope')
variant('mpi', default=False, description='nope')
depends_on('stuff', when='+stuff')
depends_on('mpi', when='+mpi')

View File

@@ -0,0 +1,12 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class TransitiveConditionalVirtualDependency(Package):
"""Depends on a package with a conditional virtual dependency."""
homepage = "https://dev.null"
has_code = False
phases = []
version('1.0')
depends_on('conditional-virtual-dependency')