summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2021-11-03 01:29:10 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2021-11-05 00:15:47 -0700
commit652fa663b56971e36dd72dcbc2a1efc9782e0e2b (patch)
treec4fef83274887af173ddc8fb861f3d6915a438f4
parentda57b8775f61e51c986a1d25ed18a55efdb01337 (diff)
downloadspack-652fa663b56971e36dd72dcbc2a1efc9782e0e2b.tar.gz
spack-652fa663b56971e36dd72dcbc2a1efc9782e0e2b.tar.bz2
spack-652fa663b56971e36dd72dcbc2a1efc9782e0e2b.tar.xz
spack-652fa663b56971e36dd72dcbc2a1efc9782e0e2b.zip
concretizer: get rid of last maximize directive in concretize.lp
- [x] Get rid of forgotten maximize directive. - [x] Simplify variant handling - [x] Fix bug in treatment of defaults on externals (don't count non-default variants on externals against them)
-rw-r--r--lib/spack/spack/solver/concretize.lp37
1 files changed, 5 insertions, 32 deletions
diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp
index da404710a4..e96094a4e7 100644
--- a/lib/spack/spack/solver/concretize.lp
+++ b/lib/spack/spack/solver/concretize.lp
@@ -434,20 +434,12 @@ variant_not_default(Package, Variant, Actual, 1)
not variant_value(Package, Variant, Value),
variant_default_value(Package, Variant, Value),
Actual != Value,
+ % variants set explicitly on the CLI don't count as non-default
not variant_set(Package, Variant, Actual),
- not external_with_variant_set(Package, Variant, Value),
- node(Package).
-
-% We are using the default value for a variant
-variant_not_default(Package, Variant, Value, 0)
- :- variant_value(Package, Variant, Value),
- variant_default_value(Package, Variant, Value),
- node(Package).
-
-% The variant is set in the spec
-variant_not_default(Package, Variant, Value, 0)
- :- variant_value(Package, Variant, Value),
- variant_set(Package, Variant, Value),
+ % variants set on externals that we could use don't count as non-default
+ % this makes spack prefer to use an external over rebuilding with the
+ % default configuration
+ not external_with_variant_set(Package, Variant, Actual),
node(Package).
% The variant is set in an external spec
@@ -458,11 +450,6 @@ external_with_variant_set(Package, Variant, Value)
external(Package),
node(Package).
-variant_not_default(Package, Variant, Value, 0)
- :- variant_value(Package, Variant, Value),
- external_with_variant_set(Package, Variant, Value),
- node(Package).
-
% The default value for a variant in a package is what is prescribed:
%
% 1. On the command line
@@ -864,20 +851,6 @@ opt_criterion(11, "preferred providers for roots").
build_priority(Provider, Priority)
}.
-% If the value is a multivalued variant there could be multiple
-% values set as default. Since a default value has a weight of 0 we
-% need to maximize their number below to ensure they're all set
-opt_criterion(10, "number of values in multi-valued variants (root)").
-#minimize{ 0@210 : #true }.
-#minimize{ 0@10 : #true }.
-#maximize {
- 1@10+Priority,Package,Variant,Value
- : variant_not_default(Package, Variant, Value, Weight),
- not variant_single_value(Package, Variant),
- root(Package),
- build_priority(Package, Priority)
-}.
-
% Try to use default variants or variants that have been set
opt_criterion(9, "number of non-default variants (non-roots)").
#minimize{ 0@209: #true }.