solver: remove indirection for external conditions
This commit is contained in:
parent
acde8ef104
commit
edc07dab27
@ -1452,7 +1452,9 @@ def external_packages(self):
|
|||||||
for local_idx, spec in enumerate(external_specs):
|
for local_idx, spec in enumerate(external_specs):
|
||||||
msg = "%s available as external when satisfying %s" % (spec.name, spec)
|
msg = "%s available as external when satisfying %s" % (spec.name, spec)
|
||||||
condition_id = self.condition(spec, msg=msg)
|
condition_id = self.condition(spec, msg=msg)
|
||||||
self.gen.fact(fn.possible_external(condition_id, pkg_name, local_idx))
|
self.gen.fact(fn.imposed_constraint(
|
||||||
|
condition_id, "external_conditions_hold", pkg_name, local_idx
|
||||||
|
))
|
||||||
self.possible_versions[spec.name].add(spec.version)
|
self.possible_versions[spec.name].add(spec.version)
|
||||||
self.gen.newline()
|
self.gen.newline()
|
||||||
|
|
||||||
@ -2399,6 +2401,7 @@ class SpecBuilder(object):
|
|||||||
r"^root$",
|
r"^root$",
|
||||||
r"^virtual_node$",
|
r"^virtual_node$",
|
||||||
r"^virtual_root$",
|
r"^virtual_root$",
|
||||||
|
r"^.*holds?$",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -425,25 +425,15 @@ external(Package) :- attr("external_spec_selected", Package, _).
|
|||||||
|
|
||||||
% determine if an external spec has been selected
|
% determine if an external spec has been selected
|
||||||
attr("external_spec_selected", Package, LocalIndex) :-
|
attr("external_spec_selected", Package, LocalIndex) :-
|
||||||
external_conditions_hold(Package, LocalIndex),
|
attr("external_conditions_hold", Package, LocalIndex),
|
||||||
attr("node", Package),
|
attr("node", Package),
|
||||||
not attr("hash", Package, _).
|
not attr("hash", Package, _).
|
||||||
|
|
||||||
external_conditions_hold(Package, LocalIndex) :-
|
|
||||||
possible_external(ID, Package, LocalIndex), condition_holds(ID).
|
|
||||||
|
|
||||||
% it cannot happen that a spec is external, but none of the external specs
|
% it cannot happen that a spec is external, but none of the external specs
|
||||||
% conditions hold.
|
% conditions hold.
|
||||||
error(100, "Attempted to use external for '{0}' which does not satisfy any configured external spec", Package)
|
error(100, "Attempted to use external for '{0}' which does not satisfy any configured external spec", Package)
|
||||||
:- external(Package),
|
:- external(Package),
|
||||||
not external_conditions_hold(Package, _).
|
not attr("external_conditions_hold", Package, _).
|
||||||
|
|
||||||
#defined possible_external/3.
|
|
||||||
#defined external_spec_index/3.
|
|
||||||
#defined external_spec_condition/3.
|
|
||||||
#defined external_spec_condition/4.
|
|
||||||
#defined external_spec_condition/5.
|
|
||||||
#defined external_spec_condition/6.
|
|
||||||
|
|
||||||
%-----------------------------------------------------------------------------
|
%-----------------------------------------------------------------------------
|
||||||
% Config required semantics
|
% Config required semantics
|
||||||
@ -653,7 +643,7 @@ variant_default_not_used(Package, Variant, Value)
|
|||||||
external_with_variant_set(Package, Variant, Value)
|
external_with_variant_set(Package, Variant, Value)
|
||||||
:- attr("variant_value", Package, Variant, Value),
|
:- attr("variant_value", Package, Variant, Value),
|
||||||
condition_requirement(ID, "variant_value", Package, Variant, Value),
|
condition_requirement(ID, "variant_value", Package, Variant, Value),
|
||||||
possible_external(ID, Package, _),
|
imposed_constraint(ID, "external_conditions_hold", Package, _),
|
||||||
external(Package),
|
external(Package),
|
||||||
attr("node", Package).
|
attr("node", Package).
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user