Replace uses of MigrationItem with HintItem

Signed-off-by: Adam D. Barratt <adam@adam-barratt.org.uk>
bzr-import-20160707
Adam D. Barratt 12 years ago
parent 629c80937d
commit 89bc7c8d61

@ -215,7 +215,7 @@ 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,
register_reverses, compute_reverse_tree, register_reverses, compute_reverse_tree,
read_nuninst, write_nuninst, write_heidi, read_nuninst, write_nuninst, write_heidi,
eval_uninst, newly_uninst) eval_uninst, newly_uninst, make_hintitem)
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)
@ -1573,7 +1573,7 @@ class Britney(object):
self.invalidate_excuses(upgrade_me, unconsidered) self.invalidate_excuses(upgrade_me, unconsidered)
# sort the list of candidates # sort the list of candidates
self.upgrade_me = sorted( MigrationItem(x) for x in upgrade_me ) self.upgrade_me = sorted( make_hintitem(x, self.sources) for x in upgrade_me )
# write excuses to the output file # write excuses to the output file
if not self.options.dry_run: if not self.options.dry_run:
@ -2011,14 +2011,14 @@ class Britney(object):
defer = False defer = False
for p in dependencies.get(pkg, []): for p in dependencies.get(pkg, []):
if p in skipped: if p in skipped:
deferred.append(pkg) deferred.append(make_hintitem(pkg, self.sources))
skipped.append(pkg) skipped.append(make_hintitem(pkg, self.sources))
defer = True defer = True
break break
if defer: continue if defer: continue
if not hint: if not hint:
self.output_write("trying: %s\n" % (pkg)) self.output_write("trying: %s\n" % (pkg.uvname))
better = True better = True
nuninst = {} nuninst = {}
@ -2040,7 +2040,7 @@ class Britney(object):
nuninst[arch] = set(x for x in nuninst_comp[arch] if x in binaries[arch][0]) nuninst[arch] = set(x for x in nuninst_comp[arch] if x in binaries[arch][0])
nuninst[arch + "+all"] = set(x for x in nuninst_comp[arch + "+all"] if x in binaries[arch][0]) nuninst[arch + "+all"] = set(x for x in nuninst_comp[arch + "+all"] if x in binaries[arch][0])
check_packages(arch, affected, skip_archall, nuninst, pkg) check_packages(arch, affected, skip_archall, nuninst, pkg.uvname)
# if we are processing hints, go ahead # if we are processing hints, go ahead
if hint: if hint:
@ -2063,7 +2063,7 @@ class Britney(object):
selected.append(pkg) selected.append(pkg)
packages.extend(extra) packages.extend(extra)
extra = [] extra = []
self.output_write("accepted: %s\n" % (pkg)) self.output_write("accepted: %s\n" % (pkg.uvname))
self.output_write(" ori: %s\n" % (self.eval_nuninst(self.nuninst_orig))) self.output_write(" ori: %s\n" % (self.eval_nuninst(self.nuninst_orig)))
self.output_write(" pre: %s\n" % (self.eval_nuninst(nuninst_comp))) self.output_write(" pre: %s\n" % (self.eval_nuninst(nuninst_comp)))
self.output_write(" now: %s\n" % (self.eval_nuninst(nuninst, nuninst_comp))) self.output_write(" now: %s\n" % (self.eval_nuninst(nuninst, nuninst_comp)))
@ -2074,13 +2074,13 @@ class Britney(object):
for k in nuninst: for k in nuninst:
nuninst_comp[k] = nuninst[k] nuninst_comp[k] = nuninst[k]
else: else:
self.output_write("skipped: %s (%d <- %d)\n" % (pkg, len(extra), len(packages))) self.output_write("skipped: %s (%d <- %d)\n" % (pkg.uvname, len(extra), len(packages)))
self.output_write(" got: %s\n" % (self.eval_nuninst(nuninst, pkg.architecture != 'source' and nuninst_comp or None))) self.output_write(" got: %s\n" % (self.eval_nuninst(nuninst, pkg.architecture != 'source' and nuninst_comp or None)))
self.output_write(" * %s: %s\n" % (arch, ", ".join(sorted(b for b in nuninst[arch] 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(item)
if not mark_passed: if not mark_passed:
skipped.append(pkg) skipped.append(item)
single_undo = [(undo, item)] single_undo = [(undo, item)]
# (local-scope) binaries is actually self.binaries["testing"] so we cannot use it here. # (local-scope) binaries is actually self.binaries["testing"] so we cannot use it here.
undo_changes(single_undo, systems, sources, self.binaries) undo_changes(single_undo, systems, sources, self.binaries)
@ -2281,7 +2281,7 @@ class Britney(object):
if len(removals) > 0: if len(removals) > 0:
self.output_write("Removing packages left in testing for smooth updates (%d):\n%s" % \ self.output_write("Removing packages left in testing for smooth updates (%d):\n%s" % \
(len(removals), old_libraries_format(removals))) (len(removals), old_libraries_format(removals)))
self.do_all(actions=[ MigrationItem(x) for x in removals ]) self.do_all(actions=removals)
removals = self.old_libraries() removals = self.old_libraries()
else: else:
removals = () removals = ()
@ -2451,7 +2451,7 @@ class Britney(object):
self.dependencies[e.name] = e.deps self.dependencies[e.name] = e.deps
# replace the list of actions with the new one # replace the list of actions with the new one
self.upgrade_me = [ MigrationItem(x) for x in upgrade_me ] self.upgrade_me = [ make_hintitem(x, self.sources) for x in upgrade_me ]
def auto_hinter(self): def auto_hinter(self):
"""Auto-generate "easy" hints. """Auto-generate "easy" hints.
@ -2551,7 +2551,7 @@ class Britney(object):
pkg = testing[arch][0][pkg_name] pkg = testing[arch][0][pkg_name]
if pkg_name not in unstable[arch][0] and \ if pkg_name not in unstable[arch][0] and \
not same_source(sources[pkg[SOURCE]][VERSION], pkg[SOURCEVER]): not same_source(sources[pkg[SOURCE]][VERSION], pkg[SOURCEVER]):
removals.append("-" + pkg_name + "/" + arch) removals.append(HintItem("-" + pkg_name + "/" + arch + "/" + pkg[SOURCEVER]))
return removals return removals
def nuninst_arch_report(self, nuninst, arch): def nuninst_arch_report(self, nuninst, arch):

@ -154,12 +154,11 @@ def old_libraries_format(libs):
"""Format old libraries in a smart table""" """Format old libraries in a smart table"""
libraries = {} libraries = {}
for i in libs: for i in libs:
pkg, arch = i.split("/") pkg = i.package
pkg = pkg[1:]
if pkg in libraries: if pkg in libraries:
libraries[pkg].append(arch) libraries[pkg].append(i.architecture)
else: else:
libraries[pkg] = [arch] libraries[pkg] = [i.architecture]
return "\n".join(" " + k + ": " + " ".join(libraries[k]) for k in libraries) + "\n" return "\n".join(" " + k + ": " + " ".join(libraries[k]) for k in libraries) + "\n"

Loading…
Cancel
Save