Rewrite handling of logging old libraries

Signed-off-by: Niels Thykier <niels@thykier.net>
ubuntu/rebased
Niels Thykier 7 years ago
parent 3d05b834ad
commit a344a9b375

@ -201,7 +201,7 @@ from britney2.migrationitem import MigrationItem
from britney2.policies import PolicyVerdict from britney2.policies import PolicyVerdict
from britney2.policies.policy import AgePolicy, RCBugPolicy, PiupartsPolicy, BuildDependsPolicy from britney2.policies.policy import AgePolicy, RCBugPolicy, PiupartsPolicy, BuildDependsPolicy
from britney2.policies.autopkgtest import AutopkgtestPolicy from britney2.policies.autopkgtest import AutopkgtestPolicy
from britney2.utils import (old_libraries_format, undo_changes, from britney2.utils import (log_and_format_old_libraries, undo_changes,
compute_reverse_tree, possibly_compressed, compute_reverse_tree, possibly_compressed,
read_nuninst, write_nuninst, write_heidi, read_nuninst, write_nuninst, write_heidi,
format_and_log_uninst, newly_uninst, make_migrationitem, format_and_log_uninst, newly_uninst, make_migrationitem,
@ -2532,16 +2532,16 @@ class Britney(object):
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:
self.output_write("Removing packages left in testing for smooth updates (%d):\n%s" % \ self.output_logger.info("Removing packages left in testing for smooth updates (%d):", len(removals))
(len(removals), old_libraries_format(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.sources, self.binaries, 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)")
self.output_write("List of old libraries in testing (%d):\n%s" % \ self.output_logger.info("List of old libraries in testing (%d):", len(removals))
(len(removals), old_libraries_format(removals))) log_and_format_old_libraries(self.output_logger, removals)
self.assert_nuninst_is_correct() self.assert_nuninst_is_correct()

@ -164,8 +164,8 @@ def undo_changes(lundo, inst_tester, sources, binaries, all_binary_packages):
binaries['testing'][arch][1][provided_pkg] = undo['virtual'][p] binaries['testing'][arch][1][provided_pkg] = undo['virtual'][p]
def old_libraries_format(libs): def log_and_format_old_libraries(logger, libs):
"""Format old libraries in a smart table""" """Format and log old libraries in a table (no header)"""
libraries = {} libraries = {}
for i in libs: for i in libs:
pkg = i.package pkg = i.package
@ -173,7 +173,9 @@ def old_libraries_format(libs):
libraries[pkg].append(i.architecture) libraries[pkg].append(i.architecture)
else: else:
libraries[pkg] = [i.architecture] libraries[pkg] = [i.architecture]
return "\n".join(" " + k + ": " + " ".join(libraries[k]) for k in libraries) + "\n"
for lib in sorted(libraries):
logger.info(" %s: %s", lib, " ".join(libraries[lib]))
def compute_reverse_tree(inst_tester, affected): def compute_reverse_tree(inst_tester, affected):

Loading…
Cancel
Save