solver: Merge some loops to reduce nesting level

Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
Niels Thykier 2019-01-19 18:18:11 +00:00
parent b61e1086bd
commit af20634b12
No known key found for this signature in database
GPG Key ID: A65B78DBE67C7AAC

View File

@ -146,10 +146,9 @@ class InstallabilitySolver(object):
sat_in_testing = self._inst_tester.any_of_these_are_in_the_suite
universe = self._universe
debug_solver = self.logger.isEnabledFor(logging.DEBUG)
for r in rms:
for rdep in chain.from_iterable(universe.reverse_dependencies_of(r) for r in rms):
# The binaries have reverse dependencies in testing;
# check if we can/should migrate them first.
for rdep in universe.reverse_dependencies_of(r):
for depgroup in universe.dependencies_of(rdep):
rigid = depgroup - going_out
if sat_in_testing(rigid):
@ -169,11 +168,10 @@ class InstallabilitySolver(object):
sat_in_testing = self._inst_tester.any_of_these_are_in_the_suite
universe = self._universe
debug_solver = self.logger.isEnabledFor(logging.DEBUG)
for a in adds:
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).
for depgroup in universe.dependencies_of(a):
rigid = depgroup - going_out
if sat_in_testing(rigid):
# (partly) satisfied by testing, assume it is okay