diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2020-11-11 00:58:05 -0800 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2020-11-17 10:04:13 -0800 |
commit | 0620d954f59bd80b4dc229d13ecaa8ba04b49a70 (patch) | |
tree | 9ef23c8bec1af1a89bb51efc07ac2d36c8949363 | |
parent | 2231dfc89826f64d7ccdd7a9f9559cf417817688 (diff) | |
download | spack-0620d954f59bd80b4dc229d13ecaa8ba04b49a70.tar.gz spack-0620d954f59bd80b4dc229d13ecaa8ba04b49a70.tar.bz2 spack-0620d954f59bd80b4dc229d13ecaa8ba04b49a70.tar.xz spack-0620d954f59bd80b4dc229d13ecaa8ba04b49a70.zip |
concretizer: don't generate rules for empty version lists
If the version list passed to one_of_iff is empty, it still generates a
rule like this:
node_compiler_version_satisfies("fujitsu-mpi", "arm", ":") :- 1 { } 1.
1 { } 1 :- node_compiler_version_satisfies("fujitsu-mpi", "arm", ":").
The cardinality rules on the right and left above are never
satisfiale, and these rules do nothing.
- [x] Skip generating any rules at all for empty version lists.
-rw-r--r-- | lib/spack/spack/solver/asp.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index b83cf133c3..105d39049e 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -573,6 +573,10 @@ class PyclingoDriver(object): self.rule(head=expr2, body=expr1) def one_of_iff(self, head, versions): + # if there are no versions, skip this one_of_iff + if not versions: + return + self.out.write("%s :- %s.\n" % (head, AspOneOf(*versions))) self.out.write("%s :- %s.\n" % (AspOneOf(*versions), head)) |