refactor to single error predicate

This commit is contained in:
Gregory Becker
2022-05-19 14:12:21 -07:00
parent 8824040eda
commit 62d18d9af7
3 changed files with 96 additions and 348 deletions

View File

@@ -1934,149 +1934,8 @@ def node_os(self, pkg, os):
def node_target(self, pkg, target):
self._arch(pkg).target = target
def error_conflict_triggered(self, msg):
raise UnsatisfiableSpecError(msg)
def error_no_version(self, pkg):
raise UnsatisfiableSpecError("No versions available for package '%s'" % pkg)
def error_versions_conflict(self, pkg, version1, version2):
msg = ("No version for '%s' satisfies '@%s' and '@%s'" %
(pkg, version1, version2))
raise UnsatisfiableSpecError(msg)
def error_version_unsatisfiable(self, pkg, constraint):
msg = "No valid version for '%s' satisfies '@%s'" % (pkg, constraint)
raise UnsatisfiableSpecError(msg)
def error_no_variant_value(self, pkg, variant):
msg = "No valid variant '%s' of package '%s'" % (variant, pkg)
raise UnsatisfiableSpecError(msg)
def error_multiple_values_sv_variant(self, pkg, variant, value1, value2):
variant1 = spack.spec.Spec('%s=%s' % (variant, value1))
variant2 = spack.spec.Spec('%s=%s' % (variant, value2))
msg = "'%s' required multiple values for single-valued variant %s" % (pkg,
variant)
msg += "\n requested %s and %s" % (variant1, variant2)
raise UnsatisfiableSpecError(msg)
def error_invalid_variant_value(self, pkg, variant, value):
formatted = spack.spec.Spec('%s=%s' % (variant, value))
msg = ("'%s' is not a valid value for '%s' variant '%s'" %
(formatted, pkg, variant))
raise UnsatisfiableSpecError(msg)
def error_unnecessary(self, pkg):
msg = "'%s' is not a valid dependency for any package" % pkg
raise UnsatisfiableSpecError(msg)
def error_cyclic_dependency(self, pkg1, pkg2):
msg = "Cyclic dependency detected between '%s' an '%s'" % (pkg1, pkg2)
msg += "\n Consider changing variants to avoid the cyclic dependency"
raise UnsatisfiableSpecError(msg)
def error_no_provider(self, virtual):
msg = "Cannot find valid provider for virtual %s" % virtual
raise UnsatisfiableSpecError(msg)
def error_multiple_providers(self, virtual, provider1, provider2):
msg = "Spec cannot include multiple providers for virtual '%s'" % virtual
msg += "\n Requested %s and %s" % (provider1, provider2)
raise UnsatisfiableSpecError(msg)
def error_invalid_external_spec(self, pkg):
msg = "Attempted to use external for '%s'" % pkg
msg += " which does not satisfy any configured external spec"
raise UnsatisfiableSpecError(msg)
def error_inactive_variant_set(self, pkg, variant):
msg = "Cannot set variant '%s' for package '%s'" % (variant, pkg)
msg += " because the variant condition cannot be satisfied for the given spec"
raise UnsatisfiableSpecError(msg)
def error_disjoint_variant_values(self, pkg, variant, value1, value2):
msg = "%s variant %s cannot have both values %s and %s," % (
pkg, variant, value1, value2)
msg += " as they come from disjoint value sets"
raise UnsatisfiableSpecError(msg)
def error_variant_none_and_other(self, pkg, variant, value):
msg = ("%s variant '%s' cannot have values '%s' and 'none'" %
(pkg, variant, value))
raise UnsatisfiableSpecError(msg)
def error_no_os(self, pkg):
msg = "Cannot find valid operating system for '%s'" % pkg
raise UnsatisfiableSpecError(msg)
def error_multiple_os(self, pkg, os1, os2):
msg = "Cannot concretize %s with multiple operating systems" % pkg
msg += "\n Requested 'os=%s' and 'os=%s'" % (os1, os2)
raise UnsatisfiableSpecError(msg)
def error_os_not_buildable(self, pkg, os1):
msg = "Cannot concretize '%s os=%s'." % (pkg, os1)
msg += " Operating system '%s' is not buildable" % os1
raise UnsatisfiableSpecError(msg)
def error_os_incompatible(self, pkg, dep, p_os, d_os):
msg = "%s and dependency %s have incompatible operating systems" % (pkg, dep)
msg += "'os=%s' and 'os=%s'" % (p_os, d_os)
raise UnsatisfiableSpecError(msg)
def error_no_target(self, pkg):
msg = "Cannot find valid target for '%s'" % pkg
raise UnsatisfiableSpecError(msg)
def error_multiple_targets(self, pkg, target1, target2):
msg = "Cannot concretize %s with multiple targets" % pkg
msg += "\n Requested 'target=%s' and 'target=%s'" % (target1, target2)
raise UnsatisfiableSpecError(msg)
def error_target_unsatisfiable(self, pkg, target, constraint):
msg = "%s cannot satisfy constraint 'target=%s'" % (pkg, constraint)
raise UnsatisfiableSpecError(msg)
def error_target_incompatible(self, pkg, dep):
msg = "Cannot find compatible targets for %s and %s" % (pkg, dep)
raise UnsatisfiableSpecError(msg)
def error_compiler_target_mismatch(self, pkg, target, compiler, version):
msg = ("%s compiler %s@%s incompatible with target %s" %
(pkg, compiler, version, target))
raise UnsatisfiableSpecError(msg)
def error_invalid_target(self, pkg, target):
msg = "'%s target=%s' is not compatible with this machine" % (pkg, target)
raise UnsatisfiableSpecError(msg)
def error_no_compiler_version(self, pkg):
raise UnsatisfiableSpecError("%s has no compiler version" % pkg)
def error_multiple_compiler_versions(self, pkg, compiler1, ver1, compiler2, ver2):
msg = "%s compilers %s@%s and %s@%s incompatible" % (
pkg, compiler1, ver1, compiler2, ver2)
raise UnsatisfiableSpecError(msg)
def error_compiler_os_mismatch(self, pkg, compiler, version, os):
msg = ("%s compiler '%s@%s' incompatible with 'os=%s'" %
(pkg, compiler, version, os))
raise UnsatisfiableSpecError(msg)
def error_no_platform(self, pkg):
raise UnsatisfiableSpecError("No valid platform found for %s" % pkg)
def error_multiple_platforms(self, pkg, platform1, platform2):
msg = "Cannot concretize %s with multiple platforms" % pkg
msg += "\n Requested 'platform=%s' and 'platform=%s'" % (
platform1, platform2)
raise UnsatisfiableSpecError(msg)
def error_node_compiler_version_unsatisfiable(self, pkg, compiler, constraint):
msg = "No valid version for '%s' compiler '%s'" % (pkg, compiler)
msg += " satisfies '@%s'" % constraint
raise UnsatisfiableSpecError(msg)
def error(self, priority, msg, *args):
raise UnsatisfiableSpecError(msg.format(*args))
def variant_value(self, pkg, name, value):
# FIXME: is there a way not to special case 'dev_path' everywhere?
@@ -2203,18 +2062,17 @@ def deprecated(self, pkg, version):
@staticmethod
def sort_fn(function_tuple):
name = function_tuple[0]
if name == 'conflict_triggered':
return -5
elif name.startswith('error_'):
return -4
if name == 'error':
priority = function_tuple[1][0]
return (-4, priority)
elif name == 'hash':
return -3
return (-3, 0)
elif name == 'node':
return -2
return (-2, 0)
elif name == 'node_compiler':
return -1
return (-1, 0)
else:
return 0
return (0, 0)
def build_specs(self, function_tuples):
# Functions don't seem to be in particular order in output. Sort
@@ -2240,15 +2098,16 @@ def build_specs(self, function_tuples):
# ignore predicates on virtual packages, as they're used for
# solving but don't construct anything. Do not ignore error
# predicates on virtual packages.
pkg = args[0]
if spack.repo.path.is_virtual(pkg) and not name.startswith('error_'):
continue
if name != 'error':
pkg = args[0]
if spack.repo.path.is_virtual(pkg):
continue
# if we've already gotten a concrete spec for this pkg,
# do not bother calling actions on it.
spec = self._specs.get(pkg)
if spec and spec.concrete:
continue
# if we've already gotten a concrete spec for this pkg,
# do not bother calling actions on it.
spec = self._specs.get(pkg)
if spec and spec.concrete:
continue
action(*args)

