summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2021-11-04 17:20:43 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2021-11-05 00:15:47 -0700
commitac1e05fe1b06a7ccef621626effd66c957241cdf (patch)
tree7f1e8c86612fa149fadf34ca598f31a826a246d7 /lib
parent0186f0f955535deaf0f87ac21322d51fef8628ea (diff)
downloadspack-ac1e05fe1b06a7ccef621626effd66c957241cdf.tar.gz
spack-ac1e05fe1b06a7ccef621626effd66c957241cdf.tar.bz2
spack-ac1e05fe1b06a7ccef621626effd66c957241cdf.tar.xz
spack-ac1e05fe1b06a7ccef621626effd66c957241cdf.zip
concretizer: add error messages and simplify asp.py
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/solver/asp.py13
-rw-r--r--lib/spack/spack/solver/concretize.lp13
2 files changed, 18 insertions, 8 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py
index b7733defb6..4a8a3fbbc5 100644
--- a/lib/spack/spack/solver/asp.py
+++ b/lib/spack/spack/solver/asp.py
@@ -1302,11 +1302,13 @@ class SpackSolverSetup(object):
platform = spack.platforms.host()
# create set of OS's to consider
- buildable = set([
- platform.front_os, platform.back_os, platform.default_os])
+ buildable = set(platform.operating_sys.keys())
+
+ # Consider any OS's mentioned on the command line. We need this to
+ # cross-concretize in CI, and for some tests.
+ # TODO: OS should really be more than just a label -- rework this.
for spec in specs:
if spec.architecture and spec.architecture.os:
- # TODO: does this make sense?
buildable.add(spec.architecture.os)
# make directives for buildable OS's
@@ -1585,7 +1587,8 @@ class SpackSolverSetup(object):
self.gen.newline()
# add OS to possible OS's
- self.possible_oses.add(spec.os)
+ for dep in spec.traverse():
+ self.possible_oses.add(dep.os)
# add the hash to the one seen so far
self.seen_hashes.add(h)
@@ -1764,6 +1767,8 @@ class SpecBuilder(object):
assert concrete_spec, "Unable to look up concrete spec with hash %s" % h
self._specs[pkg] = concrete_spec
else:
+ # TODO: remove this code -- it's dead unless we decide that node() clauses
+ # should come before hashes.
# ensure that if it's already there, it's correct
spec = self._specs[pkg]
assert spec.dag_hash() == h
diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp
index ad92cd1e62..99ab8a0e00 100644
--- a/lib/spack/spack/solver/concretize.lp
+++ b/lib/spack/spack/solver/concretize.lp
@@ -541,17 +541,20 @@ node_platform_set(Package) :- node_platform_set(Package, _).
os(OS) :- os(OS, _).
% one os per node
-1 { node_os(Package, OS) : os(OS) } 1 :- node(Package), error("Each node must have exactly one OS").
+1 { node_os(Package, OS) : os(OS) } 1 :-
+ node(Package), error("Each node must have exactly one OS").
% can't have a non-buildable OS on a node we need to build
-:- build(Package), node_os(Package, OS), not buildable_os(OS).
+:- build(Package), node_os(Package, OS), not buildable_os(OS),
+ error("No available OS can be built for").
% can't have dependencies on incompatible OS's
:- depends_on(Package, Dependency),
node_os(Package, PackageOS),
node_os(Dependency, DependencyOS),
not os_compatible(PackageOS, DependencyOS),
- build(Package).
+ build(Package),
+ error("Dependencies must have compatible OS's with their dependents").
% give OS choice weights according to os declarations
node_os_weight(Package, Weight)
@@ -641,7 +644,9 @@ node_target_mismatch(Parent, Dependency)
:- depends_on(Parent, Dependency),
not node_target_match(Parent, Dependency).
-:- node(Package), node_target(Package, Target), not target(Target).
+% disallow reusing concrete specs that don't have a compatible target
+:- node(Package), node_target(Package, Target), not target(Target),
+ error("No satisfying package's target is compatible with this machine").
#defined node_target_set/2.
#defined package_target_weight/3.