Rewrite old_libraries to be suite agnostic

Signed-off-by: Niels Thykier <niels@thykier.net>
ubuntu/rebased
Niels Thykier 7 years ago
parent b3bfda7d6c
commit 9a5c0c3fa8

@ -2535,14 +2535,14 @@ class Britney(object):
self.do_all(actions=removals) self.do_all(actions=removals)
# smooth updates # smooth updates
removals = old_libraries(self.sources, self.binaries, self.options.outofsync_arches) removals = old_libraries(self.suite_info, self.options.outofsync_arches)
if self.options.smooth_updates: if self.options.smooth_updates:
self.logger.info("> Removing old packages left in testing from smooth updates") self.logger.info("> Removing old packages left in testing from smooth updates")
if removals: if removals:
output_logger.info("Removing packages left in testing for smooth updates (%d):", len(removals)) output_logger.info("Removing packages left in testing for smooth updates (%d):", len(removals))
log_and_format_old_libraries(self.output_logger, removals) log_and_format_old_libraries(self.output_logger, removals)
self.do_all(actions=removals) self.do_all(actions=removals)
removals = old_libraries(self.sources, self.binaries, self.options.outofsync_arches) removals = old_libraries(self.suite_info, self.options.outofsync_arches)
else: else:
self.logger.info("> Not removing old packages left in testing from smooth updates" self.logger.info("> Not removing old packages left in testing from smooth updates"
" (smooth-updates disabled)") " (smooth-updates disabled)")

@ -474,27 +474,27 @@ def write_controlfiles(sources, packages, suite, basedir):
write_sources(sources_s, os.path.join(basedir, 'Sources')) write_sources(sources_s, os.path.join(basedir, 'Sources'))
def old_libraries(sources, packages, outofsync_arches=frozenset()): def old_libraries(suite_info, outofsync_arches=frozenset()):
"""Detect old libraries left in testing for smooth transitions """Detect old libraries left in the target suite for smooth transitions
This method detects old libraries which are in testing but no This method detects old libraries which are in the target suite but no
longer built from the source package: they are still there because longer built from the source package: they are still there because
other packages still depend on them, but they should be removed as other packages still depend on them, but they should be removed as
soon as possible. soon as possible.
For "outofsync" architectures, outdated binaries are allowed to be in For "outofsync" architectures, outdated binaries are allowed to be in
testing, so they are only added to the removal list if they are no longer the target suite, so they are only added to the removal list if they
in unstable. are no longer in the (primary) source suite.
""" """
sources_t = sources['testing'] sources_t = suite_info.target_suite.sources
testing = packages['testing'] binaries_t = suite_info.target_suite.binaries
unstable = packages['unstable'] binaries_s = suite_info.primary_source_suite.binaries
removals = [] removals = []
for arch in testing: for arch in binaries_t:
for pkg_name in testing[arch][0]: for pkg_name in binaries_t[arch][0]:
pkg = testing[arch][0][pkg_name] pkg = binaries_t[arch][0][pkg_name]
if sources_t[pkg.source].version != pkg.source_version and \ if sources_t[pkg.source].version != pkg.source_version and \
(arch not in outofsync_arches or pkg_name not in unstable[arch][0]): (arch not in outofsync_arches or pkg_name not in binaries_s[arch][0]):
migration = "-" + "/".join((pkg_name, arch, pkg.source_version)) migration = "-" + "/".join((pkg_name, arch, pkg.source_version))
removals.append(MigrationItem(migration)) removals.append(MigrationItem(migration))
return removals return removals

Loading…
Cancel
Save