britney: Replace all calls to "log" with logger

Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
Niels Thykier 2018-03-24 09:42:06 +00:00
parent 8bf73610ee
commit b23777c852

View File

@ -300,7 +300,7 @@ class Britney(object):
self.read_hints(os.path.join(self.suite_info['unstable'].path, 'Hints')) self.read_hints(os.path.join(self.suite_info['unstable'].path, 'Hints'))
if self.options.nuninst_cache: if self.options.nuninst_cache:
self.log("Not building the list of non-installable packages, as requested", type="I") self.logger.info("Not building the list of non-installable packages, as requested")
if self.options.print_uninst: if self.options.print_uninst:
nuninst = self.get_nuninst(build=False) nuninst = self.get_nuninst(build=False)
print('* summary') print('* summary')
@ -340,34 +340,34 @@ class Britney(object):
constraints_file = os.path.join(self.options.static_input_dir, 'constraints') constraints_file = os.path.join(self.options.static_input_dir, 'constraints')
faux_packages = os.path.join(self.options.static_input_dir, 'faux-packages') faux_packages = os.path.join(self.options.static_input_dir, 'faux-packages')
except AttributeError: except AttributeError:
self.log("The static_input_dir option is not set", type='I') self.logger.info("The static_input_dir option is not set")
constraints_file = None constraints_file = None
faux_packages = None faux_packages = None
if faux_packages is not None and os.path.exists(faux_packages): if faux_packages is not None and os.path.exists(faux_packages):
self.log("Loading faux packages from %s" % faux_packages, type='I') self.logger.info("Loading faux packages from %s" % faux_packages)
self._load_faux_packages(faux_packages) self._load_faux_packages(faux_packages)
elif faux_packages is not None: elif faux_packages is not None:
self.log("No Faux packages as %s does not exist" % faux_packages, type='I') self.logger.info("No Faux packages as %s does not exist" % faux_packages)
if constraints_file is not None and os.path.exists(constraints_file): if constraints_file is not None and os.path.exists(constraints_file):
self.log("Loading constraints from %s" % constraints_file, type='I') self.logger.info("Loading constraints from %s" % constraints_file)
self.constraints = self._load_constraints(constraints_file) self.constraints = self._load_constraints(constraints_file)
else: else:
if constraints_file is not None: if constraints_file is not None:
self.log("No constraints as %s does not exist" % constraints_file, type='I') self.logger.info("No constraints as %s does not exist" % constraints_file)
self.constraints = { self.constraints = {
'keep-installable': [], 'keep-installable': [],
} }
self.log("Compiling Installability tester", type="I") self.logger.info("Compiling Installability tester")
self._inst_tester = build_installability_tester(self.binaries, self.options.architectures) self._inst_tester = build_installability_tester(self.binaries, self.options.architectures)
if not self.options.nuninst_cache: if not self.options.nuninst_cache:
self.log("Building the list of non-installable packages for the full archive", type="I") self.logger.info("Building the list of non-installable packages for the full archive")
self._inst_tester.compute_testing_installability() self._inst_tester.compute_testing_installability()
nuninst = self.get_nuninst(build=True) nuninst = self.get_nuninst(build=True)
for arch in self.options.architectures: for arch in self.options.architectures:
self.log("> Found %d non-installable packages" % len(nuninst[arch]), type="I") self.logger.info("> Found %d non-installable packages" % len(nuninst[arch]))
if self.options.print_uninst: if self.options.print_uninst:
self.nuninst_arch_report(nuninst, arch) self.nuninst_arch_report(nuninst, arch)
@ -379,12 +379,12 @@ class Britney(object):
write_nuninst(self.options.noninst_status, nuninst) write_nuninst(self.options.noninst_status, nuninst)
stats = self._inst_tester.compute_stats() stats = self._inst_tester.compute_stats()
self.log("> Installability tester statistics (per architecture)", type="I") self.logger.info("> Installability tester statistics (per architecture)")
for arch in self.options.architectures: for arch in self.options.architectures:
arch_stat = stats[arch] arch_stat = stats[arch]
self.log("> %s" % arch, type="I") self.logger.info("> %s" % arch)
for stat in arch_stat.stat_summary(): for stat in arch_stat.stat_summary():
self.log("> - %s" % stat, type="I") self.logger.info("> - %s" % stat)
for policy in self.policies: for policy in self.policies:
policy.hints = self.hints policy.hints = self.hints
@ -398,10 +398,10 @@ class Britney(object):
bad.append((f, pkg_entry1[f], pkg_entry2[f])) bad.append((f, pkg_entry1[f], pkg_entry2[f]))
if bad: # pragma: no cover if bad: # pragma: no cover
self.log("Mismatch found %s %s %s differs" % ( self.logger.error("Mismatch found %s %s %s differs" % (
package, pkg_entry1.version, parch), type="E") package, pkg_entry1.version, parch))
for f, v1, v2 in bad: for f, v1, v2 in bad:
self.log(" ... %s %s != %s" % (check_field_name[f], v1, v2)) self.logger.info(" ... %s %s != %s" % (check_field_name[f], v1, v2))
raise ValueError("Invalid data set") raise ValueError("Invalid data set")
# Merge ESSENTIAL if necessary # Merge ESSENTIAL if necessary
@ -450,11 +450,11 @@ class Britney(object):
# integrity checks # integrity checks
if self.options.nuninst_cache and self.options.print_uninst: # pragma: no cover if self.options.nuninst_cache and self.options.print_uninst: # pragma: no cover
self.log("nuninst_cache and print_uninst are mutually exclusive!", type="E") self.logger.error("nuninst_cache and print_uninst are mutually exclusive!")
sys.exit(1) sys.exit(1)
# if the configuration file exists, then read it and set the additional options # if the configuration file exists, then read it and set the additional options
elif not os.path.isfile(self.options.config): # pragma: no cover elif not os.path.isfile(self.options.config): # pragma: no cover
self.log("Unable to read the configuration file (%s), exiting!" % self.options.config, type="E") self.logger.error("Unable to read the configuration file (%s), exiting!" % self.options.config)
sys.exit(1) sys.exit(1)
# minimum days for unstable-testing transition and the list of hints # minimum days for unstable-testing transition and the list of hints
@ -484,29 +484,29 @@ class Britney(object):
self.suite_info[suite] = SuiteInfo(name=suite, path=suite_path, excuses_suffix=suffix) self.suite_info[suite] = SuiteInfo(name=suite, path=suite_path, excuses_suffix=suffix)
else: else:
if suite in {'testing', 'unstable'}: # pragma: no cover if suite in {'testing', 'unstable'}: # pragma: no cover
self.log("Mandatory configuration %s is not set in the config" % suite.upper(), type='E') self.logger.error("Mandatory configuration %s is not set in the config" % suite.upper())
sys.exit(1) sys.exit(1)
self.log("Optional suite %s is not defined (config option: %s) " % (suite, suite.upper())) self.logger.info("Optional suite %s is not defined (config option: %s) " % (suite, suite.upper()))
try: try:
release_file = read_release_file(self.suite_info['testing'].path) release_file = read_release_file(self.suite_info['testing'].path)
self.log("Found a Release file in testing - using that for defaults") self.logger.info("Found a Release file in testing - using that for defaults")
except FileNotFoundError: except FileNotFoundError:
self.log("Testing does not have a Release file.") self.logger.info("Testing does not have a Release file.")
release_file = None release_file = None
if getattr(self.options, "components", None): if getattr(self.options, "components", None):
self.options.components = [s.strip() for s in self.options.components.split(",")] self.options.components = [s.strip() for s in self.options.components.split(",")]
elif release_file and not self.options.control_files: elif release_file and not self.options.control_files:
self.options.components = release_file['Components'].split() self.options.components = release_file['Components'].split()
self.log("Using components listed in Release file: %s" % ' '.join(self.options.components)) self.logger.info("Using components listed in Release file: %s" % ' '.join(self.options.components))
else: else:
self.options.components = None self.options.components = None
if self.options.control_files and self.options.components: # pragma: no cover if self.options.control_files and self.options.components: # pragma: no cover
# We cannot regenerate the control files correctly when reading from an # We cannot regenerate the control files correctly when reading from an
# actual mirror (we don't which package goes in what component etc.). # actual mirror (we don't which package goes in what component etc.).
self.log("Cannot use --control-files with mirror-layout (components)!", type="E") self.logger.error("Cannot use --control-files with mirror-layout (components)!")
sys.exit(1) sys.exit(1)
if not hasattr(self.options, "heidi_delta_output"): if not hasattr(self.options, "heidi_delta_output"):
@ -522,12 +522,12 @@ class Britney(object):
allarches = sorted(self.options.architectures.split()) allarches = sorted(self.options.architectures.split())
else: else:
if not release_file: # pragma: no cover if not release_file: # pragma: no cover
self.log("No configured architectures and there is no release file for testing", type="E") self.logger.error("No configured architectures and there is no release file for testing")
self.log("Please check if there is a \"Release\" file in %s" % self.suite_info['testing'].path, type="E") self.logger.error("Please check if there is a \"Release\" file in %s" % self.suite_info['testing'].path)
self.log("or if the config file contains a non-empty \"ARCHITECTURES\" field", type="E") self.logger.error("or if the config file contains a non-empty \"ARCHITECTURES\" field")
sys.exit(1) sys.exit(1)
allarches = sorted(release_file['Architectures'].split()) allarches = sorted(release_file['Architectures'].split())
self.log("Using architectures listed in Release file: %s" % ' '.join(allarches)) self.logger.info("Using architectures listed in Release file: %s" % ' '.join(allarches))
arches = [x for x in allarches if x in self.options.nobreakall_arches] arches = [x for x in allarches if x in self.options.nobreakall_arches]
arches += [x for x in allarches if x not in arches and x not in self.options.outofsync_arches] arches += [x for x in allarches if x not in arches and x not in self.options.outofsync_arches]
arches += [x for x in allarches if x not in arches and x not in self.options.break_arches] arches += [x for x in allarches if x not in arches and x not in self.options.break_arches]
@ -552,22 +552,6 @@ class Britney(object):
def hints(self): def hints(self):
return self._hint_parser.hints return self._hint_parser.hints
def log(self, msg, type="I"):
"""Print info messages according to verbosity level
An easy-and-simple log method which prints messages to the standard
output. The type parameter controls the urgency of the message, and
can be equal to `I' for `Information', `W' for `Warning' and `E' for
`Error'. Warnings and errors are always printed, and information is
printed only if verbose logging is enabled.
"""
level = {
'I': logging.INFO,
'W': logging.WARNING,
'E': logging.ERROR,
}.get(type, logging.INFO)
self.logger.log(level, msg)
def _load_faux_packages(self, faux_packages_file): def _load_faux_packages(self, faux_packages_file):
"""Loads fake packages """Loads fake packages
@ -672,7 +656,7 @@ class Britney(object):
if constraint not in {'present-and-installable'}: # pragma: no cover if constraint not in {'present-and-installable'}: # pragma: no cover
raise ValueError("Unsupported constraint %s for %s (file %s)" % (constraint, pkg_name, constraints_file)) raise ValueError("Unsupported constraint %s for %s (file %s)" % (constraint, pkg_name, constraints_file))
self.log(" - constraint %s" % pkg_name, type='I') self.logger.info(" - constraint %s" % pkg_name)
pkg_list = [x.strip() for x in mandatory_field('Package-List').split("\n") if x.strip() != '' and not x.strip().startswith("#")] pkg_list = [x.strip() for x in mandatory_field('Package-List').split("\n") if x.strip() != '' and not x.strip().startswith("#")]
src_data = SourcePackage(faux_version, src_data = SourcePackage(faux_version,
@ -746,11 +730,11 @@ class Britney(object):
for component in self.options.components: for component in self.options.components:
filename = os.path.join(basedir, component, "source", "Sources") filename = os.path.join(basedir, component, "source", "Sources")
filename = possibly_compressed(filename) filename = possibly_compressed(filename)
self.log("Loading source packages from %s" % filename) self.logger.info("Loading source packages from %s" % filename)
read_sources_file(filename, sources) read_sources_file(filename, sources)
else: else:
filename = os.path.join(basedir, "Sources") filename = os.path.join(basedir, "Sources")
self.log("Loading source packages from %s" % filename) self.logger.info("Loading source packages from %s" % filename)
sources = read_sources_file(filename) sources = read_sources_file(filename)
return sources return sources
@ -761,13 +745,13 @@ class Britney(object):
for or_clause in parts: for or_clause in parts:
if len(or_clause) != 1: # pragma: no cover if len(or_clause) != 1: # pragma: no cover
msg = "Ignoring invalid provides in %s: Alternatives [%s]" % (str(pkg_id), str(or_clause)) msg = "Ignoring invalid provides in %s: Alternatives [%s]" % (str(pkg_id), str(or_clause))
self.log(msg, type='W') self.logger.warning(msg)
continue continue
for part in or_clause: for part in or_clause:
provided, provided_version, op = part provided, provided_version, op = part
if op != '' and op != '=': # pragma: no cover if op != '' and op != '=': # pragma: no cover
msg = "Ignoring invalid provides in %s: %s (%s %s)" % (str(pkg_id), provided, op, provided_version) msg = "Ignoring invalid provides in %s: %s (%s %s)" % (str(pkg_id), provided, op, provided_version)
self.log(msg, type='W') self.logger.warning(msg)
continue continue
provided = sys.intern(provided) provided = sys.intern(provided)
provided_version = sys.intern(provided_version) provided_version = sys.intern(provided_version)
@ -776,7 +760,7 @@ class Britney(object):
return nprov return nprov
def _read_packages_file(self, filename, arch, srcdist, packages=None, intern=sys.intern): def _read_packages_file(self, filename, arch, srcdist, packages=None, intern=sys.intern):
self.log("Loading binary packages from %s" % filename) self.logger.info("Loading binary packages from %s" % filename)
if packages is None: if packages is None:
packages = {} packages = {}
@ -929,7 +913,8 @@ class Britney(object):
for arch in architectures: for arch in architectures:
packages = {} packages = {}
if arch not in listed_archs: if arch not in listed_archs:
self.log("Skipping arch %s for %s: It is not listed in the Release file" % (arch, distribution)) self.logger.info("Skipping arch %s for %s: It is not listed in the Release file" % (
arch, distribution))
arch2packages[arch] = ({}, {}) arch2packages[arch] = ({}, {})
continue continue
for component in self.options.components: for component in self.options.components:
@ -993,9 +978,9 @@ class Britney(object):
else: else:
filename = os.path.join(hintsdir, who) filename = os.path.join(hintsdir, who)
if not os.path.isfile(filename): if not os.path.isfile(filename):
self.log("Cannot read hints list from %s, no such file!" % filename, type="E") self.logger.error("Cannot read hints list from %s, no such file!" % filename)
continue continue
self.log("Loading hints list from %s" % filename) self.logger.info("Loading hints list from %s" % filename)
with open(filename, encoding='utf-8') as f: with open(filename, encoding='utf-8') as f:
self._hint_parser.parse_hints(who, self.HINTS[who], filename, f) self._hint_parser.parse_hints(who, self.HINTS[who], filename, f)
@ -1011,25 +996,24 @@ class Britney(object):
if x in ['unblock', 'unblock-udeb']: if x in ['unblock', 'unblock-udeb']:
if apt_pkg.version_compare(hint2.version, hint.version) < 0: if apt_pkg.version_compare(hint2.version, hint.version) < 0:
# This hint is for a newer version, so discard the old one # This hint is for a newer version, so discard the old one
self.log("Overriding %s[%s] = ('%s', '%s') with ('%s', '%s')" % self.logger.warning("Overriding %s[%s] = ('%s', '%s') with ('%s', '%s')" %
(x, package, hint2.version, hint2.user, hint.version, hint.user), type="W") (x, package, hint2.version, hint2.user, hint.version, hint.user))
hint2.set_active(False) hint2.set_active(False)
else: else:
# This hint is for an older version, so ignore it in favour of the new one # This hint is for an older version, so ignore it in favour of the new one
self.log("Ignoring %s[%s] = ('%s', '%s'), ('%s', '%s') is higher or equal" % self.logger.warning("Ignoring %s[%s] = ('%s', '%s'), ('%s', '%s') is higher or equal" %
(x, package, hint.version, hint.user, hint2.version, hint2.user), type="W") (x, package, hint.version, hint.user, hint2.version, hint2.user))
hint.set_active(False) hint.set_active(False)
else: else:
self.log("Overriding %s[%s] = ('%s', '%s') with ('%s', '%s')" % self.logger.warning("Overriding %s[%s] = ('%s', '%s') with ('%s', '%s')" %
(x, package, hint2.user, hint2, hint.user, hint), (x, package, hint2.user, hint2, hint.user, hint))
type="W")
hint2.set_active(False) hint2.set_active(False)
z[package] = key z[package] = key
# Sanity check the hints hash # Sanity check the hints hash
if len(hints["block"]) == 0 and len(hints["block-udeb"]) == 0: if len(hints["block"]) == 0 and len(hints["block-udeb"]) == 0:
self.log("WARNING: No block hints at all, not even udeb ones!", type="W") self.logger.warning("WARNING: No block hints at all, not even udeb ones!")
# Utility methods for package analysis # Utility methods for package analysis
# ------------------------------------ # ------------------------------------
@ -1567,7 +1551,7 @@ class Britney(object):
of this procedure, please refer to the module docstring. of this procedure, please refer to the module docstring.
""" """
self.log("Update Excuses generation started", type="I") self.logger.info("Update Excuses generation started")
# list of local methods and variables (for better performance) # list of local methods and variables (for better performance)
sources = self.sources sources = self.sources
@ -1687,16 +1671,16 @@ class Britney(object):
# write excuses to the output file # write excuses to the output file
if not self.options.dry_run: if not self.options.dry_run:
self.log("> Writing Excuses to %s" % self.options.excuses_output, type="I") self.logger.info("> Writing Excuses to %s" % self.options.excuses_output)
sorted_excuses = sorted(excuses.values(), key=lambda x: x.sortkey()) sorted_excuses = sorted(excuses.values(), key=lambda x: x.sortkey())
write_excuses(sorted_excuses, self.options.excuses_output, write_excuses(sorted_excuses, self.options.excuses_output,
output_format="legacy-html") output_format="legacy-html")
if hasattr(self.options, 'excuses_yaml_output'): if hasattr(self.options, 'excuses_yaml_output'):
self.log("> Writing YAML Excuses to %s" % self.options.excuses_yaml_output, type="I") self.logger.info("> Writing YAML Excuses to %s" % self.options.excuses_yaml_output)
write_excuses(sorted_excuses, self.options.excuses_yaml_output, write_excuses(sorted_excuses, self.options.excuses_yaml_output,
output_format="yaml") output_format="yaml")
self.log("Update Excuses generation completed", type="I") self.logger.info("Update Excuses generation completed")
# Upgrade run # Upgrade run
# ----------- # -----------
@ -2392,14 +2376,14 @@ class Britney(object):
self.output_write("\n") self.output_write("\n")
def assert_nuninst_is_correct(self): def assert_nuninst_is_correct(self):
self.log("> Update complete - Verifying non-installability counters", type="I") self.logger.info("> Update complete - Verifying non-installability counters")
cached_nuninst = self.nuninst_orig cached_nuninst = self.nuninst_orig
self._inst_tester.compute_testing_installability() self._inst_tester.compute_testing_installability()
computed_nuninst = self.get_nuninst(build=True) computed_nuninst = self.get_nuninst(build=True)
if cached_nuninst != computed_nuninst: # pragma: no cover if cached_nuninst != computed_nuninst: # pragma: no cover
only_on_break_archs = True only_on_break_archs = True
self.log("==================== NUNINST OUT OF SYNC =========================", type="E") self.logger.error("==================== NUNINST OUT OF SYNC =========================")
for arch in self.options.architectures: for arch in self.options.architectures:
expected_nuninst = set(cached_nuninst[arch]) expected_nuninst = set(cached_nuninst[arch])
actual_nuninst = set(computed_nuninst[arch]) actual_nuninst = set(computed_nuninst[arch])
@ -2410,18 +2394,17 @@ class Britney(object):
if (false_negatives or false_positives) and arch not in self.options.break_arches: if (false_negatives or false_positives) and arch not in self.options.break_arches:
only_on_break_archs = False only_on_break_archs = False
if false_negatives: if false_negatives:
self.log(" %s - unnoticed nuninst: %s" % (arch, str(false_negatives)), type="E") self.logger.error(" %s - unnoticed nuninst: %s" % (arch, str(false_negatives)))
if false_positives: if false_positives:
self.log(" %s - invalid nuninst: %s" % (arch, str(false_positives)), type="E") self.logger.error(" %s - invalid nuninst: %s" % (arch, str(false_positives)))
self.log(" %s - actual nuninst: %s" % (arch, str(actual_nuninst)), type="I") self.logger.info(" %s - actual nuninst: %s" % (arch, str(actual_nuninst)))
self.log("==================== NUNINST OUT OF SYNC =========================", type="E") self.logger.error("==================== NUNINST OUT OF SYNC =========================")
if not only_on_break_archs: if not only_on_break_archs:
raise AssertionError("NUNINST OUT OF SYNC") raise AssertionError("NUNINST OUT OF SYNC")
else: else:
self.log("Nuninst is out of sync on some break arches", self.logger.warning("Nuninst is out of sync on some break arches")
type="W")
self.log("> All non-installability counters are ok", type="I") self.logger.info("> All non-installability counters are ok")
def upgrade_testing(self): def upgrade_testing(self):
@ -2432,11 +2415,11 @@ class Britney(object):
commands. commands.
""" """
self.log("Starting the upgrade test", type="I") self.logger.info("Starting the upgrade test")
self.output_write("Generated on: %s\n" % (time.strftime("%Y.%m.%d %H:%M:%S %z", time.gmtime(time.time())))) self.output_write("Generated on: %s\n" % (time.strftime("%Y.%m.%d %H:%M:%S %z", time.gmtime(time.time()))))
self.output_write("Arch order is: %s\n" % ", ".join(self.options.architectures)) self.output_write("Arch order is: %s\n" % ", ".join(self.options.architectures))
self.log("> Calculating current uninstallability counters", type="I") self.logger.info("> Calculating current uninstallability counters")
self.nuninst_orig = self.get_nuninst() self.nuninst_orig = self.get_nuninst()
# nuninst_orig may get updated during the upgrade process # nuninst_orig may get updated during the upgrade process
self.nuninst_orig_save = self.get_nuninst() self.nuninst_orig_save = self.get_nuninst()
@ -2492,7 +2475,7 @@ class Britney(object):
# obsolete source packages # obsolete source packages
# a package is obsolete if none of the binary packages in testing # a package is obsolete if none of the binary packages in testing
# are built by it # are built by it
self.log("> Removing obsolete source packages from testing", type="I") self.logger.info("> Removing obsolete source packages from testing")
# local copies for performance # local copies for performance
sources = self.sources['testing'] sources = self.sources['testing']
binaries = self.binaries['testing'] binaries = self.binaries['testing']
@ -2510,15 +2493,15 @@ class Britney(object):
# smooth updates # smooth updates
removals = old_libraries(self.sources, self.binaries, self.options.outofsync_arches) removals = old_libraries(self.sources, self.binaries, self.options.outofsync_arches)
if self.options.smooth_updates: if self.options.smooth_updates:
self.log("> Removing old packages left in testing from smooth updates", type="I") 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_write("Removing packages left in testing for smooth updates (%d):\n%s" % \
(len(removals), old_libraries_format(removals))) (len(removals), old_libraries_format(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.log("> Not removing old packages left in testing from smooth updates (smooth-updates disabled)", self.logger.info("> Not removing old packages left in testing from smooth updates"
type="I") " (smooth-updates disabled)")
self.output_write("List of old libraries in testing (%d):\n%s" % \ self.output_write("List of old libraries in testing (%d):\n%s" % \
(len(removals), old_libraries_format(removals))) (len(removals), old_libraries_format(removals)))
@ -2529,7 +2512,7 @@ class Britney(object):
if not self.options.dry_run: if not self.options.dry_run:
# re-write control files # re-write control files
if self.options.control_files: if self.options.control_files:
self.log("Writing new testing control files to %s" % self.logger.info("Writing new testing control files to %s" %
self.suite_info['testing'].path) self.suite_info['testing'].path)
write_controlfiles(self.sources, self.binaries, write_controlfiles(self.sources, self.binaries,
'testing', self.suite_info['testing'].path) 'testing', self.suite_info['testing'].path)
@ -2538,21 +2521,21 @@ class Britney(object):
policy.save_state(self) policy.save_state(self)
# write HeidiResult # write HeidiResult
self.log("Writing Heidi results to %s" % self.options.heidi_output) self.logger.info("Writing Heidi results to %s" % self.options.heidi_output)
write_heidi(self.options.heidi_output, self.sources["testing"], write_heidi(self.options.heidi_output, self.sources["testing"],
self.binaries["testing"], self.binaries["testing"],
outofsync_arches=self.options.outofsync_arches) outofsync_arches=self.options.outofsync_arches)
self.log("Writing delta to %s" % self.options.heidi_delta_output) self.logger.info("Writing delta to %s" % self.options.heidi_delta_output)
write_heidi_delta(self.options.heidi_delta_output, write_heidi_delta(self.options.heidi_delta_output,
self.all_selected) self.all_selected)
self.printuninstchange() self.printuninstchange()
self.log("Test completed!", type="I") self.logger.info("Test completed!")
def printuninstchange(self): def printuninstchange(self):
self.log("Checking for newly uninstallable packages", type="I") self.logger.info("Checking for newly uninstallable packages")
text = eval_uninst(self.options.architectures, newly_uninst( text = eval_uninst(self.options.architectures, newly_uninst(
self.nuninst_orig_save, self.nuninst_orig)) self.nuninst_orig_save, self.nuninst_orig))
@ -2566,7 +2549,7 @@ class Britney(object):
This method provides a command line interface for the release team to This method provides a command line interface for the release team to
try hints and evaluate the results. try hints and evaluate the results.
""" """
self.log("> Calculating current uninstallability counters", type="I") self.logger.info("> Calculating current uninstallability counters")
self.nuninst_orig = self.get_nuninst() self.nuninst_orig = self.get_nuninst()
self.nuninst_orig_save = self.get_nuninst() self.nuninst_orig_save = self.get_nuninst()
@ -2613,7 +2596,7 @@ class Britney(object):
try: try:
readline.write_history_file(histfile) readline.write_history_file(histfile)
except IOError as e: except IOError as e:
self.log("Could not write %s: %s" % (histfile, e), type="W") self.logger.warning("Could not write %s: %s" % (histfile, e))
def do_hint(self, hinttype, who, pkgvers): def do_hint(self, hinttype, who, pkgvers):
"""Process hints """Process hints
@ -2627,7 +2610,7 @@ class Britney(object):
else: else:
_pkgvers = pkgvers _pkgvers = pkgvers
self.log("> Processing '%s' hint from %s" % (hinttype, who), type="I") self.logger.info("> Processing '%s' hint from %s" % (hinttype, who))
self.output_write("Trying %s from %s: %s\n" % (hinttype, who, " ".join("%s/%s" % (x.uvname, x.version) for x in _pkgvers))) self.output_write("Trying %s from %s: %s\n" % (hinttype, who, " ".join("%s/%s" % (x.uvname, x.version) for x in _pkgvers)))
ok = True ok = True
@ -2683,7 +2666,7 @@ class Britney(object):
excuses relationships. If they build a circular dependency, which we already excuses relationships. If they build a circular dependency, which we already
know as not-working with the standard do_all algorithm, try to `easy` them. know as not-working with the standard do_all algorithm, try to `easy` them.
""" """
self.log("> Processing hints from the auto hinter", type="I") self.logger.info("> Processing hints from the auto hinter")
sources_t = self.sources['testing'] sources_t = self.sources['testing']
excuses = self.excuses excuses = self.excuses
@ -2802,11 +2785,11 @@ class Britney(object):
else: else:
self.upgrade_testing() self.upgrade_testing()
self.log('> Stats from the installability tester', type="I") self.logger.info('> Stats from the installability tester')
for stat in self._inst_tester.stats.stats(): for stat in self._inst_tester.stats.stats():
self.log('> %s' % stat, type="I") self.logger.info('> %s' % stat)
else: else:
self.log('Migration computation skipped as requested.', type='I') self.logger.info('Migration computation skipped as requested.')
logging.shutdown() logging.shutdown()