mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-05-16 04:51:32 +00:00
Move register_reverses to britney_util
Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
88e8ff6005
commit
9dc6d1415e
44
britney.py
44
britney.py
@ -213,7 +213,7 @@ from migrationitem import MigrationItem, HintItem
|
|||||||
from hints import HintCollection
|
from hints import HintCollection
|
||||||
from britney import buildSystem
|
from britney import buildSystem
|
||||||
from britney_util import (old_libraries_format, same_source, undo_changes,
|
from britney_util import (old_libraries_format, same_source, undo_changes,
|
||||||
ifilter_except, ifilter_only)
|
register_reverses)
|
||||||
from consts import (VERSION, SECTION, BINARIES, MAINTAINER, FAKESRC,
|
from consts import (VERSION, SECTION, BINARIES, MAINTAINER, FAKESRC,
|
||||||
SOURCE, SOURCEVER, ARCHITECTURE, DEPENDS, CONFLICTS,
|
SOURCE, SOURCEVER, ARCHITECTURE, DEPENDS, CONFLICTS,
|
||||||
PROVIDES, RDEPENDS, RCONFLICTS)
|
PROVIDES, RDEPENDS, RCONFLICTS)
|
||||||
@ -566,52 +566,12 @@ 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
|
||||||
register_reverses = self.register_reverses
|
|
||||||
for pkg in packages:
|
for pkg in packages:
|
||||||
register_reverses(pkg, 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)
|
||||||
|
|
||||||
def register_reverses(self, pkg, packages, provides, check_doubles=True, parse_depends=apt_pkg.parse_depends):
|
|
||||||
"""Register reverse dependencies and conflicts for the specified package
|
|
||||||
|
|
||||||
This method registers the reverse dependencies and conflicts for
|
|
||||||
a given package using `packages` as the list of packages and `provides`
|
|
||||||
as the list of virtual packages.
|
|
||||||
|
|
||||||
The method has an optional parameter parse_depends which is there
|
|
||||||
just for performance reasons and is not meant to be overwritten.
|
|
||||||
"""
|
|
||||||
# register the list of the dependencies for the depending packages
|
|
||||||
dependencies = []
|
|
||||||
if packages[pkg][DEPENDS]:
|
|
||||||
dependencies.extend(parse_depends(packages[pkg][DEPENDS], False))
|
|
||||||
# go through the list
|
|
||||||
for p in dependencies:
|
|
||||||
for a in p:
|
|
||||||
# register real packages
|
|
||||||
if a[0] in packages and (not check_doubles or pkg not in packages[a[0]][RDEPENDS]):
|
|
||||||
packages[a[0]][RDEPENDS].append(pkg)
|
|
||||||
# also register packages which provide the package (if any)
|
|
||||||
if a[0] in provides:
|
|
||||||
for i in provides.get(a[0]):
|
|
||||||
if i not in packages: continue
|
|
||||||
if not check_doubles or pkg not in packages[i][RDEPENDS]:
|
|
||||||
packages[i][RDEPENDS].append(pkg)
|
|
||||||
# register the list of the conflicts for the conflicting packages
|
|
||||||
if packages[pkg][CONFLICTS]:
|
|
||||||
for p in parse_depends(packages[pkg][CONFLICTS], False):
|
|
||||||
for a in p:
|
|
||||||
# register real packages
|
|
||||||
if a[0] in packages and (not check_doubles or pkg not in packages[a[0]][RCONFLICTS]):
|
|
||||||
packages[a[0]][RCONFLICTS].append(pkg)
|
|
||||||
# also register packages which provide the package (if any)
|
|
||||||
if a[0] in provides:
|
|
||||||
for i in provides[a[0]]:
|
|
||||||
if i not in packages: continue
|
|
||||||
if not check_doubles or pkg not in packages[i][RCONFLICTS]:
|
|
||||||
packages[i][RCONFLICTS].append(pkg)
|
|
||||||
|
|
||||||
def read_bugs(self, basedir):
|
def read_bugs(self, basedir):
|
||||||
"""Read the release critial bug summary from the specified directory
|
"""Read the release critial bug summary from the specified directory
|
||||||
@ -2031,7 +1991,7 @@ class Britney(object):
|
|||||||
for p in source[BINARIES]:
|
for p in source[BINARIES]:
|
||||||
binary, parch = p.split("/")
|
binary, parch = p.split("/")
|
||||||
if item.architecture not in ['source', parch]: continue
|
if item.architecture not in ['source', parch]: continue
|
||||||
self.register_reverses(binary, binaries[parch][0] , binaries[parch][1])
|
register_reverses(binary, binaries[parch][0] , binaries[parch][1])
|
||||||
|
|
||||||
# add/update the source package
|
# add/update the source package
|
||||||
if item.architecture == 'source':
|
if item.architecture == 'source':
|
||||||
|
@ -18,10 +18,14 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
|
||||||
|
import apt_pkg
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from itertools import ifilter, ifilterfalse
|
from itertools import ifilter, ifilterfalse
|
||||||
import re
|
import re
|
||||||
from consts import BINARIES, PROVIDES
|
|
||||||
|
|
||||||
|
from consts import (BINARIES, PROVIDES, DEPENDS, CONFLICTS,
|
||||||
|
RDEPENDS, RCONFLICTS)
|
||||||
|
|
||||||
binnmu_re = re.compile(r'^(.*)\+b\d+$')
|
binnmu_re = re.compile(r'^(.*)\+b\d+$')
|
||||||
|
|
||||||
@ -157,3 +161,46 @@ def old_libraries_format(libs):
|
|||||||
libraries[pkg] = [arch]
|
libraries[pkg] = [arch]
|
||||||
return "\n".join(" " + k + ": " + " ".join(libraries[k]) for k in libraries) + "\n"
|
return "\n".join(" " + k + ": " + " ".join(libraries[k]) for k in libraries) + "\n"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def register_reverses(pkg, packages, provides, check_doubles=True,
|
||||||
|
parse_depends=apt_pkg.parse_depends,
|
||||||
|
RDEPENDS=RDEPENDS, RCONFLICTS=RCONFLICTS):
|
||||||
|
"""Register reverse dependencies and conflicts for the specified package
|
||||||
|
|
||||||
|
This method registers the reverse dependencies and conflicts for
|
||||||
|
a given package using `packages` as the list of packages and `provides`
|
||||||
|
as the list of virtual packages.
|
||||||
|
|
||||||
|
The "X=X" parameters are optimizations to avoid "load global" in
|
||||||
|
the loops.
|
||||||
|
"""
|
||||||
|
# register the list of the dependencies for the depending packages
|
||||||
|
dependencies = []
|
||||||
|
if packages[pkg][DEPENDS]:
|
||||||
|
dependencies.extend(parse_depends(packages[pkg][DEPENDS], False))
|
||||||
|
# go through the list
|
||||||
|
for p in dependencies:
|
||||||
|
for a in p:
|
||||||
|
# register real packages
|
||||||
|
if a[0] in packages and (not check_doubles or pkg not in packages[a[0]][RDEPENDS]):
|
||||||
|
packages[a[0]][RDEPENDS].append(pkg)
|
||||||
|
# also register packages which provide the package (if any)
|
||||||
|
if a[0] in provides:
|
||||||
|
for i in provides.get(a[0]):
|
||||||
|
if i not in packages: continue
|
||||||
|
if not check_doubles or pkg not in packages[i][RDEPENDS]:
|
||||||
|
packages[i][RDEPENDS].append(pkg)
|
||||||
|
# register the list of the conflicts for the conflicting packages
|
||||||
|
if packages[pkg][CONFLICTS]:
|
||||||
|
for p in parse_depends(packages[pkg][CONFLICTS], False):
|
||||||
|
for a in p:
|
||||||
|
# register real packages
|
||||||
|
if a[0] in packages and (not check_doubles or pkg not in packages[a[0]][RCONFLICTS]):
|
||||||
|
packages[a[0]][RCONFLICTS].append(pkg)
|
||||||
|
# also register packages which provide the package (if any)
|
||||||
|
if a[0] in provides:
|
||||||
|
for i in provides[a[0]]:
|
||||||
|
if i not in packages: continue
|
||||||
|
if not check_doubles or pkg not in packages[i][RCONFLICTS]:
|
||||||
|
packages[i][RCONFLICTS].append(pkg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user