From 9de352892a1cd40109502c5e196575f5f12cc4f5 Mon Sep 17 00:00:00 2001 From: "Adam D. Barratt" Date: Wed, 2 Nov 2011 19:32:30 +0000 Subject: [PATCH] Make checking for smooth updates candidates smarter Commit 94071b16491e90d78605791a316141b58cc3c6fc excluded intra-source dependencies from the determination as to whether a binary package was eligible for smooth updates. Whilst this works in many cases, there are situations where it breaks migration. For instance: foo depends on libdropped1 libdropped1 depends on libdropped2 libdropped1 and libdropped2 are built from the same source; foo from another source libdropped2 is otherwise leaf in testing In order to resolve this, we build a list of all packages which might be eligible and filter out those which have reverse-dependencies outside of their source package. For each remaining package, we consider it eligible if its intra-source reverse-dependencies are within the list of packages already determined to be eligible. Signed-off-by: Adam D. Barratt --- britney.py | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/britney.py b/britney.py index 0d7f000..3653662 100755 --- a/britney.py +++ b/britney.py @@ -1814,20 +1814,54 @@ class Britney: if not (arch and pkg[0] == '-'): if pkg_name in sources['testing']: source = sources['testing'][pkg_name] + + bins = [] + check = [] + smoothbins = [] + # remove all the binaries + + # first, build a list of eligible binaries for p in source[BINARIES]: binary, parch = p.split("/") if arch and parch != arch: continue # do not remove binaries which have been hijacked by other sources if binaries[parch][0][binary][SOURCE] != pkg_name: continue - rdeps = binaries[parch][0][binary][RDEPENDS] + bins.append(p) + + for p in bins: + binary, parch = p.split("/") # if a smooth update is possible for the package, skip it if not self.options.compatible and suite == 'unstable' and \ binary not in self.binaries[suite][parch][0] and \ - len([x for x in rdeps if x not in [y.split("/")[0] for y in source[BINARIES]]]) > 0 and \ ('ALL' in self.options.smooth_updates or \ binaries[parch][0][binary][SECTION] in self.options.smooth_updates): - continue + + # if the package has reverse-dependencies which are + # built from other sources, it's a valid candidate for + # a smooth update. if not, it may still be a valid + # candidate if one if its r-deps is itself a candidate, + # so note it for checking later + rdeps = binaries[parch][0][binary][RDEPENDS] + + if len([x for x in rdeps if x not in [y.split("/")[0] for y in bins]]) > 0: + smoothbins.append(p) + else: + check.append(p) + + # check whether we should perform a smooth update for + # packages which are candidates but do not have r-deps + # outside of the current source + for p in check: + binary, parch = p.split("/") + rdeps = [ bin for bin in binaries[parch][0][binary][RDEPENDS] \ + if bin in [y.split("/")[0] for y in smoothbins] ] + if len(rdeps) > 0: + smoothbins.append(p) + + # remove all the binaries which aren't being smooth updated + for p in [ bin for bin in bins if bin not in smoothbins ]: + binary, parch = p.split("/") # save the old binary for undo undo['binaries'][p] = binaries[parch][0][binary] # all the reverse dependencies are affected by the change