mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-05-18 14:01:33 +00:00
inst-builder: Split relation loop and optimize conflicts
Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
6a3d100b92
commit
6f97e36477
@ -50,24 +50,25 @@ def build_installability_tester(suite_info, archs):
|
|||||||
|
|
||||||
with builder.relation_builder(pkg_id) as relations:
|
with builder.relation_builder(pkg_id) as relations:
|
||||||
|
|
||||||
for (al, dep) in [(depends, True), (conflicts, False)]:
|
# Breaks/Conflicts are so simple that we do not need to keep align the relation
|
||||||
|
# with the suite. This enables us to do a few optimizations.
|
||||||
|
if conflicts:
|
||||||
|
for dep_suite in suite_info:
|
||||||
|
dep_binaries_s_a, dep_provides_s_a = dep_suite.binaries[arch]
|
||||||
|
for block in (relation for relation in conflicts):
|
||||||
|
# if a package satisfies its own conflicts relation, then it is using §7.6.2
|
||||||
|
rels = (s.pkg_id for s in solvers(block, dep_binaries_s_a, dep_provides_s_a)
|
||||||
|
if s.pkg_id != pkg_id)
|
||||||
|
for r in rels:
|
||||||
|
relations.add_breaks(r)
|
||||||
|
|
||||||
for block in al:
|
for block in depends:
|
||||||
sat = set()
|
sat = set()
|
||||||
|
|
||||||
for dep_suite in suite_info:
|
for dep_suite in suite_info:
|
||||||
dep_binaries_s_a, dep_provides_s_a = dep_suite.binaries[arch]
|
dep_binaries_s_a, dep_provides_s_a = dep_suite.binaries[arch]
|
||||||
pkgs = solvers(block, dep_binaries_s_a, dep_provides_s_a)
|
sat.update(s.pkg_id for s in solvers(block, dep_binaries_s_a, dep_provides_s_a))
|
||||||
for pdata in pkgs:
|
|
||||||
dep_pkg_id = pdata.pkg_id
|
|
||||||
if dep:
|
|
||||||
sat.add(dep_pkg_id)
|
|
||||||
elif pkg_id != dep_pkg_id:
|
|
||||||
# if t satisfies its own
|
|
||||||
# conflicts relation, then it
|
|
||||||
# is using §7.6.2
|
|
||||||
relations.add_breaks(dep_pkg_id)
|
|
||||||
if dep:
|
|
||||||
if len(block) != 1:
|
if len(block) != 1:
|
||||||
relations.add_dependency_clause(sat)
|
relations.add_dependency_clause(sat)
|
||||||
else:
|
else:
|
||||||
@ -96,7 +97,6 @@ def build_installability_tester(suite_info, archs):
|
|||||||
else:
|
else:
|
||||||
possible_dep_ranges[key] = sat
|
possible_dep_ranges[key] = sat
|
||||||
|
|
||||||
if dep:
|
|
||||||
for clause in possible_dep_ranges.values():
|
for clause in possible_dep_ranges.values():
|
||||||
relations.add_dependency_clause(clause)
|
relations.add_dependency_clause(clause)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user