From 40b914503e2441c0f51de737e3901f8f546ccbce Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sun, 8 Aug 2021 12:42:45 -0700 Subject: concretizer: adjust integrity constraints to only apply to builds. Many of the integrity constraints in the concretizer are there to restrict how solves are done, but they ignore that past solves may have had different initial conditions. For example, for things we're building, we want the allowed variants to be restricted to those currently in Spack packages, but if we are reusing a concrete spec, we need to be flexible about names that may have existed in old packages. Similarly, restrictions around compatibility of OS's, compiler versions, compiler OS support, etc. are really only about what is supported by the *current* set of compilers/build tools known to Spack, not about what we may get from concrete specs. - [x] restrict certain integrity constraints to only apply to packages that we need to build, and omit concrete specs from consideration. --- lib/spack/spack/solver/concretize.lp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp index 782321a05f..efd364dd92 100644 --- a/lib/spack/spack/solver/concretize.lp +++ b/lib/spack/spack/solver/concretize.lp @@ -107,8 +107,7 @@ dependency_holds(Package, Dependency, Type) :- dependency_condition(ID, Package, Dependency), dependency_type(ID, Type), condition_holds(ID), - not external(Package), - not concrete(Package). + build(Package). % We cut off dependencies of externals (as we don't really know them). % Don't impose constraints on dependencies that don't exist. @@ -153,10 +152,10 @@ path(Parent, Descendant) :- path(Parent, A), depends_on(A, Descendant). % Conflicts %----------------------------------------------------------------------------- :- node(Package), - not external(Package), conflict(Package, TriggerID, ConstraintID), condition_holds(TriggerID), condition_holds(ConstraintID), + not external(Package), % ignore conflicts for externals error("A conflict was triggered"). #defined conflict/3. @@ -402,7 +401,11 @@ variant(Package, Variant) :- variant_condition(ID, Package, Variant), variant_set(Package, Variant) :- variant_set(Package, Variant, _). % A variant cannot have a value that is not also a possible value -:- variant_value(Package, Variant, Value), not variant_possible_value(Package, Variant, Value), +% This only applies to packages we need to build -- concrete packages may +% have been built w/different variants from older/different package versions. +:- variant_value(Package, Variant, Value), + not variant_possible_value(Package, Variant, Value), + build(Package), error("Variant set to invalid value"). % Some multi valued variants accept multiple values from disjoint sets. @@ -477,8 +480,11 @@ variant_default_value(Package, Variant, Value) :- variant_default_value_from_cli % Treat 'none' in a special way - it cannot be combined with other % values even if the variant is multi-valued -:- 2 {variant_value(Package, Variant, Value): variant_possible_value(Package, Variant, Value)}, +:- 2 { + variant_value(Package, Variant, Value) : variant_possible_value(Package, Variant, Value) + }, variant_value(Package, Variant, "none"), + build(Package), error("Variant value 'none' cannot be combined with any other value"). % patches and dev_path are special variants -- they don't have to be @@ -603,6 +609,7 @@ target_weight(Target, Package, Weight) not compiler_supports_target(Compiler, Version, Target), node_compiler(Package, Compiler), node_compiler_version(Package, Compiler, Version), + build(Package), error("No satisfying compiler available is compatible with a satisfying target"). % if a target is set explicitly, respect it @@ -673,6 +680,7 @@ node_compiler_version(Package, Compiler, Version) :- node_compiler_version_set(P :- node_compiler_version(Package, Compiler, Version), node_os(Package, OS), not compiler_supports_os(Compiler, Version, OS), not allow_compiler(Compiler, Version), + build(Package), error("No satisfying compiler available is compatible with a satisfying os"). % If a package and one of its dependencies don't have the @@ -891,4 +899,3 @@ opt_criterion(2, "target mismatches"). opt_criterion(1, "non-preferred targets"). #minimize{ 0@1: #true }. #minimize{ Weight@1,Package : node_target_weight(Package, Weight) }. - -- cgit v1.2.3-60-g2f50