summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin.mock/packages/conditional-virtual-dependency/package.py
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2020-11-17 11:32:21 +0100
committerTodd Gamblin <tgamblin@llnl.gov>2020-11-17 10:04:13 -0800
commit7ffad278d34bcc1bda7d5d355e1104a10a7c484a (patch)
tree034d778058c0acde8f7e015e50683c51c90caf8c /var/spack/repos/builtin.mock/packages/conditional-virtual-dependency/package.py
parentca31f52be332bbfb8e8d5248218a81d9123c4ba2 (diff)
downloadspack-7ffad278d34bcc1bda7d5d355e1104a10a7c484a.tar.gz
spack-7ffad278d34bcc1bda7d5d355e1104a10a7c484a.tar.bz2
spack-7ffad278d34bcc1bda7d5d355e1104a10a7c484a.tar.xz
spack-7ffad278d34bcc1bda7d5d355e1104a10a7c484a.zip
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.
Diffstat (limited to 'var/spack/repos/builtin.mock/packages/conditional-virtual-dependency/package.py')
-rw-r--r--var/spack/repos/builtin.mock/packages/conditional-virtual-dependency/package.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/var/spack/repos/builtin.mock/packages/conditional-virtual-dependency/package.py b/var/spack/repos/builtin.mock/packages/conditional-virtual-dependency/package.py
new file mode 100644
index 0000000000..8cfbfa0c1a
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/conditional-virtual-dependency/package.py
@@ -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')