Simplified get_reverse_tree

Removed the "packages" variable from get_reverse_tree as it was just a
"list" variant of "seen".

Signed-off-by: Niels Thykier <niels@thykier.net>
debian
Niels Thykier 13 years ago
parent b0ce8b4b7f
commit 917b848455

@ -1952,15 +1952,12 @@ class Britney:
return (item, affected, undo) return (item, affected, undo)
def get_reverse_tree(self, pkg, arch, suite): def get_reverse_tree(self, pkg, arch, suite):
packages = []
binaries = self.binaries[suite][arch][0] binaries = self.binaries[suite][arch][0]
rev_deps = set(binaries[pkg][RDEPENDS]) rev_deps = set(binaries[pkg][RDEPENDS])
seen = set() seen = set()
while len(rev_deps) > 0: while len(rev_deps) > 0:
# mark all of the current iteration of packages as affected # mark all of the current iteration of packages as affected
packages.extend( [ x for x in rev_deps ] )
# and as processed
seen |= rev_deps seen |= rev_deps
# generate the next iteration, which is the reverse-dependencies of # generate the next iteration, which is the reverse-dependencies of
# the current iteration # the current iteration
@ -1970,9 +1967,7 @@ class Britney:
# in the process # in the process
rev_deps = set([ package for sublist in new_rev_deps \ rev_deps = set([ package for sublist in new_rev_deps \
for package in sublist if package not in seen ]) for package in sublist if package not in seen ])
# remove duplicates from the list of affected packages return list(seen)
packages = list(set(packages))
return packages
def get_full_tree(self, pkg, arch, suite): def get_full_tree(self, pkg, arch, suite):
"""Calculate the full dependency tree for the given package """Calculate the full dependency tree for the given package

Loading…
Cancel
Save