@ -163,18 +163,29 @@ def old_libraries_format(libs):
def register_reverses ( p kg, p ackages, provides , check_doubles = True ,
def register_reverses ( p ackages, 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 )