do_all: Simplify the assignments to a variable

At a glance, it looks like the value of "better" variable can be
decided from 3-4 places.  However, due to the code flow only two of
those assignments are truly "live"/useful.

Signed-off-by: Niels Thykier <niels@thykier.net>
ubuntu/rebased
Niels Thykier 7 years ago
parent ba74012678
commit 9030ff4d99

@ -2281,7 +2281,6 @@ class Britney(object):
recurse = True recurse = True
lundo = None lundo = None
nuninst_end = None nuninst_end = None
better = True
extra = [] extra = []
if hinttype == "easy" or hinttype == "force-hint": if hinttype == "easy" or hinttype == "force-hint":
@ -2306,13 +2305,10 @@ class Britney(object):
if init: if init:
# init => a hint (e.g. "easy") - so do the hint run # init => a hint (e.g. "easy") - so do the hint run
(better, nuninst_end, undo_list, _) = self.try_migration(selected, (_, nuninst_end, undo_list, _) = self.try_migration(selected,
self.nuninst_orig, self.nuninst_orig,
lundo=lundo, lundo=lundo,
automatic_revert=False) automatic_revert=False)
if force:
# Force implies "unconditionally better"
better = True
if lundo is not None: if lundo is not None:
lundo.extend(undo_list) lundo.extend(undo_list)
@ -2338,7 +2334,10 @@ class Britney(object):
self.output_write(eval_uninst(self.options.architectures, self.output_write(eval_uninst(self.options.architectures,
newly_uninst(nuninst_start, nuninst_end))) newly_uninst(nuninst_start, nuninst_end)))
if not force: if force:
# Force implies "unconditionally better"
better = True
else:
break_arches = set(self.options.break_arches) break_arches = set(self.options.break_arches)
if all(x.architecture in break_arches for x in selected): if all(x.architecture in break_arches for x in selected):
# If we only migrated items from break-arches, then we # If we only migrated items from break-arches, then we

Loading…
Cancel
Save