mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-06-06 23:31:29 +00:00
Move the package loop into register_reverses
By moving the package loop inside register_reverses, it will be invoked a lot less (reducing the overhead of invoking functions). Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
5c1391da4f
commit
0aa2546956
13
britney.py
13
britney.py
@ -566,8 +566,7 @@ class Britney(object):
|
|||||||
packages[pkg] = dpkg
|
packages[pkg] = dpkg
|
||||||
|
|
||||||
# loop again on the list of packages to register reverse dependencies and conflicts
|
# loop again on the list of packages to register reverse dependencies and conflicts
|
||||||
for pkg in packages:
|
register_reverses(packages, provides, check_doubles=False)
|
||||||
register_reverses(pkg, packages, provides, check_doubles=False)
|
|
||||||
|
|
||||||
# return a tuple with the list of real and virtual packages
|
# return a tuple with the list of real and virtual packages
|
||||||
return (packages, provides)
|
return (packages, provides)
|
||||||
@ -1988,10 +1987,12 @@ class Britney(object):
|
|||||||
affected.update(self.get_reverse_tree(binary, parch, 'testing'))
|
affected.update(self.get_reverse_tree(binary, parch, 'testing'))
|
||||||
|
|
||||||
# register reverse dependencies and conflicts for the new binary packages
|
# register reverse dependencies and conflicts for the new binary packages
|
||||||
for p in source[BINARIES]:
|
if item.architecture == 'source':
|
||||||
binary, parch = p.split("/")
|
pkg_iter = (p.split("/")[0] for p in source[BINARIES])
|
||||||
if item.architecture not in ['source', parch]: continue
|
else:
|
||||||
register_reverses(binary, binaries[parch][0] , binaries[parch][1])
|
ext = "/" + item.architecture
|
||||||
|
pkg_iter = (p.split("/")[0] for p in source[BINARIES] if p.endswith(ext))
|
||||||
|
register_reverses(binaries[parch][0], binaries[parch][1], iterator=pkg_iter)
|
||||||
|
|
||||||
# add/update the source package
|
# add/update the source package
|
||||||
if item.architecture == 'source':
|
if item.architecture == 'source':
|
||||||
|
@ -163,18 +163,29 @@ def old_libraries_format(libs):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def register_reverses(pkg, packages, provides, check_doubles=True,
|
def register_reverses(packages, provides, check_doubles=True, iterator=None,
|
||||||
parse_depends=apt_pkg.parse_depends,
|
parse_depends=apt_pkg.parse_depends,
|
||||||
|
DEPENDS=DEPENDS, CONFLICTS=CONFLICTS,
|
||||||
RDEPENDS=RDEPENDS, RCONFLICTS=RCONFLICTS):
|
RDEPENDS=RDEPENDS, RCONFLICTS=RCONFLICTS):
|
||||||
"""Register reverse dependencies and conflicts for the specified package
|
"""Register reverse dependencies and conflicts for a given
|
||||||
|
sequence of packages
|
||||||
|
|
||||||
This method registers the reverse dependencies and conflicts for
|
This method registers the reverse dependencies and conflicts for a
|
||||||
a given package using `packages` as the list of packages and `provides`
|
given sequence of packages. "packages" is a table of real
|
||||||
as the list of virtual packages.
|
packages and "provides" is a table of virtual packages.
|
||||||
|
|
||||||
|
iterator is the sequence of packages for which the reverse
|
||||||
|
relations should be updated.
|
||||||
|
|
||||||
The "X=X" parameters are optimizations to avoid "load global" in
|
The "X=X" parameters are optimizations to avoid "load global" in
|
||||||
the loops.
|
the loops.
|
||||||
"""
|
"""
|
||||||
|
if iterator is None:
|
||||||
|
iterator = packages.iterkeys()
|
||||||
|
else:
|
||||||
|
iterator = ifilter_only(packages, iterator)
|
||||||
|
|
||||||
|
for pkg in iterator:
|
||||||
# register the list of the dependencies for the depending packages
|
# register the list of the dependencies for the depending packages
|
||||||
dependencies = []
|
dependencies = []
|
||||||
if packages[pkg][DEPENDS]:
|
if packages[pkg][DEPENDS]:
|
||||||
@ -187,7 +198,7 @@ def register_reverses(pkg, packages, provides, check_doubles=True,
|
|||||||
packages[a[0]][RDEPENDS].append(pkg)
|
packages[a[0]][RDEPENDS].append(pkg)
|
||||||
# also register packages which provide the package (if any)
|
# also register packages which provide the package (if any)
|
||||||
if a[0] in provides:
|
if a[0] in provides:
|
||||||
for i in provides.get(a[0]):
|
for i in provides[a[0]]:
|
||||||
if i not in packages: continue
|
if i not in packages: continue
|
||||||
if not check_doubles or pkg not in packages[i][RDEPENDS]:
|
if not check_doubles or pkg not in packages[i][RDEPENDS]:
|
||||||
packages[i][RDEPENDS].append(pkg)
|
packages[i][RDEPENDS].append(pkg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user