View File

@@ -38,15 +38,17 @@ version_declared(Package, Version) :- version_declared(Package, Version, _).
% possible
{ version(Package, Version) : version_declared(Package, Version) }
:- node(Package).
error_versions_conflict(Package, Version1, Version2)
error(2, "No version for '{0}' satisfies '@{1}' and '@{2}'", Package, Version1, Version2)
:- node(Package),
version(Package, Version1),
version(Package, Version2),
Version1 < Version2. % see[1]
error_no_version(Package) :- node(Package), not version(Package, _).
error(2, "No versions available for package '{0}'", Package)
:- node(Package), not version(Package, _).
% A virtual package may or may not have a version, but never has more than one
error_versions_conflict(Virtual, Version1, Version2)
error(2, "No version for '{0}' satisfies '@{1}' and '@{2}'", Virtual, Version1, Version2)
:- virtual_node(Virtual),
version(Virtual, Version1),
version(Virtual, Version2),
@@ -74,7 +76,7 @@ version_weight(Package, Weight)
% More specific error message if the version cannot satisfy some constraint
% Otherwise covered by `no_version_error` and `versions_conflict_error`.
error_version_unsatisfiable(Package, Constraint)
error(1, "No valid version for '{0}' satisfies '@{1}'", Package, Constraint)
:- node_version_satisfies(Package, Constraint),
C = #count{ Version : version(Package, Version), version_satisfies(Package, Constraint, Version)},
C < 1.
@@ -84,9 +86,6 @@ node_version_satisfies(Package, Constraint)
#defined version_satisfies/3.
#defined deprecated_version/2.
#defined error_version_unsatisfiable/2.
#defined error_versions_conflict/3.
#defined error_no_version/1.
%-----------------------------------------------------------------------------
% Spec conditions and imposed constraints
@@ -179,31 +178,32 @@ node(Dependency) :- node(Package), depends_on(Package, Dependency).
% dependencies) and get a two-node unconnected graph
needed(Package) :- root(Package).
needed(Dependency) :- needed(Package), depends_on(Package, Dependency).
error_unnecessary(Package) :- node(Package), not needed(Package).
error(1, "'{0}' is not a valid dependency for any package in the DAG", Package)
:- node(Package),
not needed(Package).
% Avoid cycles in the DAG
% some combinations of conditional dependencies can result in cycles;
% this ensures that we solve around them
path(Parent, Child) :- depends_on(Parent, Child).
path(Parent, Descendant) :- path(Parent, A), depends_on(A, Descendant).
error_cyclic_dependency(A, B) :- path(A, B), path(B, A).
error(2, "Cyclic dependency detected between '{0}' and '{1}'\n Consider changing variants to avoid the cycle", A, B)
:- path(A, B),
path(B, A).
#defined error_unnecessary/1.
#defined error_cyclic_dependency/2.
#defined dependency_type/2.
#defined dependency_condition/3.
%-----------------------------------------------------------------------------
% Conflicts
%-----------------------------------------------------------------------------
error_conflict_triggered(Msg) :- node(Package),
error(0, Msg) :- node(Package),
conflict(Package, TriggerID, ConstraintID, Msg),
condition_holds(TriggerID),
condition_holds(ConstraintID),
not external(Package). % ignore conflicts for externals
#defined conflict/4.
#defined error_conflict_triggered/1.
%-----------------------------------------------------------------------------
% Virtual dependencies
@@ -225,11 +225,11 @@ virtual_node(Virtual)
% The provider must be selected among the possible providers.
{ provider(Package, Virtual) : possible_provider(Package, Virtual) }
:- virtual_node(Virtual).
error_no_provider(Virtual)
error(2, "Cannot find valid provider for virtual {0}", Virtual)
:- virtual_node(Virtual),
P = #count{ Package : provider(Package, Virtual)},
P < 1.
error_multiple_providers(Virtual, P1, P2)
error(2, "Spec cannot include multiple providers for virtual '{0}'\n Requested '{1}' and '{2}'", Virtual, P1, P2)
:- virtual_node(Virtual),
provider(P1, Virtual),
provider(P2, Virtual),
@@ -261,8 +261,6 @@ virtual_condition_holds(Provider, Virtual) :-
internal_error("Virtual when provides not respected").
#defined possible_provider/2.
#defined error_no_provider/1.
#defined error_multiple_providers/3.
%-----------------------------------------------------------------------------
% Virtual dependency weights
@@ -378,10 +376,10 @@ attr("node_compiler_version_satisfies", Package, Compiler, Version)
{ external_version(Package, Version, Weight):
version_declared(Package, Version, Weight, "external") }
:- external(Package).
error_invalid_external_spec(Package)
error(2, "Attempted to use external for '{0}' which does not satisfy any configured external spec", Package)
:- external(Package),
not external_version(Package, _, _).
error_invalid_external_spec(Package)
error(2, "Attempted to use external for '{0}' which does not satisfy any configured external spec", Package)
:- external(Package),
external_version(Package, Version1, Weight1),
external_version(Package, Version2, Weight2),
@@ -417,14 +415,15 @@ external_conditions_hold(Package, LocalIndex) :-
% it cannot happen that a spec is external, but none of the external specs
% conditions hold.
error_invalid_external_spec(Package) :- external(Package), not external_conditions_hold(Package, _).
error(2, "Attempted to use external for '{0}' which does not satisfy any configured external spec", Package)
:- external(Package),
not 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 error_invalid_external_spec/1.
%-----------------------------------------------------------------------------
% Variant semantics
@@ -435,13 +434,13 @@ variant(Package, Variant) :- variant_condition(ID, Package, Variant),
condition_holds(ID).
% a variant cannot be set if it is not a variant on the package
error_inactive_variant_set(Package, Variant)
error(2, "Cannot set variant '{0}' for package '{1}' because the variant condition cannot be satisfied for the given spec", Package, Variant)
:- variant_set(Package, Variant),
not variant(Package, Variant),
build(Package).
% a variant cannot take on a value if it is not a variant of the package
error_inactive_variant_set(Package, Variant)
error(2, "Cannot set variant '{0}' for package '{1}' because the variant condition cannot be satisfied for the given spec", Package, Variant)
:- variant_value(Package, Variant, _),
not variant(Package, Variant),
build(Package).
@@ -463,7 +462,7 @@ variant_value(Package, Variant, Value) :-
variant(Package, Variant),
build(Package).
error_multiple_values_sv_variant(Package, Variant, Value1, Value2)
error(2, "'{0}' required multiple values for single-valued variant '{1}'\n Requested '$Spec({1}={2})$ and '$Spec({1}={3})$'", Package, Variant, Value1, Value2)
:- node(Package),
variant(Package, Variant),
variant_single_value(Package, Variant),
@@ -471,7 +470,7 @@ error_multiple_values_sv_variant(Package, Variant, Value1, Value2)
variant_value(Package, Variant, Value1),
variant_value(Package, Variant, Value2),
Value1 < Value2. % see[1]
error_no_variant_value(Package, Variant)
error(2, "No valid value for variant '{1}' of package '{0}'", Package, Variant)
:- node(Package),
variant(Package, Variant),
build(Package),
@@ -484,7 +483,7 @@ variant_set(Package, Variant) :- variant_set(Package, Variant, _).
% A variant cannot have a value that is not also a possible value
% This only applies to packages we need to build -- concrete packages may
% have been built w/different variants from older/different package versions.
error_invalid_variant_value(Package, Variant, Value)
error(1, "'$Spec({1}={2})$' is not a valid value for '{0}' variant '{1}'", Package, Variant, Value)
:- variant_value(Package, Variant, Value),
not variant_possible_value(Package, Variant, Value),
build(Package).
@@ -492,7 +491,7 @@ error_invalid_variant_value(Package, Variant, Value)
% Some multi valued variants accept multiple values from disjoint sets.
% Ensure that we respect that constraint and we don't pick values from more
% than one set at once
error_disjoint_variant_values(Package, Variant, Value1, Value2)
error(2, "{0} variant '{1}' cannot have values '{2}' and '{3}' as they come from disjoing value sets", Package, Variant, Value1, Value2)
:- variant_value(Package, Variant, Value1),
variant_value(Package, Variant, Value2),
variant_value_from_disjoint_sets(Package, Variant, Value1, Set1),
@@ -556,7 +555,7 @@ variant_default_value(Package, Variant, Value) :- variant_default_value_from_cli
% Treat 'none' in a special way - it cannot be combined with other
% values even if the variant is multi-valued
error_variant_none_and_other(Package, Variant, Value)
error(2, "{0} variant '{1}' cannot have values '{2}' and 'none'", Package, Variant, Value)
:- variant_value(Package, Variant, Value),
variant_value(Package, Variant, "none"),
Value != "none",
@@ -586,12 +585,6 @@ variant_single_value(Package, "dev_path")
#defined variant_default_value_from_packages_yaml/3.
#defined variant_default_value_from_package_py/3.
#defined variant_value_from_disjoint_sets/4.
#defined error_invalid_variant_value/3.
#defined error_multiple_values_sv_variant/4.
#defined error_no_variant_value/2.
#defined error_disjoint_variant_values/4.
#defined error_variant_none_and_other/3.
#defined error_inactive_variant_set/2.
%-----------------------------------------------------------------------------
% Platform semantics
@@ -611,20 +604,18 @@ node_platform(Package, Platform)
node_platform_set(Package) :- node_platform_set(Package, _).
% each node must have a single platform
error_no_platform(Package)
error(2, "No valid platform found for {0}", Package)
:- node(Package),
C = #count{ Platform : node_platform(Package, Platform)},
C < 1.
error_multiple_platforms(Package, Platform1, Platform2)
error(2, "Cannot concretize {0} with multiple platforms\n Requested 'platform={1}' and 'platform={2}'", Package, Platform1, Platform2)
:- node(Package),
node_platform(Package, Platform1),
node_platform(Package, Platform2),
Platform1 < Platform2. % see[1]
#defined node_platform_set/2. % avoid warnings
#defined error_no_platform/1.
#defined error_multiple_platforms/3.
%-----------------------------------------------------------------------------
% OS semantics
@@ -634,18 +625,26 @@ os(OS) :- os(OS, _).
% one os per node
{ node_os(Package, OS) : os(OS) } :- node(Package).
error_no_os(Package) :- node(Package), C = #count{ OS : node_os(Package, OS)}, C < 1.
error_multiple_os(Package, OS1, OS2)
error(2, "Cannot find valid operating system for '{0}'", Package)
:- node(Package),
C = #count{ OS : node_os(Package, OS)},
C < 1.
error(2, "Cannot concretize {0} with multiple operating systems\n Requested 'os={1}' and 'os={2}'", Package, OS1, OS2)
:- node(Package),
node_os(Package, OS1),
node_os(Package, OS2),
OS1 < OS2. %see [1]
% can't have a non-buildable OS on a node we need to build
error_os_not_buildable(Package, OS) :- build(Package), node_os(Package, OS), not buildable_os(OS).
error(2, "Cannot concretize '{0} os={1}'. Operating system '{1}' is not buildable", Package, OS)
:- build(Package),
node_os(Package, OS),
not buildable_os(OS).
% can't have dependencies on incompatible OS's
error_os_incompatible(Package, Dependency, PackageOS, DependencyOS)
error(2, "{0} and dependency {1} have incompatible operating systems 'os={2}' and 'os={3}'", Package, Dependency, PackageOS, DependencyOS)
:- depends_on(Package, Dependency),
node_os(Package, PackageOS),
node_os(Dependency, DependencyOS),
@@ -676,10 +675,6 @@ node_os(Package, OS) :- node_os_set(Package, OS), node(Package).
#defined node_os_set/2.
#defined os_compatible/2.
#defined error_no_os/1.
#defined error_multiple_os/3.
#defined error_os_not_buildable/2.
#defined error_os_incompatible/4.
%-----------------------------------------------------------------------------
% Target semantics
@@ -687,15 +682,20 @@ node_os(Package, OS) :- node_os_set(Package, OS), node(Package).
% Each node has only one target chosen among the known targets
{ node_target(Package, Target) : target(Target) } :- node(Package).
error_no_target(Package) :- node(Package), C = #count{Target : node_target(Package, Target)}, C < 1.
error_multiple_targets(Package, Target1, Target2)
error(2, "Cannot find valid target for '{0}'", Package)
:- node(Package),
C = #count{Target : node_target(Package, Target)},
C < 1.
error(2, "Cannot concretize '{0}' with multiple targets\n Requested 'target={1}' and 'target={2}'", Package, Target1, Target2)
:- node(Package),
node_target(Package, Target1),
node_target(Package, Target2),
Target1 < Target2. % see[1]
% If a node must satisfy a target constraint, enforce it
error_target_unsatisfiable(Package, Target, Constraint)
error(1, "'{0} target={1}' cannot satisfy constraint 'target={2}'", Package, Target, Constraint)
:- node_target(Package, Target),
node_target_satisfies(Package, Constraint),
not target_satisfies(Constraint, Target).
@@ -706,7 +706,7 @@ node_target_satisfies(Package, Constraint)
:- node_target(Package, Target), target_satisfies(Constraint, Target).
% If a node has a target, all of its dependencies must be compatible with that target
error_target_incompatible(Package, Dependency)
error(2, "Cannot find compatible targets for {0} and {1}", Package, Dependency)
:- depends_on(Package, Dependency),
node_target(Package, Target),
not node_target_compatible(Dependency, Target).
@@ -750,7 +750,7 @@ target_weight(Target, Package, Weight)
:- package_target_weight(Target, Package, Weight).
% can't use targets on node if the compiler for the node doesn't support them
error_compiler_target_mismatch(Package, Target, Compiler, Version)
error(2, "{0} compiler '{2}@{3}' incompatible with 'target={1}'", Package, Target, Compiler, Version)
:- node_target(Package, Target),
not compiler_supports_target(Compiler, Version, Target),
node_compiler(Package, Compiler),
@@ -782,7 +782,7 @@ node_target_mismatch(Parent, Dependency)
not node_target_match(Parent, Dependency).
% disallow reusing concrete specs that don't have a compatible target
error_invalid_target(Package, Target)
error(2, "'{0} target={1}' is not compatible with this machine", Package, Target)
:- node(Package),
node_target(Package, Target),
not target(Target).
@@ -790,13 +790,6 @@ error_invalid_target(Package, Target)
#defined node_target_set/2.
#defined package_target_weight/3.
#defined error_no_target/1.
#defined error_multiple_target/3.
#defined error_target_unsatisfiable/3.
#defined error_target_incompatible/2.
#defined error_compiler_target_mismatch/4.
#defined error_invalid_target/2.
%-----------------------------------------------------------------------------
% Compiler semantics
%-----------------------------------------------------------------------------
@@ -808,11 +801,11 @@ compiler(Compiler) :- compiler_version(Compiler, _).
node(Package),
build(Package).
error_no_compiler_version(Package)
error(2, "No valid compiler version found for '{0}'", Package)
:- node(Package),
C = #count{ Version : node_compiler_version(Package, _, Version)},
C < 1.
error_multiple_compiler_versions(Package, Compiler1, Version1, Compiler2, Version2)
error(2, "'{0}' compiler constraints '%{1}@{2}' and '%{3}@{4}' are incompatible", Package, Compiler1, Version1, Compiler2, Version2)
:- node(Package),
node_compiler_version(Package, Compiler1, Version1),
node_compiler_version(Package, Compiler2, Version2),
@@ -827,9 +820,16 @@ node_compiler(Package, Compiler) :- node_compiler_version(Package, Compiler, _).
Compiler1 != Compiler2,
internal_error("Mismatch between selected compiler and compiler version").
% If the compiler of a node cannot be satisfied, raise
error(1, "No valid compiler for {0} satisfies '%{1}'", Package, Compiler)
:- node(Package),
node_compiler_version_satisfies(Package, Compiler, ":"),
C = #count{ Version : node_compiler_version(Package, Compiler, Version), compiler_version_satisfies(Compiler, ":", Version) },
C < 1.
% If the compiler of a node must satisfy a constraint, then its version
% must be chosen among the ones that satisfy said constraint
error_node_compiler_version_unsatisfiable(Package, Compiler, Constraint)
error(2, "No valid version for '{0}' compiler '{1}' satisfies '@{2}'", Package, Compiler, Constraint)
:- node(Package),
node_compiler_version_satisfies(Package, Compiler, Constraint),
C = #count{ Version : node_compiler_version(Package, Compiler, Version), compiler_version_satisfies(Compiler, Constraint, Version) },
@@ -851,7 +851,7 @@ node_compiler_version(Package, Compiler, Version) :- node_compiler_version_set(P
% Cannot select a compiler if it is not supported on the OS
% Compilers that are explicitly marked as allowed
% are excluded from this check
error_compiler_os_mismatch(Package, Compiler, Version, OS)
error(2, "{0} compiler '%{1}@{2}' incompatible with 'os={3}'", Package, Compiler, Version, OS)
:- node_compiler_version(Package, Compiler, Version),
node_os(Package, OS),
not compiler_supports_os(Compiler, Version, OS),
@@ -873,10 +873,6 @@ compiler_mismatch(Package, Dependency)
#defined node_compiler_version_set/3.
#defined compiler_supports_os/3.
#defined allow_compiler/2.
#defined error_no_compiler_version/1.
#defined error_multiple_compiler_versions/5.
#defined error_compiler_os_mismatch/4.
#defined error_node_compiler_version_unsatisfiable/3.
% compilers weighted by preference according to packages.yaml
compiler_weight(Package, Weight)
@@ -1009,98 +1005,16 @@ build_priority(Package, 0) :- node(Package), not optimize_for_reuse().
% Some errors are handled as rules instead of constraints because
% it allows us to explain why something failed. Here we optimize
% HEAVILY against the facts generated by those rules.
#minimize{ 0@1000: #true }.
#minimize{ 1000@1000,Msg: error_conflict_triggered(Msg) }.
#minimize{ 0@1000: #true}.
#minimize{ 0@1001: #true}.
#minimize{ 0@1002: #true}.
#minimize{ 0@1001: #true }.
#minimize{ 1000@1001,Package,Variant,Value1,Value2: error_multiple_values_sv_variant(Package, Variant, Value1, Value2) }.
#minimize{ 0@1002: #true }.
#minimize{ 1000@1002,Package,Variant: error_no_variant_value(Package, Variant) }.
#minimize{ 0@1003: #true }.
#minimize{ 1000@1003,Package,Variant,Value: error_invalid_variant_value(Package, Variant, Value) }.
#minimize{ 0@1004: #true }.
#minimize{ 1000@1004,Package : error_no_version(Package) }.
#minimize{ 0@1005: #true }.
#minimize{ 1000@1005,Package,Version1,Version2 : error_versions_conflict(Package, Version1, Version2) }.
#minimize{ 0@1006: #true }.
#minimize{ 1000@1006,Package,Constraint : error_version_unsatisfiable(Package, Constraint) }.
#minimize{ 0@1007: #true }.
#minimize{ 1000@1007,Package : error_unnecessary(Package) }.
#minimize{ 0@1008: #true }.
#minimize{ 1000@1008,Package1,Package2 : error_cyclic_dependency(Package1, Package2) }.
#minimize{ 0@1009: #true }.
#minimize{ 1000@1009,Virtual : error_no_provider(Virtual) }.
#minimize{ 0@1010: #true }.
#minimize{ 1000@1010,Virtual,Package1,Package2 : error_multiple_providers(Virtual, Package1, Package2) }.
#minimize{ 0@1011: #true }.
#minimize{ 1000@1011,Package : error_invalid_external_spec(Package) }.
#minimize{ 0@1012: #true }.
#minimize{ 1000@1012,Package,Variant : error_inactive_variant_set(Package, Variant) }.
#minimize{ 0@1013: #true }.
#minimize{ 1000@1013,Package,Variant,Value1,Value2 : error_disjoint_variant_values(Package, Variant, Value1, Value2) }.
#minimize{ 0@1014: #true }.
#minimize{ 1000@1014,Package,Variant,Value : error_variant_none_and_other(Package, Variant, Value) }.
#minimize{ 0@1015: #true }.
#minimize{ 1000@1015,Package : error_no_os(Package) }.
#minimize{ 0@1016: #true }.
#minimize{ 1000@1016,Package,OS1,OS2 : error_multiple_os(Package, OS1, OS2) }.
#minimize{ 0@1017: #true }.
#minimize{ 1000@1017,Package,OS : error_os_not_buildable(Package, OS) }.
#minimize{ 0@1018: #true }.
#minimize{ 1000@1018,Package,Dependency,POS,DOS : error_os_incompatible(Package, Dependency, POS, DOS) }.
#minimize{ 0@1019: #true }.
#minimize{ 1000@1019,Package : error_no_target(Package) }.
#minimize{ 0@1020: #true }.
#minimize{ 1000@1020,Package,Target1, Target2 : error_multiple_targets(Package, Target1, Target2) }.
#minimize{ 0@1021: #true }.
#minimize{ 1000@1021,Package,Target,Constraint : error_target_unsatisfiable(Package, Target, Constraint) }.
#minimize{ 0@1022: #true }.
#minimize{ 1000@1022,Package,Dependency : error_target_incompatible(Package, Dependency) }.
#minimize{ 0@1023: #true }.
#minimize{ 1000@1023,Package,Target,Compiler,Version : error_compiler_target_mismatch(Package, Target, Compiler, Version) }.
#minimize{ 0@1024: #true }.
#minimize{ 1000@1024,Package,Target : error_invalid_target(Package, Target) }.
#minimize{ 0@1025: #true }.
#minimize{ 1000@1025,Package : error_no_compiler_version(Package) }.
#minimize{ 0@1026: #true }.
#minimize{ 1000@1026,Package,Compiler1,Version1,Compiler2,Version2 : error_multiple_compiler_versions(Package, Compiler1, Version1, Compiler2, Version2) }.
#minimize{ 0@1027: #true }.
#minimize{ 1000@1027,Package,Compiler,Version,OS : error_compiler_os_mismatch(Package, Compiler, Version, OS) }.
#minimize{ 0@1028: #true }.
#minimize{ 1000@1028,Package : error_no_platform(Package) }.
#minimize{ 0@1029: #true }.
#minimize{ 1000@1029,Package,Platform1,Platform2 : error_multiple_platforms(Package, Platform1, Platform2) }.
#minimize{ 0@1030: #true }.
#minimize{ 1000@1030,Package,Compiler,Constraint : error_node_compiler_version_unsatisfiable(Package, Compiler, Constraint) }.
#minimize{ 1000@1000+Priority,Msg: error(Priority, Msg) }.
#minimize{ 1000@1000+Priority,Msg,Arg1: error(Priority, Msg, Arg1) }.
#minimize{ 1000@1000+Priority,Msg,Arg1,Arg2: error(Priority, Msg, Arg1, Arg2) }.
#minimize{ 1000@1000+Priority,Msg,Arg1,Arg2,Arg3: error(Priority, Msg, Arg1, Arg2, Arg3) }.
#minimize{ 1000@1000+Priority,Msg,Arg1,Arg2,Arg3,Arg4: error(Priority, Msg, Arg1, Arg2, Arg3, Arg4) }.
#minimize{ 1000@1000+Priority,Msg,Arg1,Arg2,Arg3,Arg4,Arg5: error(Priority, Msg, Arg1, Arg2, Arg3, Arg4, Arg5) }.
%-----------------------------------------------------------------------------
% How to optimize the spec (high to low priority)

View File

@@ -36,36 +36,11 @@
#show deprecated/2.
% error types
#show error_conflict_triggered/1.
#show error_no_version/1.
#show error_versions_conflict/3.
#show error_no_variant_value/2.
#show error_multiple_values_sv_variant/4.
#show error_invalid_variant_value/3.
#show error_version_unsatisfiable/2.
#show error_unnecessary/1.
#show error_cyclic_dependency/2.
#show error_no_provider/1.
#show error_multiple_providers/3.
#show error_invalid_external_spec/1.
#show error_inactive_variant_set/2.
#show error_disjoint_variant_values/4.
#show error_variant_none_and_other/3.
#show error_no_os/1.
#show error_multiple_os/3.
#show error_os_not_buildable/2.
#show error_os_incompatible/4.
#show error_no_target/1.
#show error_multiple_targets/3.
#show error_target_unsatisfiable/3.
#show error_target_incompatible/2.
#show error_compiler_target_mismatch/4.
#show error_invalid_target/2.
#show error_no_compiler_version/1.
#show error_multiple_compiler_versions/5.
#show error_compiler_os_mismatch/4.
#show error_no_platform/1.
#show error_multiple_platforms/3.
#show error_node_compiler_version_unsatisfiable/3.
#show error/2.
#show error/3.
#show error/4.
#show error/5.
#show error/6.
#show error/7.
% debug