summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2021-11-03 22:20:39 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2021-11-05 00:15:47 -0700
commita4a2ed3c34aeb2bdb246a309fb108ee5f0d8edf3 (patch)
treeb6e4af8d44c5e2cd9671c808937dc7d08ffb156d /lib
parent49ed41b028596d2314c219d174e533f8142ad6e4 (diff)
downloadspack-a4a2ed3c34aeb2bdb246a309fb108ee5f0d8edf3.tar.gz
spack-a4a2ed3c34aeb2bdb246a309fb108ee5f0d8edf3.tar.bz2
spack-a4a2ed3c34aeb2bdb246a309fb108ee5f0d8edf3.tar.xz
spack-a4a2ed3c34aeb2bdb246a309fb108ee5f0d8edf3.zip
concretizer: exempt already-installed specs from compiler and variant rules
Concrete specs that are already installed or that come from a buildcache may have compilers and variant settings that we do not recognize, but that shouldn't prevent reuse (at least not until we have a more detailed compiler model). - [x] make sure compiler and variant consistency rules only apply to built specs - [x] don't validate concrete specs on input, either -- they're concrete and we shouldn't apply today's rules to yesterday's build
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/solver/asp.py4
-rw-r--r--lib/spack/spack/solver/concretize.lp25
2 files changed, 22 insertions, 7 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py
index 1e604ed406..cd342f1f4e 100644
--- a/lib/spack/spack/solver/asp.py
+++ b/lib/spack/spack/solver/asp.py
@@ -1423,6 +1423,10 @@ class SpackSolverSetup(object):
strict = spack.concretize.Concretizer().check_for_compiler_existence
for spec in specs:
for s in spec.traverse():
+ # we don't need to validate compilers for already-built specs
+ if s.concrete:
+ continue
+
if not s.compiler or not s.compiler.concrete:
continue
diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp
index 9483de2136..1ccea5c5ca 100644
--- a/lib/spack/spack/solver/concretize.lp
+++ b/lib/spack/spack/solver/concretize.lp
@@ -372,10 +372,13 @@ variant(Package, Variant) :- variant_condition(ID, Package, Variant),
% a variant cannot be set if it is not a variant on the package
:- variant_set(Package, Variant),
not variant(Package, Variant),
+ build(Package),
error("Unsatisfied conditional variants cannot be set").
% a variant cannot take on a value if it is not a variant of the package
-:- variant_value(Package, Variant, _), not variant(Package, Variant),
+:- variant_value(Package, Variant, _),
+ not variant(Package, Variant),
+ build(Package),
error("Unsatisfied conditional variants cannot take on a variant value").
% one variant value for single-valued variants.
@@ -386,6 +389,7 @@ variant(Package, Variant) :- variant_condition(ID, Package, Variant),
:- node(Package),
variant(Package, Variant),
variant_single_value(Package, Variant),
+ build(Package),
error("Single valued variants must have a single value").
% at least one variant value for multi-valued variants.
@@ -396,6 +400,7 @@ variant(Package, Variant) :- variant_condition(ID, Package, Variant),
:- node(Package),
variant(Package, Variant),
not variant_single_value(Package, Variant),
+ build(Package),
error("Internal error: All variants must have a value").
% if a variant is set to anything, it is considered 'set'.
@@ -417,6 +422,7 @@ variant_set(Package, Variant) :- variant_set(Package, Variant, _).
variant_value_from_disjoint_sets(Package, Variant, Value1, Set1),
variant_value_from_disjoint_sets(Package, Variant, Value2, Set2),
Set1 != Set2,
+ build(Package),
error("Variant values selected from multiple disjoint sets").
% variant_set is an explicitly set variant value. If it's not 'set',
@@ -640,10 +646,12 @@ node_target_mismatch(Parent, Dependency)
%-----------------------------------------------------------------------------
compiler(Compiler) :- compiler_version(Compiler, _).
-% There must be only one compiler set per node. The compiler
+% There must be only one compiler set per built node. The compiler
% is chosen among available versions.
-1 { node_compiler_version(Package, Compiler, Version)
- : compiler_version(Compiler, Version) } 1 :- node(Package), error("Each node must have exactly one compiler").
+1 { node_compiler_version(Package, Compiler, Version) : compiler_version(Compiler, Version) } 1 :-
+ node(Package),
+ build(Package),
+ error("Each node must have exactly one compiler").
% Sometimes we just need to know the compiler and not the version
node_compiler(Package, Compiler) :- node_compiler_version(Package, Compiler, _).
@@ -658,11 +666,14 @@ node_compiler(Package, Compiler) :- node_compiler_version(Package, Compiler, _).
% version_satisfies implies that exactly one of the satisfying versions
% is the package's version, and vice versa.
1 { node_compiler_version(Package, Compiler, Version)
- : node_compiler_version_satisfies(Package, Compiler, Constraint, Version) } 1
- :- node_compiler_version_satisfies(Package, Compiler, Constraint), error("Internal error: node compiler version mismatch").
+ : node_compiler_version_satisfies(Package, Compiler, Constraint, Version) } 1 :-
+ node_compiler_version_satisfies(Package, Compiler, Constraint),
+ error("Internal error: node compiler version mismatch").
+
node_compiler_version_satisfies(Package, Compiler, Constraint)
:- node_compiler_version(Package, Compiler, Version),
- node_compiler_version_satisfies(Package, Compiler, Constraint, Version).
+ node_compiler_version_satisfies(Package, Compiler, Constraint, Version),
+ build(Package).
#defined node_compiler_version_satisfies/4.