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.
This commit is contained in:
parent
d3aca68e8f
commit
135b44ca59
1 changed files with 16 additions and 13 deletions
|
@ -326,7 +326,7 @@ def __getattr__(self, name):
|
||||||
|
|
||||||
|
|
||||||
def _create_counter(specs, tests):
|
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":
|
if strategy == "full":
|
||||||
return FullDuplicatesCounter(specs, tests=tests)
|
return FullDuplicatesCounter(specs, tests=tests)
|
||||||
if strategy == "minimal":
|
if strategy == "minimal":
|
||||||
|
@ -1216,9 +1216,10 @@ def pkg_rules(self, pkg, tests):
|
||||||
|
|
||||||
# trigger and effect tables
|
# trigger and effect tables
|
||||||
self.trigger_rules()
|
self.trigger_rules()
|
||||||
self.effect_rules(pkg.name)
|
self.effect_rules()
|
||||||
|
|
||||||
def trigger_rules(self):
|
def trigger_rules(self):
|
||||||
|
"""Flushes all the trigger rules collected so far, and clears the cache."""
|
||||||
self.gen.h2("Trigger conditions")
|
self.gen.h2("Trigger conditions")
|
||||||
for name in self._trigger_cache:
|
for name in self._trigger_cache:
|
||||||
cache = self._trigger_cache[name]
|
cache = self._trigger_cache[name]
|
||||||
|
@ -1230,16 +1231,18 @@ def trigger_rules(self):
|
||||||
self.gen.newline()
|
self.gen.newline()
|
||||||
self._trigger_cache.clear()
|
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")
|
self.gen.h2("Imposed requirements")
|
||||||
cache = self._effect_cache[name]
|
for name in self._effect_cache:
|
||||||
for spec_str, (effect_id, requirements) in cache.items():
|
cache = self._effect_cache[name]
|
||||||
self.gen.fact(fn.pkg_fact(name, fn.effect_id(effect_id)))
|
for spec_str, (effect_id, requirements) in cache.items():
|
||||||
self.gen.fact(fn.pkg_fact(name, fn.effect_msg(spec_str)))
|
self.gen.fact(fn.pkg_fact(name, fn.effect_id(effect_id)))
|
||||||
for predicate in requirements:
|
self.gen.fact(fn.pkg_fact(name, fn.effect_msg(spec_str)))
|
||||||
self.gen.fact(fn.imposed_constraint(effect_id, *predicate.args))
|
for predicate in requirements:
|
||||||
self.gen.newline()
|
self.gen.fact(fn.imposed_constraint(effect_id, *predicate.args))
|
||||||
cache.clear()
|
self.gen.newline()
|
||||||
|
self._effect_cache.clear()
|
||||||
|
|
||||||
def variant_rules(self, pkg):
|
def variant_rules(self, pkg):
|
||||||
for name, entry in sorted(pkg.variants.items()):
|
for name, entry in sorted(pkg.variants.items()):
|
||||||
|
@ -1481,7 +1484,7 @@ def provider_requirements(self):
|
||||||
)
|
)
|
||||||
self.emit_facts_from_requirement_rules(rules)
|
self.emit_facts_from_requirement_rules(rules)
|
||||||
self.trigger_rules()
|
self.trigger_rules()
|
||||||
self.effect_rules(virtual_str)
|
self.effect_rules()
|
||||||
|
|
||||||
def emit_facts_from_requirement_rules(self, rules: List[RequirementRule]):
|
def emit_facts_from_requirement_rules(self, rules: List[RequirementRule]):
|
||||||
"""Generate facts to enforce requirements.
|
"""Generate facts to enforce requirements.
|
||||||
|
@ -2427,7 +2430,7 @@ def setup(self, driver, specs, reuse=None):
|
||||||
for ds in dev_specs:
|
for ds in dev_specs:
|
||||||
self.condition(spack.spec.Spec(ds.name), ds, msg="%s is a develop spec" % ds.name)
|
self.condition(spack.spec.Spec(ds.name), ds, msg="%s is a develop spec" % ds.name)
|
||||||
self.trigger_rules()
|
self.trigger_rules()
|
||||||
self.effect_rules(ds.name)
|
self.effect_rules()
|
||||||
|
|
||||||
self.gen.h1("Spec Constraints")
|
self.gen.h1("Spec Constraints")
|
||||||
self.literal_specs(specs)
|
self.literal_specs(specs)
|
||||||
|
|
Loading…
Reference in a new issue