solver: Extract a function from _comute_group_order_adds

Signed-off-by: Niels Thykier <niels@thykier.net>
ubuntu/rebased
Niels Thykier 6 years ago
parent 259fecf6cf
commit b306700376
No known key found for this signature in database
GPG Key ID: A65B78DBE67C7AAC

@ -183,19 +183,8 @@ class InstallabilitySolver(object):
if rdep in ptable:
apply_order(key, rdep, ptable, order, False, debug_solver, logger)
def _compute_group_order_adds(self, adds, order, key, ptable, going_out, going_in):
sat_in_testing = self._inst_tester.any_of_these_are_in_the_suite
universe = self._universe
debug_solver = self.logger.isEnabledFor(logging.DEBUG)
for depgroup in chain.from_iterable(universe.dependencies_of(a) for a in adds):
# Check if this item should migrate before others
# (e.g. because they depend on a new [version of a]
# binary provided by this item).
rigid = depgroup - going_out
if sat_in_testing(rigid):
# (partly) satisfied by testing, assume it is okay
continue
# okay - we got three cases now.
def _compute_order_for_dependency(self, key, depgroup, ptable, order, going_in, debug_solver):
# We got three cases:
# - "swap" (replace existing binary with a newer version)
# - "addition" (add new binary without removing any)
# - "removal" (remove binary without providing a new)
@ -228,6 +217,20 @@ class InstallabilitySolver(object):
order[key].before.add(other)
order[other].after.add(key)
def _compute_group_order_adds(self, adds, order, key, ptable, going_out, going_in):
debug_solver = self.logger.isEnabledFor(logging.DEBUG)
sat_in_testing = self._inst_tester.any_of_these_are_in_the_suite
universe = self._universe
for depgroup in chain.from_iterable(universe.dependencies_of(a) for a in adds):
# Check if this item should migrate before others
# (e.g. because they depend on a new [version of a]
# binary provided by this item).
rigid = depgroup - going_out
if sat_in_testing(rigid):
# (partly) satisfied by testing, assume it is okay
continue
self._compute_order_for_dependency(key, depgroup, ptable, order, going_in, debug_solver)
def _compute_group_order(self, groups, key2item):
universe = self._universe
ptable = {}

Loading…
Cancel
Save