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)
This commit is contained in:
Todd Gamblin 2021-11-03 01:29:10 -07:00
parent da57b8775f
commit 652fa663b5

View file

@ -434,20 +434,12 @@ variant_not_default(Package, Variant, Actual, 1)
not variant_value(Package, Variant, Value), not variant_value(Package, Variant, Value),
variant_default_value(Package, Variant, Value), variant_default_value(Package, Variant, Value),
Actual != Value, Actual != Value,
% variants set explicitly on the CLI don't count as non-default
not variant_set(Package, Variant, Actual), not variant_set(Package, Variant, Actual),
not external_with_variant_set(Package, Variant, Value), % variants set on externals that we could use don't count as non-default
node(Package). % this makes spack prefer to use an external over rebuilding with the
% default configuration
% We are using the default value for a variant not external_with_variant_set(Package, Variant, Actual),
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),
node(Package). node(Package).
% The variant is set in an external spec % The variant is set in an external spec
@ -458,11 +450,6 @@ external_with_variant_set(Package, Variant, Value)
external(Package), external(Package),
node(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: % The default value for a variant in a package is what is prescribed:
% %
% 1. On the command line % 1. On the command line
@ -864,20 +851,6 @@ opt_criterion(11, "preferred providers for roots").
build_priority(Provider, Priority) 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 % Try to use default variants or variants that have been set
opt_criterion(9, "number of non-default variants (non-roots)"). opt_criterion(9, "number of non-default variants (non-roots)").
#minimize{ 0@209: #true }. #minimize{ 0@209: #true }.