split off is_smooth_update_allowed() function

ubuntu/rebased
Ivo De Decker 5 years ago
parent 4e49ce9d70
commit 2d34f8220e

@ -13,7 +13,7 @@ from britney2 import SuiteClass, PackageId
from britney2.hints import Hint, split_into_one_hint_per_package from britney2.hints import Hint, split_into_one_hint_per_package
from britney2.inputs.suiteloader import SuiteContentLoader from britney2.inputs.suiteloader import SuiteContentLoader
from britney2.policies import PolicyVerdict, ApplySrcPolicy from britney2.policies import PolicyVerdict, ApplySrcPolicy
from britney2.utils import get_dependency_solvers, find_newer_binaries from britney2.utils import get_dependency_solvers, find_newer_binaries, is_smooth_update_allowed
from britney2 import DependencyType from britney2 import DependencyType
from britney2.excusedeps import DependencySpec from britney2.excusedeps import DependencySpec
@ -1691,9 +1691,8 @@ class ImplicitDependencyPolicy(BasePolicy):
else: else:
pkg_id_s = None pkg_id_s = None
if not pkg_id_s and ( if not pkg_id_s and \
'ALL' in self._smooth_updates or is_smooth_update_allowed(binaries_t_a[mypkg], self._smooth_updates):
binaries_t_a[mypkg].section in self._smooth_updates):
# the binary isn't in the new version (or is cruft there), and # the binary isn't in the new version (or is cruft there), and
# smooth updates are allowed: the binary can stay around if # smooth updates are allowed: the binary can stay around if
# that is necessary to satisfy dependencies, so we don't need # that is necessary to satisfy dependencies, so we don't need

@ -761,6 +761,14 @@ def compile_nuninst(target_suite, architectures, nobreakall_arches):
return nuninst return nuninst
def is_smooth_update_allowed(binary, smooth_updates):
if 'ALL' in smooth_updates:
return True
if binary.section in smooth_updates:
return True
return False
def find_smooth_updateable_binaries(binaries_to_check, def find_smooth_updateable_binaries(binaries_to_check,
source_data, source_data,
pkg_universe, pkg_universe,
@ -784,7 +792,7 @@ def find_smooth_updateable_binaries(binaries_to_check,
cruftbins.add(binaries_s[parch][binary].pkg_id) cruftbins.add(binaries_s[parch][binary].pkg_id)
# Maybe a candidate (cruft or removed binary): check if config allows us to smooth update it. # Maybe a candidate (cruft or removed binary): check if config allows us to smooth update it.
if 'ALL' in smooth_updates or binaries_t[parch][binary].section in smooth_updates: if is_smooth_update_allowed(binaries_t[parch][binary], smooth_updates):
# if the package has reverse-dependencies which are # if the package has reverse-dependencies which are
# built from other sources, it's a valid candidate for # built from other sources, it's a valid candidate for
# a smooth update. if not, it may still be a valid # a smooth update. if not, it may still be a valid

Loading…
Cancel
Save