mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-05-13 11:31:38 +00:00
inst-builder: Make add_breaks a bulk call
Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
6f97e36477
commit
bc1d3afa38
@ -53,14 +53,15 @@ def build_installability_tester(suite_info, archs):
|
|||||||
# Breaks/Conflicts are so simple that we do not need to keep align the relation
|
# 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.
|
# with the suite. This enables us to do a few optimizations.
|
||||||
if conflicts:
|
if conflicts:
|
||||||
|
rels = []
|
||||||
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]
|
||||||
for block in (relation for relation in conflicts):
|
for block in (relation for relation in conflicts):
|
||||||
# if a package satisfies its own conflicts relation, then it is using §7.6.2
|
# 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)
|
rels.extend(s.pkg_id for s in solvers(block, dep_binaries_s_a, dep_provides_s_a)
|
||||||
if s.pkg_id != pkg_id)
|
if s.pkg_id != pkg_id)
|
||||||
for r in rels:
|
if rels:
|
||||||
relations.add_breaks(r)
|
relations.add_breaks(rels)
|
||||||
|
|
||||||
for block in depends:
|
for block in depends:
|
||||||
sat = set()
|
sat = set()
|
||||||
@ -144,24 +145,24 @@ class _RelationBuilder(object):
|
|||||||
if not okay:
|
if not okay:
|
||||||
itbuilder._broken.add(binary)
|
itbuilder._broken.add(binary)
|
||||||
|
|
||||||
|
def add_breaks(self, breaks_relations):
|
||||||
|
"""Add a Breaks/Conflict-clauses
|
||||||
|
|
||||||
def add_breaks(self, broken_binary):
|
Marks the given binary as being broken by any of the packages.
|
||||||
"""Add a Breaks-clause
|
That is, the given package satisfies a relation
|
||||||
|
in either the "Breaks" or the "Conflicts" field for any of the
|
||||||
|
listed packages.
|
||||||
|
|
||||||
Marks the given binary as being broken by the current
|
:param breaks_relations: An list/set of BinaryPackageIDs that has a Breaks/Conflicts relation
|
||||||
package. That is, the given package satisfies a relation
|
on the current package
|
||||||
in either the "Breaks" or the "Conflicts" field. The binary
|
:return: None
|
||||||
given must be a (name, version, architecture)-tuple.
|
|
||||||
|
|
||||||
The binary is not required to have been added to the
|
|
||||||
InstallabilityTesterBuilder when this method is called. However,
|
|
||||||
it must be added before the "build()" method is called.
|
|
||||||
"""
|
"""
|
||||||
itbuilder = self._itbuilder
|
itbuilder = self._itbuilder
|
||||||
self._new_breaks.add(broken_binary)
|
self._new_breaks.update(breaks_relations)
|
||||||
reverse_relations = itbuilder._reverse_relations(broken_binary)
|
this_package = self._binary
|
||||||
reverse_relations[1].add(self._binary)
|
for broken_binary in breaks_relations:
|
||||||
|
reverse_relations = itbuilder._reverse_relations(broken_binary)
|
||||||
|
reverse_relations[1].add(this_package)
|
||||||
|
|
||||||
def _commit(self):
|
def _commit(self):
|
||||||
itbuilder = self._itbuilder
|
itbuilder = self._itbuilder
|
||||||
|
@ -134,8 +134,7 @@ class UniverseBuilder(object):
|
|||||||
with builder.relation_builder(pkg_id) as rel:
|
with builder.relation_builder(pkg_id) as rel:
|
||||||
for or_clause in pkg_builder._dependencies:
|
for or_clause in pkg_builder._dependencies:
|
||||||
rel.add_dependency_clause(or_clause)
|
rel.add_dependency_clause(or_clause)
|
||||||
for break_pkg_id in pkg_builder._conflicts:
|
rel.add_breaks(pkg_builder._conflicts)
|
||||||
rel.add_breaks(break_pkg_id)
|
|
||||||
return builder.build()
|
return builder.build()
|
||||||
|
|
||||||
def pkg_id(self, pkgish):
|
def pkg_id(self, pkgish):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user