diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2023-08-07 11:22:20 +0200 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2023-08-15 15:54:37 -0700 |
commit | 1b0e113a9d5278469221aa5d0b163e76360fae73 (patch) | |
tree | b8e5e289f95b5389ef63720511587a3a7490fe30 /lib | |
parent | 6df57384822f09f77825d41aae9f4b76e61f85d6 (diff) | |
download | spack-1b0e113a9d5278469221aa5d0b163e76360fae73.tar.gz spack-1b0e113a9d5278469221aa5d0b163e76360fae73.tar.bz2 spack-1b0e113a9d5278469221aa5d0b163e76360fae73.tar.xz spack-1b0e113a9d5278469221aa5d0b163e76360fae73.zip |
Rename atom: "facts" -> "pkg_fact"
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/solver/asp.py | 56 | ||||
-rw-r--r-- | lib/spack/spack/solver/concretize.lp | 100 | ||||
-rw-r--r-- | lib/spack/spack/solver/heuristic.lp | 18 |
3 files changed, 87 insertions, 87 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index b845750a8c..588e601561 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -968,7 +968,7 @@ class SpackSolverSetup: for weight, declared_version in enumerate(most_to_least_preferred): self.gen.fact( - fn.facts( + fn.pkg_fact( pkg.name, fn.version_declared( declared_version.version, weight, str(declared_version.origin) @@ -979,7 +979,7 @@ class SpackSolverSetup: # Declare deprecated versions for this package, if any deprecated = self.deprecated_versions[pkg.name] for v in sorted(deprecated): - self.gen.fact(fn.facts(pkg.name, fn.deprecated_version(v))) + self.gen.fact(fn.pkg_fact(pkg.name, fn.deprecated_version(v))) def spec_versions(self, spec): """Return list of clauses expressing spec's version constraints.""" @@ -1023,7 +1023,7 @@ class SpackSolverSetup: constraint_msg = "conflict constraint %s" % str(constraint) constraint_id = self.condition(constraint, name=pkg.name, msg=constraint_msg) self.gen.fact( - fn.facts(pkg.name, fn.conflict(trigger_id, constraint_id, conflict_msg)) + fn.pkg_fact(pkg.name, fn.conflict(trigger_id, constraint_id, conflict_msg)) ) self.gen.newline() @@ -1077,7 +1077,7 @@ class SpackSolverSetup: for i, compiler in enumerate(reversed(matches)): self.gen.fact( - fn.facts( + fn.pkg_fact( pkg.name, fn.node_compiler_preference( compiler.spec.name, compiler.spec.version, -i * 100 @@ -1188,7 +1188,7 @@ class SpackSolverSetup: # virtual preferences self.virtual_preferences( pkg.name, - lambda v, p, i: self.gen.fact(fn.facts(pkg.name, fn.provider_preference(v, p, i))), + lambda v, p, i: self.gen.fact(fn.pkg_fact(pkg.name, fn.provider_preference(v, p, i))), ) self.package_requirement_rules(pkg) @@ -1201,8 +1201,8 @@ class SpackSolverSetup: self.gen.h2("Trigger conditions") cache = self._trigger_cache[name] for spec_str, (trigger_id, requirements) in cache.items(): - self.gen.fact(fn.facts(name, fn.trigger_id(trigger_id))) - self.gen.fact(fn.facts(name, fn.trigger_msg(spec_str))) + self.gen.fact(fn.pkg_fact(name, fn.trigger_id(trigger_id))) + self.gen.fact(fn.pkg_fact(name, fn.trigger_msg(spec_str))) for predicate in requirements: self.gen.fact(fn.condition_requirement(trigger_id, *predicate.args)) self.gen.newline() @@ -1212,8 +1212,8 @@ class SpackSolverSetup: self.gen.h2("Imposed requirements") cache = self._effect_cache[name] for spec_str, (effect_id, requirements) in cache.items(): - self.gen.fact(fn.facts(name, fn.effect_id(effect_id))) - self.gen.fact(fn.facts(name, fn.effect_msg(spec_str))) + 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() @@ -1225,7 +1225,7 @@ class SpackSolverSetup: if spack.spec.Spec() in when: # unconditional variant - self.gen.fact(fn.facts(pkg.name, fn.variant(name))) + self.gen.fact(fn.pkg_fact(pkg.name, fn.variant(name))) else: # conditional variant for w in when: @@ -1234,13 +1234,13 @@ class SpackSolverSetup: msg += " when %s" % w cond_id = self.condition(w, name=pkg.name, msg=msg) - self.gen.fact(fn.facts(pkg.name, fn.conditional_variant(cond_id, name))) + self.gen.fact(fn.pkg_fact(pkg.name, fn.conditional_variant(cond_id, name))) single_value = not variant.multi if single_value: - self.gen.fact(fn.facts(pkg.name, fn.variant_single_value(name))) + self.gen.fact(fn.pkg_fact(pkg.name, fn.variant_single_value(name))) self.gen.fact( - fn.facts( + fn.pkg_fact( pkg.name, fn.variant_default_value_from_package_py(name, variant.default) ) ) @@ -1249,7 +1249,7 @@ class SpackSolverSetup: defaults = spec_variant.value for val in sorted(defaults): self.gen.fact( - fn.facts(pkg.name, fn.variant_default_value_from_package_py(name, val)) + fn.pkg_fact(pkg.name, fn.variant_default_value_from_package_py(name, val)) ) values = variant.values @@ -1261,7 +1261,7 @@ class SpackSolverSetup: for sid, s in enumerate(values.sets): for value in s: self.gen.fact( - fn.facts( + fn.pkg_fact( pkg.name, fn.variant_value_from_disjoint_sets(name, value, sid) ) ) @@ -1291,7 +1291,7 @@ class SpackSolverSetup: ) msg = "variant {0}={1} is conditionally disabled".format(name, value) self.gen.fact( - fn.facts(pkg.name, fn.conflict(trigger_id, constraint_id, msg)) + fn.pkg_fact(pkg.name, fn.conflict(trigger_id, constraint_id, msg)) ) else: imposed = spack.spec.Spec(value.when) @@ -1303,10 +1303,10 @@ class SpackSolverSetup: name=pkg.name, msg="%s variant %s value %s when %s" % (pkg.name, name, value, when), ) - self.gen.fact(fn.facts(pkg.name, fn.variant_possible_value(name, value))) + self.gen.fact(fn.pkg_fact(pkg.name, fn.variant_possible_value(name, value))) if variant.sticky: - self.gen.fact(fn.facts(pkg.name, fn.variant_sticky(name))) + self.gen.fact(fn.pkg_fact(pkg.name, fn.variant_sticky(name))) self.gen.newline() @@ -1334,7 +1334,7 @@ class SpackSolverSetup: # we won't emit partial facts. condition_id = next(self._condition_id_counter) - self.gen.fact(fn.facts(named_cond.name, fn.condition(condition_id))) + self.gen.fact(fn.pkg_fact(named_cond.name, fn.condition(condition_id))) self.gen.fact(fn.condition_reason(condition_id, msg)) cache = self._trigger_cache[named_cond.name] @@ -1343,7 +1343,7 @@ class SpackSolverSetup: requirements = self.spec_clauses(named_cond, body=True, required_from=name) cache[named_cond] = (trigger_id, requirements) trigger_id, requirements = cache[named_cond] - self.gen.fact(fn.facts(named_cond.name, fn.condition_trigger(condition_id, trigger_id))) + self.gen.fact(fn.pkg_fact(named_cond.name, fn.condition_trigger(condition_id, trigger_id))) if not imposed_spec: return condition_id @@ -1358,7 +1358,7 @@ class SpackSolverSetup: ) cache[imposed_spec] = (effect_id, requirements) effect_id, requirements = cache[imposed_spec] - self.gen.fact(fn.facts(named_cond.name, fn.condition_effect(condition_id, effect_id))) + self.gen.fact(fn.pkg_fact(named_cond.name, fn.condition_effect(condition_id, effect_id))) return condition_id def impose(self, condition_id, imposed_spec, node=True, name=None, body=False): @@ -1373,7 +1373,7 @@ class SpackSolverSetup: for provider_name in sorted(set(s.name for s in pkg.provided.keys())): if provider_name not in self.possible_virtuals: continue - self.gen.fact(fn.facts(pkg.name, fn.possible_provider(provider_name))) + self.gen.fact(fn.pkg_fact(pkg.name, fn.possible_provider(provider_name))) for provided, whens in pkg.provided.items(): if provided.name not in self.possible_virtuals: @@ -1382,7 +1382,7 @@ class SpackSolverSetup: msg = "%s provides %s when %s" % (pkg.name, provided, when) condition_id = self.condition(when, provided, pkg.name, msg) self.gen.fact( - fn.facts(when.name, fn.provider_condition(condition_id, provided.name)) + fn.pkg_fact(when.name, fn.provider_condition(condition_id, provided.name)) ) self.gen.newline() @@ -1412,7 +1412,7 @@ class SpackSolverSetup: condition_id = self.condition(cond, dep.spec, pkg.name, msg) self.gen.fact( - fn.facts(pkg.name, fn.dependency_condition(condition_id, dep.spec.name)) + fn.pkg_fact(pkg.name, fn.dependency_condition(condition_id, dep.spec.name)) ) for t in sorted(deptypes): @@ -1573,7 +1573,7 @@ class SpackSolverSetup: for local_idx, spec in enumerate(external_specs): msg = "%s available as external when satisfying %s" % (spec.name, spec) condition_id = self.condition(spec, msg=msg) - self.gen.fact(fn.facts(pkg_name, fn.possible_external(condition_id, local_idx))) + self.gen.fact(fn.pkg_fact(pkg_name, fn.possible_external(condition_id, local_idx))) self.possible_versions[spec.name].add(spec.version) self.gen.newline() @@ -1621,7 +1621,7 @@ class SpackSolverSetup: if str(preferred.architecture.target) == best_default and i != 0: offset = 100 self.gen.fact( - fn.facts( + fn.pkg_fact( pkg_name, fn.target_weight(str(preferred.architecture.target), i + offset) ) ) @@ -2169,7 +2169,7 @@ class SpackSolverSetup: # generate facts for each package constraint and the version # that satisfies it for v in sorted(v for v in self.possible_versions[pkg_name] if v.satisfies(versions)): - self.gen.fact(fn.facts(pkg_name, fn.version_satisfies(versions, v))) + self.gen.fact(fn.pkg_fact(pkg_name, fn.version_satisfies(versions, v))) self.gen.newline() @@ -2259,7 +2259,7 @@ class SpackSolverSetup: # spec_clauses(). We might want to order these facts by pkg and name # if we are debugging. for pkg, variant, value in self.variant_values_from_specs: - self.gen.fact(fn.facts(pkg, fn.variant_possible_value(variant, value))) + self.gen.fact(fn.pkg_fact(pkg, fn.variant_possible_value(variant, value))) def _facts_from_concrete_spec(self, spec, possible): # tell the solver about any installed packages that could diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp index 976cf15072..fc725a81be 100644 --- a/lib/spack/spack/solver/concretize.lp +++ b/lib/spack/spack/solver/concretize.lp @@ -145,23 +145,23 @@ error(100, multiple_values_error, Attribute, PackageNode) % Versions are declared with a weight and an origin, which indicates where the % version was declared (e.g. "package_py" or "external"). -facts(Package, version_declared(Version, Weight)) :- facts(Package, version_declared(Version, Weight, _)). +pkg_fact(Package, version_declared(Version, Weight)) :- pkg_fact(Package, version_declared(Version, Weight, _)). % We can't emit the same version **with the same weight** from two different sources -:- facts(Package, version_declared(Version, Weight, Origin1)), - facts(Package, version_declared(Version, Weight, Origin2)), +:- pkg_fact(Package, version_declared(Version, Weight, Origin1)), + pkg_fact(Package, version_declared(Version, Weight, Origin2)), Origin1 < Origin2, internal_error("Two versions with identical weights"). % We cannot use a version declared for an installed package if we end up building it -:- facts(Package, version_declared(Version, Weight, "installed")), +:- pkg_fact(Package, version_declared(Version, Weight, "installed")), attr("version", node(ID, Package), Version), version_weight(node(ID, Package), Weight), not attr("hash", node(ID, Package), _), internal_error("Reuse version weight used for built package"). % versions are declared w/priority -- declared with priority implies declared -facts(Package, version_declared(Version)) :- facts(Package, version_declared(Version, _)). +pkg_fact(Package, version_declared(Version)) :- pkg_fact(Package, version_declared(Version, _)). % If something is a package, it has only one version and that must be a % declared version. @@ -169,7 +169,7 @@ facts(Package, version_declared(Version)) :- facts(Package, version_declared(Ver % is not precisely one version chosen. Error facts are heavily optimized % against to ensure they cannot be inferred when a non-error solution is % possible -{ attr("version", node(ID, Package), Version) : facts(Package, version_declared(Version)) } +{ attr("version", node(ID, Package), Version) : pkg_fact(Package, version_declared(Version)) } :- attr("node", node(ID, Package)). % A virtual package may or may not have a version, but never has more than one @@ -180,17 +180,17 @@ error(100, "Cannot select a single version for virtual '{0}'", Virtual) % If we select a deprecated version, mark the package as deprecated attr("deprecated", node(ID, Package), Version) :- attr("version", node(ID, Package), Version), - facts(Package, deprecated_version(Version)). + pkg_fact(Package, deprecated_version(Version)). possible_version_weight(node(ID, Package), Weight) :- attr("version", node(ID, Package), Version), - facts(Package, version_declared(Version, Weight)). + pkg_fact(Package, version_declared(Version, Weight)). % we can't use the weight for an external version if we don't use the % corresponding external spec. :- attr("version", node(ID, Package), Version), version_weight(node(ID, Package), Weight), - facts(Package, version_declared(Version, Weight, "external")), + pkg_fact(Package, version_declared(Version, Weight, "external")), not external(node(ID, Package)), internal_error("External weight used for built package"). @@ -198,17 +198,17 @@ possible_version_weight(node(ID, Package), Weight) % and vice-versa :- attr("version", node(ID, Package), Version), version_weight(node(ID, Package), Weight), - facts(Package, version_declared(Version, Weight, "installed")), + pkg_fact(Package, version_declared(Version, Weight, "installed")), build(node(ID, Package)), internal_error("Reuse version weight used for build package"). :- attr("version", node(ID, Package), Version), version_weight(node(ID, Package), Weight), - not facts(Package, version_declared(Version, Weight, "installed")), + not pkg_fact(Package, version_declared(Version, Weight, "installed")), not build(node(ID, Package)), internal_error("Build version weight used for reused package"). -1 { version_weight(node(ID, Package), Weight) : facts(Package, version_declared(Version, Weight)) } 1 +1 { version_weight(node(ID, Package), Weight) : pkg_fact(Package, version_declared(Version, Weight)) } 1 :- attr("version", node(ID, Package), Version), attr("node", node(ID, Package)). @@ -217,25 +217,25 @@ possible_version_weight(node(ID, Package), Weight) % While this choice rule appears redundant with the initial choice rule for % versions, virtual nodes with version constraints require this rule to be % able to choose versions -{ attr("version", node(ID, Package), Version) : facts(Package, version_satisfies(Constraint, Version)) } +{ attr("version", node(ID, Package), Version) : pkg_fact(Package, version_satisfies(Constraint, Version)) } :- attr("node_version_satisfies", node(ID, Package), Constraint). % If there is at least a version that satisfy the constraint, impose a lower % bound on the choice rule to avoid false positives with the error below -1 { attr("version", node(ID, Package), Version) : facts(Package, version_satisfies(Constraint, Version)) } +1 { attr("version", node(ID, Package), Version) : pkg_fact(Package, version_satisfies(Constraint, Version)) } :- attr("node_version_satisfies", node(ID, Package), Constraint), - facts(Package, version_satisfies(Constraint, _)). + pkg_fact(Package, version_satisfies(Constraint, _)). % More specific error message if the version cannot satisfy some constraint % Otherwise covered by `no_version_error` and `versions_conflict_error`. error(10, "Cannot satisfy '{0}@{1}'", Package, Constraint) :- attr("node_version_satisfies", node(ID, Package), Constraint), attr("version", node(ID, Package), Version), - not facts(Package, version_satisfies(Constraint, Version)). + not pkg_fact(Package, version_satisfies(Constraint, Version)). attr("node_version_satisfies", node(ID, Package), Constraint) :- attr("version", node(ID, Package), Version), - facts(Package, version_satisfies(Constraint, Version)). + pkg_fact(Package, version_satisfies(Constraint, Version)). #defined version_satisfies/3. #defined deprecated_version/2. @@ -285,8 +285,8 @@ condition_packages(ID, A1) :- condition_requirement(ID, _, A1, _). condition_packages(ID, A1) :- condition_requirement(ID, _, A1, _, _). condition_packages(ID, A1) :- condition_requirement(ID, _, A1, _, _, _). -trigger_node(ID, node(PackageID, Package), node(PackageID, Package)) :- facts(Package, trigger_id(ID)), attr("node", node(PackageID, Package)). -trigger_node(ID, node(PackageID, Package), node(VirtualID, Virtual)) :- facts(Virtual, trigger_id(ID)), provider(node(PackageID, Package), node(VirtualID, Virtual)). +trigger_node(ID, node(PackageID, Package), node(PackageID, Package)) :- pkg_fact(Package, trigger_id(ID)), attr("node", node(PackageID, Package)). +trigger_node(ID, node(PackageID, Package), node(VirtualID, Virtual)) :- pkg_fact(Virtual, trigger_id(ID)), provider(node(PackageID, Package), node(VirtualID, Virtual)). condition_nodes(TriggerID, PackageNode, node(X, A1)) :- condition_packages(TriggerID, A1), @@ -309,12 +309,12 @@ trigger_condition_holds(ID, RequestorNode) :- not cannot_hold(ID, PackageNode). condition_holds(ConditionID, node(X, Package)) - :- facts(Package, condition_trigger(ConditionID, TriggerID)), + :- pkg_fact(Package, condition_trigger(ConditionID, TriggerID)), trigger_condition_holds(TriggerID, node(X, Package)). trigger_and_effect(Package, TriggerID, EffectID) - :- facts(Package, condition_trigger(ID, TriggerID)), - facts(Package, condition_effect(ID, EffectID)). + :- pkg_fact(Package, condition_trigger(ID, TriggerID)), + pkg_fact(Package, condition_effect(ID, EffectID)). % condition_holds(ID, node(ID, Package)) implies all imposed_constraints, unless do_not_impose(ID, node(ID, Package)) % is derived. This allows imposed constraints to be canceled in special cases. @@ -331,8 +331,8 @@ imposed_packages(ID, A1) :- imposed_constraint(ID, _, A1, _, _, _). imposed_packages(ID, A1) :- imposed_constraint(ID, "depends_on", _, A1, _). imposed_nodes(EffectID, node(NodeID, Package), node(X, A1)) - :- facts(Package, condition_trigger(ID, TriggerID)), - facts(Package, condition_effect(ID, EffectID)), + :- pkg_fact(Package, condition_trigger(ID, TriggerID)), + pkg_fact(Package, condition_effect(ID, EffectID)), imposed_packages(EffectID, A1), condition_set(node(NodeID, Package), node(X, A1)), trigger_node(TriggerID, _, node(NodeID, Package)). @@ -406,7 +406,7 @@ depends_on(PackageNode, DependencyNode) :- attr("depends_on", PackageNode, Depen % concrete specs don't need to be resolved -- they arise from the concrete % specs themselves. dependency_holds(node(NodeID, Package), Dependency, Type) :- - facts(Package, dependency_condition(ID, Dependency)), + pkg_fact(Package, dependency_condition(ID, Dependency)), dependency_type(ID, Type), build(node(NodeID, Package)), not external(node(NodeID, Package)), @@ -417,8 +417,8 @@ dependency_holds(node(NodeID, Package), Dependency, Type) :- do_not_impose(EffectID, node(NodeID, Package)) :- not dependency_holds(node(NodeID, Package), Dependency, _), attr("node", node(NodeID, Package)), - facts(Package, dependency_condition(ID, Dependency)), - facts(Package, condition_effect(ID, EffectID)). + pkg_fact(Package, dependency_condition(ID, Dependency)), + pkg_fact(Package, condition_effect(ID, EffectID)). % If a dependency holds on a package node, there must be one and only one dependency node satisfying it 1 { attr("depends_on", PackageNode, node(0..Y-1, Dependency), Type) : max_nodes(Dependency, Y) } 1 @@ -441,7 +441,7 @@ error(10, "'{0}' is not a valid dependency for any package in the DAG", Package) %----------------------------------------------------------------------------- error(1, Msg) :- attr("node", node(ID, Package)), - facts(Package, conflict(TriggerID, ConstraintID, Msg)), + pkg_fact(Package, conflict(TriggerID, ConstraintID, Msg)), condition_holds(TriggerID, node(ID, Package)), condition_holds(ConstraintID, node(ID, Package)), not external(node(ID, Package)), % ignore conflicts for externals @@ -499,7 +499,7 @@ attr("root", PackageNode) :- attr("virtual_root", VirtualNode), provider(Package % The provider provides the virtual if some provider condition holds. virtual_condition_holds(node(ProviderID, Provider), Virtual) :- virtual_condition_holds(ID, node(ProviderID, Provider), Virtual). virtual_condition_holds(ID, node(ProviderID, Provider), Virtual) :- - facts(Provider, provider_condition(ID, Virtual)), + pkg_fact(Provider, provider_condition(ID, Virtual)), condition_holds(ID, node(ProviderID, Provider)), virtual(Virtual). @@ -530,7 +530,7 @@ possible_provider_weight(DependencyNode, VirtualNode, 0, "external") possible_provider_weight(node(DependencyID, Dependency), node(VirtualID, Virtual), Weight, "packages_yaml") :- provider(node(DependencyID, Dependency), node(VirtualID, Virtual)), depends_on(node(ID, Package), node(DependencyID, Dependency)), - facts(Package, provider_preference(Virtual, Dependency, Weight)). + pkg_fact(Package, provider_preference(Virtual, Dependency, Weight)). % A provider mentioned in the default configuration can use a weight % according to its priority in the list of providers @@ -554,7 +554,7 @@ possible_provider_weight(node(DependencyID, Dependency), VirtualNode, 100, "fall % if a package is external its version must be one of the external versions { external_version(node(ID, Package), Version, Weight): - facts(Package, version_declared(Version, Weight, "external")) } + pkg_fact(Package, version_declared(Version, Weight, "external")) } :- external(node(ID, Package)). error(100, "Attempted to use external for '{0}' which does not satisfy any configured external spec", Package) @@ -584,7 +584,7 @@ external(PackageNode) :- attr("external_spec_selected", PackageNode, _). % corresponding external spec. :- attr("version", node(ID, Package), Version), version_weight(node(ID, Package), Weight), - facts(Package, version_declared(Version, Weight, "external")), + pkg_fact(Package, version_declared(Version, Weight, "external")), not external(node(ID, Package)), internal_error("External weight used for internal spec"). @@ -595,7 +595,7 @@ attr("external_spec_selected", node(ID, Package), LocalIndex) :- not attr("hash", node(ID, Package), _). external_conditions_hold(node(PackageID, Package), LocalIndex) :- - facts(Package, possible_external(ID, LocalIndex)), condition_holds(ID, node(PackageID, Package)). + pkg_fact(Package, possible_external(ID, LocalIndex)), condition_holds(ID, node(PackageID, Package)). % it cannot happen that a spec is external, but none of the external specs % conditions hold. @@ -692,11 +692,11 @@ error(10, Message) :- % a variant is a variant of a package if it is a variant under some condition % and that condition holds node_has_variant(node(NodeID, Package), Variant) :- - facts(Package, conditional_variant(ID, Variant)), + pkg_fact(Package, conditional_variant(ID, Variant)), condition_holds(ID, node(NodeID, Package)). node_has_variant(node(ID, Package), Variant) :- - facts(Package, variant(Variant)), + pkg_fact(Package, variant(Variant)), attr("node", node(ID, Package)). attr("variant_propagate", PackageNode, Variant, Value, Source) :- @@ -709,7 +709,7 @@ attr("variant_value", node(ID, Package), Variant, Value) :- attr("node", node(ID, Package)), node_has_variant(node(ID, Package), Variant), attr("variant_propagate", node(ID, Package), Variant, Value, _), - facts(Package, variant_possible_value(Variant, Value)). + pkg_fact(Package, variant_possible_value(Variant, Value)). error(100, "{0} and {1} cannot both propagate variant '{2}' to package {3} with values '{4}' and '{5}'", Source1, Source2, Variant, PackageNode, Value1, Value2) :- attr("variant_propagate", PackageNode, Variant, Value1, Source1), @@ -733,14 +733,14 @@ error(100, "Cannot set variant '{0}' for package '{1}' because the variant condi attr("variant_value", node(ID, Package), Variant, Value) :- node_has_variant(node(ID, Package), Variant), not attr("variant_set", node(ID, Package), Variant), - facts(Package, variant_sticky(Variant)), + pkg_fact(Package, variant_sticky(Variant)), variant_default_value(Package, Variant, Value), build(node(ID, Package)). % at most one variant value for single-valued variants. { attr("variant_value", node(ID, Package), Variant, Value) - : facts(Package, variant_possible_value(Variant, Value)) + : pkg_fact(Package, variant_possible_value(Variant, Value)) } :- attr("node", node(ID, Package)), node_has_variant(node(ID, Package), Variant), @@ -750,7 +750,7 @@ attr("variant_value", node(ID, Package), Variant, Value) :- error(100, "'{0}' required multiple values for single-valued variant '{1}'", Package, Variant) :- attr("node", node(ID, Package)), node_has_variant(node(ID, Package), Variant), - facts(Package, variant_single_value(Variant)), + pkg_fact(Package, variant_single_value(Variant)), build(node(ID, Package)), 2 { attr("variant_value", node(ID, Package), Variant, Value) }. @@ -768,7 +768,7 @@ attr("variant_set", PackageNode, Variant) :- attr("variant_set", PackageNode, Va % have been built w/different variants from older/different package versions. error(10, "'Spec({1}={2})' is not a valid value for '{0}' variant '{1}'", Package, Variant, Value) :- attr("variant_value", node(ID, Package), Variant, Value), - not facts(Package, variant_possible_value(Variant, Value)), + not pkg_fact(Package, variant_possible_value(Variant, Value)), build(node(ID, Package)). % Some multi valued variants accept multiple values from disjoint sets. @@ -777,8 +777,8 @@ error(10, "'Spec({1}={2})' is not a valid value for '{0}' variant '{1}'", Packag error(100, "{0} variant '{1}' cannot have values '{2}' and '{3}' as they come from disjoint value sets", Package, Variant, Value1, Value2) :- attr("variant_value", node(ID, Package), Variant, Value1), attr("variant_value", node(ID, Package), Variant, Value2), - facts(Package, variant_value_from_disjoint_sets(Variant, Value1, Set1)), - facts(Package, variant_value_from_disjoint_sets(Variant, Value2, Set2)), + pkg_fact(Package, variant_value_from_disjoint_sets(Variant, Value1, Set1)), + pkg_fact(Package, variant_value_from_disjoint_sets(Variant, Value2, Set2)), Set1 < Set2, % see[1] build(node(ID, Package)). @@ -817,7 +817,7 @@ variant_default_not_used(node(ID, Package), Variant, Value) external_with_variant_set(node(NodeID, Package), Variant, Value) :- attr("variant_value", node(NodeID, Package), Variant, Value), condition_requirement(ID, "variant_value", Package, Variant, Value), - facts(Package, possible_external(ID, _)), + pkg_fact(Package, possible_external(ID, _)), external(node(NodeID, Package)), attr("node", node(NodeID, Package)). @@ -829,7 +829,7 @@ external_with_variant_set(node(NodeID, Package), Variant, Value) % packages.yaml and the command line) % variant_default_value(Package, Variant, Value) - :- facts(Package, variant_default_value_from_package_py(Variant, Value)), + :- pkg_fact(Package, variant_default_value_from_package_py(Variant, Value)), not variant_default_value_from_packages_yaml(Package, Variant, _), not attr("variant_default_value_from_cli", node(root_node_id, Package), Variant, _). @@ -857,7 +857,7 @@ auto_variant("patches"). node_has_variant(PackageNode, Variant) :- attr("variant_set", PackageNode, Variant, _), auto_variant(Variant). -facts(Package, variant_single_value("dev_path")) +pkg_fact(Package, variant_single_value("dev_path")) :- attr("variant_set", node(ID, Package), "dev_path", _). % suppress warnings about this atom being unset. It's only set if some @@ -992,7 +992,7 @@ attr("node_target", PackageNode, Target) node_target_weight(node(ID, Package), Weight) :- attr("node", node(ID, Package)), attr("node_target", node(ID, Package), Target), - facts(Package, target_weight(Target, Weight)). + pkg_fact(Package, target_weight(Target, Weight)). % compatibility rules for targets among nodes node_target_match(ParentNode, DependencyNode) @@ -1118,18 +1118,18 @@ compiler_weight(node(ID, Package), Weight) :- node_compiler(node(ID, Package), CompilerID), compiler_name(CompilerID, Compiler), compiler_version(CompilerID, V), - facts(Package, node_compiler_preference(Compiler, V, Weight)). + pkg_fact(Package, node_compiler_preference(Compiler, V, Weight)). compiler_weight(node(ID, Package), Weight) :- node_compiler(node(ID, Package), CompilerID), compiler_name(CompilerID, Compiler), compiler_version(CompilerID, V), - not facts(Package, node_compiler_preference(Compiler, V, _)), + not pkg_fact(Package, node_compiler_preference(Compiler, V, _)), default_compiler_preference(CompilerID, Weight). compiler_weight(node(ID, Package), 100) :- node_compiler(node(ID, Package), CompilerID), compiler_name(CompilerID, Compiler), compiler_version(CompilerID, V), - not facts(Package, node_compiler_preference(Compiler, V, _)), + not pkg_fact(Package, node_compiler_preference(Compiler, V, _)), not default_compiler_preference(CompilerID, _). % For the time being, be strict and reuse only if the compiler match one we have on the system @@ -1267,7 +1267,7 @@ build_priority(PackageNode, 0) :- not build(PackageNode), attr("node", Package % build deps in the solve, consider using them as a preference to resolve this. :- attr("version", node(ID, Package), Version), version_weight(node(ID, Package), Weight), - facts(Package, version_declared(Version, Weight, "installed")), + pkg_fact(Package, version_declared(Version, Weight, "installed")), not optimize_for_reuse(). #defined installed_hash/2. diff --git a/lib/spack/spack/solver/heuristic.lp b/lib/spack/spack/solver/heuristic.lp index 3993d1ac91..5afb785cbc 100644 --- a/lib/spack/spack/solver/heuristic.lp +++ b/lib/spack/spack/solver/heuristic.lp @@ -12,10 +12,10 @@ #heuristic attr("node", node(0, Package)) : literal(_, "node", Package). [45, true] % Root node -#heuristic attr("version", node(0, Package), Version) : facts(Package, version_declared(Version, 0)), attr("root", node(0, Package)). [35, true] -#heuristic version_weight(node(0, Package), 0) : facts(Package, version_declared(Version, 0)), attr("root", node(0, Package)). [35, true] +#heuristic attr("version", node(0, Package), Version) : pkg_fact(Package, version_declared(Version, 0)), attr("root", node(0, Package)). [35, true] +#heuristic version_weight(node(0, Package), 0) : pkg_fact(Package, version_declared(Version, 0)), attr("root", node(0, Package)). [35, true] #heuristic attr("variant_value", node(0, Package), Variant, Value) : variant_default_value(Package, Variant, Value), attr("root", node(0, Package)). [35, true] -#heuristic attr("node_target", node(0, Package), Target) : facts(Package, target_weight(Target, 0)), attr("root", node(0, Package)). [35, true] +#heuristic attr("node_target", node(0, Package), Target) : pkg_fact(Package, target_weight(Target, 0)), attr("root", node(0, Package)). [35, true] #heuristic node_target_weight(node(0, Package), 0) : attr("root", node(0, Package)). [35, true] #heuristic node_compiler(node(0, Package), CompilerID) : default_compiler_preference(ID, 0), compiler_id(ID), attr("root", node(0, Package)). [35, true] @@ -25,17 +25,17 @@ %#heuristic provider_weight(node(0, Package), node(0, Virtual), 0) : default_provider_preference(Virtual, Package, 0), possible_in_link_run(Package). [30, true] % node(ID, _) -#heuristic attr("version", node(ID, Package), Version) : facts(Package, version_declared(Version, ID)), attr("node", node(ID, Package)). [25-5*ID, true] -#heuristic version_weight(node(ID, Package), ID) : facts(Package, version_declared(Version, ID)), attr("node", node(ID, Package)). [25-5*ID, true] +#heuristic attr("version", node(ID, Package), Version) : pkg_fact(Package, version_declared(Version, ID)), attr("node", node(ID, Package)). [25-5*ID, true] +#heuristic version_weight(node(ID, Package), ID) : pkg_fact(Package, version_declared(Version, ID)), attr("node", node(ID, Package)). [25-5*ID, true] #heuristic attr("variant_value", node(ID, Package), Variant, Value) : variant_default_value(Package, Variant, Value), attr("node", node(ID, Package)). [25-5*ID, true] -#heuristic attr("node_target", node(ID, Package), Target) : facts(Package, target_weight(Target, ID)), attr("node", node(ID, Package)). [25-5*ID, true] +#heuristic attr("node_target", node(ID, Package), Target) : pkg_fact(Package, target_weight(Target, ID)), attr("node", node(ID, Package)). [25-5*ID, true] #heuristic node_target_weight(node(ID, Package), ID) : attr("node", node(ID, Package)). [25-5*ID, true] #heuristic node_compiler(node(ID, Package), CompilerID) : default_compiler_preference(ID, ID), compiler_id(ID), attr("node", node(ID, Package)). [25-5*ID, true] % node(ID, _), split build dependencies -#heuristic attr("version", node(ID, Package), Version) : facts(Package, version_declared(Version, ID)), attr("node", node(ID, Package)), multiple_unification_sets(Package). [25, true] -#heuristic version_weight(node(ID, Package), ID) : facts(Package, version_declared(Version, ID)), attr("node", node(ID, Package)), multiple_unification_sets(Package). [25, true] +#heuristic attr("version", node(ID, Package), Version) : pkg_fact(Package, version_declared(Version, ID)), attr("node", node(ID, Package)), multiple_unification_sets(Package). [25, true] +#heuristic version_weight(node(ID, Package), ID) : pkg_fact(Package, version_declared(Version, ID)), attr("node", node(ID, Package)), multiple_unification_sets(Package). [25, true] #heuristic attr("variant_value", node(ID, Package), Variant, Value) : variant_default_value(Package, Variant, Value), attr("node", node(ID, Package)), multiple_unification_sets(Package). [25, true] -#heuristic attr("node_target", node(ID, Package), Target) : facts(Package, target_weight(Target, ID)), attr("node", node(ID, Package)), multiple_unification_sets(Package). [25, true] +#heuristic attr("node_target", node(ID, Package), Target) : pkg_fact(Package, target_weight(Target, ID)), attr("node", node(ID, Package)), multiple_unification_sets(Package). [25, true] #heuristic node_target_weight(node(ID, Package), ID) : attr("node", node(ID, Package)), multiple_unification_sets(Package). [25, true] #heuristic node_compiler(node(ID, Package), CompilerID) : default_compiler_preference(ID, ID), compiler_id(ID), attr("node", node(ID, Package)), multiple_unification_sets(Package). [25, true] |