Split migrate_item_to_target_suite into two

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

@ -331,43 +331,52 @@ class MigrationManager(object):
# return the affected packages (direct and than all) # return the affected packages (direct and than all)
return (affected_direct, affected_all) return (affected_direct, affected_all)
def migrate_item_to_target_suite(self, actions, nuninst_now, stop_on_first_regression=True): def _apply_multiple_items_to_target_suite(self, items):
is_accepted = True
affected_architectures = set() affected_architectures = set()
target_suite = self.suite_info.target_suite is_source_migration = False
packages_t = target_suite.binaries if len(items) == 1:
item = items[0]
nobreakall_arches = self.options.nobreakall_arches
new_arches = self.options.new_arches
break_arches = self.options.break_arches
arch = None
if len(actions) == 1:
item = actions[0]
# apply the changes # apply the changes
affected_direct, affected_all = self._apply_item_to_target_suite(item) affected_direct, affected_all = self._apply_item_to_target_suite(item)
if item.architecture == 'source': if item.architecture == 'source':
affected_architectures = set(self.options.architectures) affected_architectures = set(self.options.architectures)
is_source_migration = True
else: else:
affected_architectures.add(item.architecture) affected_architectures.add(item.architecture)
else: else:
removals = set() removals = set()
affected_direct = set() affected_direct = set()
affected_all = set() affected_all = set()
for item in actions: for item in items:
_, rms, _ = self._compute_groups(item, allow_smooth_updates=False) _, rms, _ = self._compute_groups(item, allow_smooth_updates=False)
removals.update(rms) removals.update(rms)
affected_architectures.add(item.architecture) affected_architectures.add(item.architecture)
if 'source' in affected_architectures: if 'source' in affected_architectures:
affected_architectures = set(self.options.architectures) affected_architectures = set(self.options.architectures)
is_source_migration = True
for item in actions: for item in items:
item_affected_direct, item_affected_all = self._apply_item_to_target_suite(item, item_affected_direct, item_affected_all = self._apply_item_to_target_suite(item,
removals=removals) removals=removals)
affected_direct.update(item_affected_direct) affected_direct.update(item_affected_direct)
affected_all.update(item_affected_all) affected_all.update(item_affected_all)
return is_source_migration, affected_architectures, affected_direct, affected_all
def migrate_item_to_target_suite(self, items, nuninst_now, stop_on_first_regression=True):
is_accepted = True
target_suite = self.suite_info.target_suite
packages_t = target_suite.binaries
nobreakall_arches = self.options.nobreakall_arches
new_arches = self.options.new_arches
break_arches = self.options.break_arches
arch = None
is_source_migration, affected_architectures, affected_direct, affected_all = \
self._apply_multiple_items_to_target_suite(items)
# Optimise the test if we may revert directly. # Optimise the test if we may revert directly.
# - The automatic-revert is needed since some callers (notably via hints) may # - The automatic-revert is needed since some callers (notably via hints) may
# accept the outcome of this migration and expect nuninst to be updated. # accept the outcome of this migration and expect nuninst to be updated.
@ -404,7 +413,7 @@ class MigrationManager(object):
if not regression.isdisjoint(must_be_installable): if not regression.isdisjoint(must_be_installable):
worse = True worse = True
# ... except for a few special cases # ... except for a few special cases
if worse and ((item.architecture != 'source' and arch not in new_arches) or if worse and ((not is_source_migration and arch not in new_arches) or
(arch not in break_arches)): (arch not in break_arches)):
is_accepted = False is_accepted = False
break break

Loading…
Cancel
Save