From 9f3e1630b4e1d87752c2290b8f288a69f23c2916 Mon Sep 17 00:00:00 2001 From: "Adam D. Barratt" Date: Sat, 15 Dec 2012 18:07:06 +0000 Subject: [PATCH] Make obsolete source package removal slightly more intelligent Previously a package which became obsolete during a run would not be automatically removed until the next run. This was due to the fact that sources[][BINARIES] is not updated during the run. Instead, we build a list of source packages which produce at least one binary and then remove any packages not in that list. Signed-off-by: Adam D. Barratt --- britney.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/britney.py b/britney.py index 5205f64..76b8c89 100755 --- a/britney.py +++ b/britney.py @@ -2417,12 +2417,21 @@ class Britney(object): # run the auto hinter self.auto_hinter() - # obsolete source packages + # obsolete source packages + # a package is obsolete if none of the binary packages in testing + # are built by it self.__log("> Removing obsolete source packages from testing", type="I") removals = [] + # local copies for performance sources = self.sources['testing'] - removals = [ HintItem("-%s/%s" % (source, sources[source][VERSION])) for \ - source in sources if len(sources[source][BINARIES]) == 0 ] + binaries = self.binaries['testing'] + used = set(binaries[arch][0][binary][SOURCE] + for arch in binaries + for binary in binaries[arch][0] + ) + removals = [ HintItem("-%s/%s" % (source, sources[source][VERSION])) + for source in sources if source not in used + ] if len(removals) > 0: self.output_write("Removing obsolete source packages from testing (%d):\n" % (len(removals))) self.do_all(actions=removals)