Several (last, I hope) fixes.

bzr-import-20160707
Fabio Tranchitella 19 years ago
parent ab05768171
commit 333b76f04c

@ -1,5 +1,4 @@
#!/usr/bin/env python2.4 #!/usr/bin/env python2.4 # -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# Copyright (C) 2001-2004 Anthony Towns <ajt@debian.org> # Copyright (C) 2001-2004 Anthony Towns <ajt@debian.org>
# Andreas Barth <aba@debian.org> # Andreas Barth <aba@debian.org>
@ -830,7 +829,7 @@ class Britney:
for r in f: for r in f:
if ":" not in r: continue if ":" not in r: continue
arch, packages = r.strip().split(":", 1) arch, packages = r.strip().split(":", 1)
if arch in self.options.architectures: if arch.split("+", 1)[0] in self.options.architectures:
nuninst[arch] = packages.split() nuninst[arch] = packages.split()
return nuninst return nuninst
@ -1547,8 +1546,9 @@ class Britney:
add_nuninst(pkg_name, arch) add_nuninst(pkg_name, arch)
# if they are not required, removed architecture-indipendent packages # if they are not required, removed architecture-indipendent packages
nuninst[arch + "+all"] = nuninst[arch][:]
if skip_archall: if skip_archall:
for pkg in nuninst[arch][:]: for pkg in nuninst[arch + "+all"]:
bpkg = binaries[arch][0][pkg] bpkg = binaries[arch][0][pkg]
if bpkg['architecture'] == 'all': if bpkg['architecture'] == 'all':
nuninst[arch].remove(pkg) nuninst[arch].remove(pkg)
@ -1769,7 +1769,7 @@ class Britney:
if not binary_u: return False if not binary_u: return False
# it is broken, but we have providers # it is broken, but we have providers
if pkg in broken: if pkg in broken and pkg_from:
for p in providers: for p in providers:
# try to install the providers skipping excluded packages, # try to install the providers skipping excluded packages,
# which we already tried but do not work # which we already tried but do not work
@ -2101,7 +2101,7 @@ class Britney:
else: else:
pkg_name, suite, affected, undo = self.doop_source(pkg) pkg_name, suite, affected, undo = self.doop_source(pkg)
if hint: if hint:
lundo.append((undo, pkg, suite)) lundo.append((undo, pkg, pkg_name, suite))
# check the affected packages on all the architectures # check the affected packages on all the architectures
for arch in ("/" in pkg and (pkg.split("/")[1].split("_")[0],) or architectures): for arch in ("/" in pkg and (pkg.split("/")[1].split("_")[0],) or architectures):
@ -2110,52 +2110,65 @@ class Britney:
else: skip_archall = False else: skip_archall = False
nuninst[arch] = [x for x in nuninst_comp[arch] if x in binaries[arch][0]] nuninst[arch] = [x for x in nuninst_comp[arch] if x in binaries[arch][0]]
broken = nuninst[arch][:] nuninst[arch + "+all"] = [x for x in nuninst_comp[arch + "+all"] if x in binaries[arch][0]]
broken = nuninst[arch + "+all"][:]
to_check = [x[0] for x in affected if x[1] == arch] to_check = [x[0] for x in affected if x[1] == arch]
# broken packages (first round) # broken packages (first round)
repaired = []
old_broken = None old_broken = None
last_broken = None last_broken = None
while old_broken != broken: while old_broken != broken:
old_broken = broken[:] old_broken = broken[:]
for p in to_check: for p in to_check:
if p == last_broken: break if p == last_broken: break
if p not in binaries[arch][0] or \ if p not in binaries[arch][0]: continue
skip_archall and binaries[arch][0][p]['architecture'] == 'all': continue
r = check_installable(p, arch, 'testing', excluded=broken, conflicts=True) r = check_installable(p, arch, 'testing', excluded=broken, conflicts=True)
if not r and p not in broken: if not r and p not in broken:
last_broken = p last_broken = p
broken.append(p) broken.append(p)
elif r and p in nuninst[arch]: elif r and p in nuninst[arch + "+all"]:
last_broken = p last_broken = p
repaired.append(p)
broken.remove(p) broken.remove(p)
nuninst[arch].remove(p) nuninst[arch + "+all"].remove(p)
if not (skip_archall and binaries[arch][0][p]['architecture'] == 'all'):
nuninst[arch].remove(p)
# broken packages (second round, reverse dependencies of the first round) # broken packages (second round, reverse dependencies of the first round)
l = 0 l = 0
old_broken = None
last_broken = None last_broken = None
while l < len(broken): while old_broken != broken:
l = len(broken) old_broken = broken[:]
for j in broken: for j in broken + repaired:
if j not in binaries[arch][0]: continue if j not in binaries[arch][0]: continue
for p in binaries[arch][0][j]['rdepends']: for p in binaries[arch][0][j]['rdepends']:
if p in broken or p not in binaries[arch][0] or \ if p in broken or p not in binaries[arch][0]: continue
skip_archall and binaries[arch][0][p]['architecture'] == 'all': continue
r = check_installable(p, arch, 'testing', excluded=broken, conflicts=True) r = check_installable(p, arch, 'testing', excluded=broken, conflicts=True)
if not r and p not in broken: if not r and p not in broken:
l = -1 l = -1
last_broken = j last_broken = j
broken.append(p) broken.append(p)
elif r and p in nuninst[arch + "+all"]:
last_broken = p
repaired.append(p)
broken.remove(p)
nuninst[arch + "+all"].remove(p)
if not (skip_archall and binaries[arch][0][p]['architecture'] == 'all'):
nuninst[arch].remove(p)
if l != -1 and last_broken == j: break if l != -1 and last_broken == j: break
# update the uninstallability counter # update the uninstallability counter
for b in broken: for b in broken:
if b not in nuninst[arch]: if b not in nuninst[arch + "+all"]:
nuninst[arch + "+all"].append(b)
if b not in nuninst[arch] and not (skip_archall and binaries[arch][0][b]['architecture'] == 'all'):
nuninst[arch].append(b) nuninst[arch].append(b)
# if we are processing hints, go ahead # if we are processing hints, go ahead
if hint: if hint:
nuninst_comp[arch] = nuninst[arch] nuninst_comp[arch] = nuninst[arch]
nuninst_comp[arch + "+all"] = nuninst[arch + "+all"]
continue continue
# if the uninstallability counter is worse than before, break the loop # if the uninstallability counter is worse than before, break the loop
@ -2185,7 +2198,7 @@ class Britney:
else: else:
self.output_write("skipped: %s (%d <- %d)\n" % (pkg, len(extra), len(packages))) self.output_write("skipped: %s (%d <- %d)\n" % (pkg, len(extra), len(packages)))
self.output_write(" got: %s\n" % (self.eval_nuninst(nuninst, "/" in pkg and nuninst_comp or None))) self.output_write(" got: %s\n" % (self.eval_nuninst(nuninst, "/" in pkg and nuninst_comp or None)))
self.output_write(" * %s: %s\n" % (arch, ", ".join(sorted([b for b in broken if b not in nuninst_comp[arch]])))) self.output_write(" * %s: %s\n" % (arch, ", ".join(sorted([b for b in nuninst[arch] if b not in nuninst_comp[arch]]))))
extra.append(pkg) extra.append(pkg)
if not mark_passed: if not mark_passed:
@ -2198,9 +2211,10 @@ class Britney:
else: sources['testing'][k] = undo['sources'][k] else: sources['testing'][k] = undo['sources'][k]
# undo the changes (new binaries) # undo the changes (new binaries)
if pkg in sources[suite]: if pkg[0] != '-' and pkg_name in sources[suite]:
for p in sources[suite][pkg]['binaries']: for p in sources[suite][pkg_name]['binaries']:
binary, arch = p.split("/") binary, arch = p.split("/")
if "/" in pkg and arch != pkg[pkg.find("/")+1:]: continue
del binaries[arch][0][binary] del binaries[arch][0][binary]
# undo the changes (binaries) # undo the changes (binaries)
@ -2304,7 +2318,7 @@ class Britney:
if not earlyabort: return if not earlyabort: return
# undo all the changes # undo all the changes
for (undo, pkg, suite) in lundo: for (undo, pkg, pkg_name, suite) in lundo:
# undo the changes (source) # undo the changes (source)
for k in undo['sources'].keys(): for k in undo['sources'].keys():
if k[0] == '-': if k[0] == '-':
@ -2312,9 +2326,10 @@ class Britney:
else: self.sources['testing'][k] = undo['sources'][k] else: self.sources['testing'][k] = undo['sources'][k]
# undo the changes (new binaries) # undo the changes (new binaries)
if pkg in self.sources[suite]: if pkg_name in self.sources[suite]:
for p in self.sources[suite][pkg]['binaries']: for p in self.sources[suite][pkg_name]['binaries']:
binary, arch = p.split("/") binary, arch = p.split("/")
if "/" in pkg and arch != pkg[pkg.find("/")+1:]: continue
del self.binaries['testing'][arch][0][binary] del self.binaries['testing'][arch][0][binary]
# undo the changes (binaries) # undo the changes (binaries)
@ -2350,13 +2365,14 @@ class Britney:
self.__log("> Calculating current uninstallability counters", type="I") self.__log("> Calculating current uninstallability counters", type="I")
self.nuninst_orig = self.get_nuninst() self.nuninst_orig = self.get_nuninst()
# process `easy' hints if not self.options.actions:
for x in self.hints['easy']: # process `easy' hints
self.do_hint("easy", x[0], x[1]) for x in self.hints['easy']:
self.do_hint("easy", x[0], x[1])
# process `force-hint' hints # process `force-hint' hints
for x in self.hints["force-hint"]: for x in self.hints["force-hint"]:
self.do_hint("force-hint", x[0], x[1]) self.do_hint("force-hint", x[0], x[1])
# run the first round of the upgrade # run the first round of the upgrade
self.__log("> First loop on the packages with depth = 0", type="I") self.__log("> First loop on the packages with depth = 0", type="I")
@ -2382,6 +2398,9 @@ class Britney:
self.options.break_arches = backup self.options.break_arches = backup
self.upgrade_me = allpackages self.upgrade_me = allpackages
if self.options.actions:
return
# process `hint' hints # process `hint' hints
hintcnt = 0 hintcnt = 0
for x in self.hints["hint"][:50]: for x in self.hints["hint"][:50]:

Loading…
Cancel
Save