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 <adam@adam-barratt.org.uk>
master
Adam D. Barratt 12 years ago
parent 4955efb6d7
commit 9f3e1630b4

@ -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)

Loading…
Cancel
Save