Exempt "compilers" and "runtimes" from default requirements

This commit is contained in:
Massimiliano Culpo
2024-11-12 11:12:26 +01:00
parent 1ddc0e6b52
commit 27e2e146e2
3 changed files with 15 additions and 9 deletions

View File

@@ -3129,7 +3129,7 @@ def visit(node):
arg = ast_sym(ast_sym(term.atom).arguments[0])
symbol = AspFunction(name)(arg.string)
self.assumptions.append((parse_term(str(symbol)), True))
self.gen.asp_problem.append(f"{symbol}.\n")
self.gen.asp_problem.append(f"{{ {symbol} }}.\n")
path = os.path.join(parent_dir, "concretize.lp")
parse_files([path], visit)

View File

@@ -316,18 +316,21 @@ possible_version_weight(node(ID, Package), Weight)
% 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) : pkg_fact(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),
pkg_fact(Package, version_satisfies(Constraint, _)),
internal_error("must choose a single version to satisfy version constraints").
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)
error(1, "Cannot satisfy '{0}@{1}'", Package, Constraint)
:- attr("node_version_satisfies", node(ID, Package), Constraint),
attr("version", node(ID, Package), Version),
not pkg_fact(Package, version_satisfies(Constraint, Version)).
error(10, "Cannot satisfy '{0}@{1}'", Package, Constraint)
:- attr("node_version_satisfies", node(ID, Package), Constraint),
not attr("version", node(ID, Package), _).
attr("node_version_satisfies", node(ID, Package), Constraint)
:- attr("version", node(ID, Package), Version),
pkg_fact(Package, version_satisfies(Constraint, Version)).
@@ -1245,7 +1248,7 @@ propagated_flag(node(PackageID, Package), node_flag(FlagType, Flag, FlagGroup, S
attr("node_flag", PackageNode, NodeFlag) :- propagated_flag(PackageNode, NodeFlag, _).
% Cannot propagate the same flag from two distinct sources
error(100, "{0} and {1} cannot both propagate compiler flags '{2}' to {3}", Source1, Source2, Package, FlagType) :-
error(100, "{0} and {1} cannot both propagate compiler flags '{2}' to {3}", Source1, Source2, FlagType, Package) :-
propagated_flag(node(ID, Package), node_flag(FlagType, _, _, _), node(_, Source1)),
propagated_flag(node(ID, Package), node_flag(FlagType, _, _, _), node(_, Source2)),
Source1 < Source2.
@@ -1278,7 +1281,7 @@ has_built_packages() :- build(X), not external(X).
% FIXME (compiler as nodes): is this version constraint always required and better than the callback?
% "gcc-runtime" and the "gcc" it depends on must be at the same version
% attr("version", node(X, "gcc"), Version) :-
% attr("version", node(Y, "gcc"), Version) :-
% attr("version", node(X, "gcc-runtime"), Version),
% attr("depends_on", node(X, "gcc-runtime"), node(Y, "gcc"), "build").