diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2023-08-14 14:52:06 +0200 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2023-08-15 15:54:37 -0700 |
commit | 135b44ca594e260c54164a453548f3d9be40fdce (patch) | |
tree | a260b08b5e53fa1660b8977ce6312699019d7934 /lib | |
parent | d3aca68e8f372ca124e7da2567e8936be23d54d3 (diff) | |
download | spack-135b44ca594e260c54164a453548f3d9be40fdce.tar.gz spack-135b44ca594e260c54164a453548f3d9be40fdce.tar.bz2 spack-135b44ca594e260c54164a453548f3d9be40fdce.tar.xz spack-135b44ca594e260c54164a453548f3d9be40fdce.zip |
Change "effect_rules" for symmetry with trigger rules
This even though right now we don't have cases where
the effect is on another package.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/solver/asp.py | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index 3ca4824be1..5f0e7d767d 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -326,7 +326,7 @@ fn = AspFunctionBuilder() def _create_counter(specs, tests): - strategy = spack.config.config.get("concretizer:duplicates:strategy", "none") + strategy = spack.config.CONFIG.get("concretizer:duplicates:strategy", "none") if strategy == "full": return FullDuplicatesCounter(specs, tests=tests) if strategy == "minimal": @@ -1216,9 +1216,10 @@ class SpackSolverSetup: # trigger and effect tables self.trigger_rules() - self.effect_rules(pkg.name) + self.effect_rules() def trigger_rules(self): + """Flushes all the trigger rules collected so far, and clears the cache.""" self.gen.h2("Trigger conditions") for name in self._trigger_cache: cache = self._trigger_cache[name] @@ -1230,16 +1231,18 @@ class SpackSolverSetup: self.gen.newline() self._trigger_cache.clear() - def effect_rules(self, name): + def effect_rules(self): + """Flushes all the effect rules collected so far, and clears the cache.""" self.gen.h2("Imposed requirements") - cache = self._effect_cache[name] - for spec_str, (effect_id, requirements) in cache.items(): - self.gen.fact(fn.pkg_fact(name, fn.effect_id(effect_id))) - self.gen.fact(fn.pkg_fact(name, fn.effect_msg(spec_str))) - for predicate in requirements: - self.gen.fact(fn.imposed_constraint(effect_id, *predicate.args)) - self.gen.newline() - cache.clear() + for name in self._effect_cache: + cache = self._effect_cache[name] + for spec_str, (effect_id, requirements) in cache.items(): + self.gen.fact(fn.pkg_fact(name, fn.effect_id(effect_id))) + self.gen.fact(fn.pkg_fact(name, fn.effect_msg(spec_str))) + for predicate in requirements: + self.gen.fact(fn.imposed_constraint(effect_id, *predicate.args)) + self.gen.newline() + self._effect_cache.clear() def variant_rules(self, pkg): for name, entry in sorted(pkg.variants.items()): @@ -1481,7 +1484,7 @@ class SpackSolverSetup: ) self.emit_facts_from_requirement_rules(rules) self.trigger_rules() - self.effect_rules(virtual_str) + self.effect_rules() def emit_facts_from_requirement_rules(self, rules: List[RequirementRule]): """Generate facts to enforce requirements. @@ -2427,7 +2430,7 @@ class SpackSolverSetup: for ds in dev_specs: self.condition(spack.spec.Spec(ds.name), ds, msg="%s is a develop spec" % ds.name) self.trigger_rules() - self.effect_rules(ds.name) + self.effect_rules() self.gen.h1("Spec Constraints") self.literal_specs(specs) |