Add allow-smooth-update hint

Hint to allow smooth update, even if the section isn't allowed in the
configuration.

Note that this takes the source name and the source version IN TESTING
of the binaries that must be allowed to stay around to allow a smooth
update.
ubuntu/rebased
Ivo De Decker 5 years ago
parent c2088004f2
commit 920d82445d

@ -339,7 +339,8 @@ class Britney(object):
self._migration_item_factory = MigrationItemFactory(self.suite_info)
self._hint_parser = HintParser(self._migration_item_factory)
self._migration_manager = MigrationManager(self.options, self.suite_info, self.all_binaries, self.pkg_universe,
self.constraints, self.allow_uninst, self._migration_item_factory)
self.constraints, self.allow_uninst, self._migration_item_factory,
self.hints)
if not self.options.nuninst_cache:
self.logger.info("Building the list of non-installable packages for the full archive")

@ -215,7 +215,8 @@ class ExcuseFinder(object):
binaries_t,
source_suite.binaries,
frozenset(),
self.options.smooth_updates)
self.options.smooth_updates,
self.hints)
# for every binary package produced by this source in testing for this architecture
for pkg_id in sorted(x for x in source_t.binaries if x.architecture == arch):

@ -169,6 +169,7 @@ class HintParser(object):
'remove': (1, split_into_one_hint_per_package),
'force': (1, split_into_one_hint_per_package),
'allow-uninst': (1, split_into_one_hint_per_package),
'allow-smooth-update': (1, split_into_one_hint_per_package),
}
self._aliases = {
'approve': 'unblock',

@ -38,13 +38,15 @@ def is_nuninst_worse(must_be_installable, nuninst_now_arch, nuninst_after_arch,
class MigrationManager(object):
def __init__(self, options, suite_info, all_binaries, pkg_universe, constraints, allow_uninst, migration_item_factory):
def __init__(self, options, suite_info, all_binaries, pkg_universe,
constraints, allow_uninst, migration_item_factory, hints):
self.options = options
self.suite_info = suite_info
self.all_binaries = all_binaries
self.pkg_universe = pkg_universe
self.constraints = constraints
self.allow_uninst = allow_uninst
self.hints = hints
self._transactions = []
self._all_architectures = frozenset(self.options.architectures)
self._migration_item_factory = migration_item_factory
@ -206,7 +208,8 @@ class MigrationManager(object):
binaries_t,
binaries_s,
removals,
self.options.smooth_updates)
self.options.smooth_updates,
self.hints)
else:
smoothbins = set()

@ -1692,7 +1692,7 @@ class ImplicitDependencyPolicy(BasePolicy):
pkg_id_s = None
if not pkg_id_s and \
is_smooth_update_allowed(binaries_t_a[mypkg], self._smooth_updates):
is_smooth_update_allowed(binaries_t_a[mypkg], self._smooth_updates, self.hints):
# the binary isn't in the new version (or is cruft there), and
# smooth updates are allowed: the binary can stay around if
# that is necessary to satisfy dependencies, so we don't need

@ -761,12 +761,15 @@ def compile_nuninst(target_suite, architectures, nobreakall_arches):
return nuninst
def is_smooth_update_allowed(binary, smooth_updates):
def is_smooth_update_allowed(binary, smooth_updates, hints):
if 'ALL' in smooth_updates:
return True
section = binary.section.split('/')[-1]
if section in smooth_updates:
return True
if hints.search('allow-smooth-update', package=binary.source, version=binary.source_version):
# note that this needs to match the source version *IN TESTING*
return True
return False
@ -777,7 +780,8 @@ def find_smooth_updateable_binaries(binaries_to_check,
binaries_t,
binaries_s,
removals,
smooth_updates):
smooth_updates,
hints):
check = set()
smoothbins = set()
@ -793,7 +797,7 @@ def find_smooth_updateable_binaries(binaries_to_check,
cruftbins.add(binaries_s[parch][binary].pkg_id)
# Maybe a candidate (cruft or removed binary): check if config allows us to smooth update it.
if is_smooth_update_allowed(binaries_t[parch][binary], smooth_updates):
if is_smooth_update_allowed(binaries_t[parch][binary], smooth_updates, hints):
# if the package has reverse-dependencies which are
# built from other sources, it's a valid candidate for
# a smooth update. if not, it may still be a valid

Loading…
Cancel
Save