Refactor nuninst initialization to avoid reading the cache from disk

At the moment, britney will always read the nuncache from disk
(possibly regenerating it before reading it).  However, we can save
the "read from disk" by moving the initialization of nuninst into the
constructor of Britney and relying on clone_nuninst.

Signed-off-by: Niels Thykier <niels@thykier.net>
ubuntu/rebased
Niels Thykier 6 years ago
parent 7bcbcb6282
commit 05aaf1cc12
No known key found for this signature in database
GPG Key ID: A65B78DBE67C7AAC

@ -357,6 +357,7 @@ class Britney(object):
self.logger.info("Building the list of non-installable packages for the full archive") 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)
self.nuninst_orig = nuninst
for arch in self.options.architectures: for arch in self.options.architectures:
self.logger.info("> Found %d non-installable packages", len(nuninst[arch])) self.logger.info("> Found %d non-installable packages", len(nuninst[arch]))
if self.options.print_uninst: if self.options.print_uninst:
@ -376,6 +377,12 @@ class Britney(object):
self.logger.info("> %s", arch) self.logger.info("> %s", arch)
for stat in arch_stat.stat_summary(): for stat in arch_stat.stat_summary():
self.logger.info("> - %s", stat) self.logger.info("> - %s", stat)
else:
self.logger.info("Loading uninstallability counters from cache")
self.nuninst_orig = self.get_nuninst()
# nuninst_orig may get updated during the upgrade process
self.nuninst_orig_save = clone_nuninst(self.nuninst_orig, architectures=self.options.architectures)
for policy in self.policies: for policy in self.policies:
policy.hints = self.hints policy.hints = self.hints
@ -2449,11 +2456,6 @@ class Britney(object):
output_logger.info("Generated on: %s", time.strftime("%Y.%m.%d %H:%M:%S %z", time.gmtime(time.time()))) output_logger.info("Generated on: %s", time.strftime("%Y.%m.%d %H:%M:%S %z", time.gmtime(time.time())))
output_logger.info("Arch order is: %s", ", ".join(self.options.architectures)) output_logger.info("Arch order is: %s", ", ".join(self.options.architectures))
self.logger.info("> Calculating current uninstallability counters")
self.nuninst_orig = self.get_nuninst()
# nuninst_orig may get updated during the upgrade process
self.nuninst_orig_save = self.get_nuninst()
if not self.options.actions: if not self.options.actions:
# process `easy' hints # process `easy' hints
for x in self.hints['easy']: for x in self.hints['easy']:
@ -2584,10 +2586,6 @@ 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.logger.info("> Calculating current uninstallability counters")
self.nuninst_orig = self.get_nuninst()
self.nuninst_orig_save = self.get_nuninst()
import readline import readline
from britney2.completer import Completer from britney2.completer import Completer

Loading…
Cancel
Save