Final (I hope) commit, the code is fully working and fully compatible with the old britney (minus the last 5 randoms tries).

bzr-import-20160707
Fabio Tranchitella 19 years ago
parent 90a090767e
commit b8b362aaf5

@ -2063,9 +2063,9 @@ class Britney:
pkg_name, suite, affected, undo = self.doop_source(pkg) pkg_name, suite, affected, undo = self.doop_source(pkg)
pre_process[pkg] = (pkg_name, suite, affected, undo) pre_process[pkg] = (pkg_name, suite, affected, undo)
lundo = []
if not hint: if not hint:
self.output_write("recur: [%s] %s %d/%d\n" % ("", ",".join(selected), len(packages), len(extra))) self.output_write("recur: [%s] %s %d/%d\n" % ("", ",".join(selected), len(packages), len(extra)))
else: lundo = []
# loop on the packages (or better, actions) # loop on the packages (or better, actions)
while packages: while packages:
@ -2182,6 +2182,7 @@ class Britney:
# check if the action improved the uninstallability counters # check if the action improved the uninstallability counters
if better: if better:
lundo.append((undo, pkg, pkg_name, suite))
selected.append(pkg) selected.append(pkg)
packages.extend(extra) packages.extend(extra)
extra = [] extra = []
@ -2236,7 +2237,7 @@ class Britney:
# if we are processing hints, return now # if we are processing hints, return now
if hint: if hint:
return (nuninst_comp, lundo) return (nuninst_comp, [], lundo)
self.output_write(" finish: [%s]\n" % ",".join(selected)) self.output_write(" finish: [%s]\n" % ",".join(selected))
self.output_write("endloop: %s\n" % (self.eval_nuninst(self.nuninst_orig))) self.output_write("endloop: %s\n" % (self.eval_nuninst(self.nuninst_orig)))
@ -2244,7 +2245,7 @@ class Britney:
self.output_write(self.eval_uninst(self.newlyuninst(self.nuninst_orig, nuninst_comp))) self.output_write(self.eval_uninst(self.newlyuninst(self.nuninst_orig, nuninst_comp)))
self.output_write("\n") self.output_write("\n")
return (nuninst_comp, extra) return (nuninst_comp, extra, lundo)
def do_all(self, maxdepth=0, init=None, actions=None): def do_all(self, maxdepth=0, init=None, actions=None):
"""Testing update runner """Testing update runner
@ -2284,16 +2285,21 @@ class Britney:
if earlyabort: if earlyabort:
extra = upgrade_me[:] extra = upgrade_me[:]
(nuninst_end, lundo) = self.iter_packages(init, selected, hint=True) (nuninst_end, extra, lundo) = self.iter_packages(init, selected, hint=True)
undo = True
self.output_write("easy: %s\n" % (self.eval_nuninst(nuninst_end))) self.output_write("easy: %s\n" % (self.eval_nuninst(nuninst_end)))
self.output_write(self.eval_uninst(self.newlyuninst(nuninst_start, nuninst_end)) + "\n") self.output_write(self.eval_uninst(self.newlyuninst(nuninst_start, nuninst_end)) + "\n")
if not force and not self.is_nuninst_asgood_generous(self.nuninst_orig, nuninst_end): if not force and not self.is_nuninst_asgood_generous(self.nuninst_orig, nuninst_end):
nuninst_end, extra = None, None nuninst_end, extra = None, None
else: else:
lundo = []
if init: if init:
(nuninst_end, lundo) = self.iter_packages(init, selected, hint=True) (nuninst_end, extra, tundo) = self.iter_packages(init, selected, hint=True)
lundo.extend(tundo)
undo = True
else: nuninst_end = None else: nuninst_end = None
(nuninst_end, extra) = self.iter_packages(upgrade_me, selected, nuninst=nuninst_end) (nuninst_end, extra, tundo) = self.iter_packages(upgrade_me, selected, nuninst=nuninst_end)
lundo.extend(tundo)
if not self.is_nuninst_asgood_generous(self.nuninst_orig, nuninst_end): if not self.is_nuninst_asgood_generous(self.nuninst_orig, nuninst_end):
nuninst_end, extra = None, None nuninst_end, extra = None, None
@ -2313,9 +2319,8 @@ class Britney:
if not self.options.compatible: if not self.options.compatible:
self.sort_actions() self.sort_actions()
else: else:
if init: self.nuninst_orig = backup
self.output_write("FAILED\n") self.output_write("FAILED\n")
if not earlyabort and not init: return if not undo: return
# undo all the changes # undo all the changes
for (undo, pkg, pkg_name, suite) in lundo: for (undo, pkg, pkg_name, suite) in lundo:
@ -2326,7 +2331,7 @@ 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_name in self.sources[suite]: if pkg[0] != '-' and pkg_name in self.sources[suite]:
for p in self.sources[suite][pkg_name]['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 if "/" in pkg and arch != pkg[pkg.find("/")+1:]: continue

Loading…
Cancel
Save