summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-10-10 15:50:30 -0700
committerZac Medico <zmedico@gentoo.org>2010-10-10 15:50:30 -0700
commit2186f87c22e0c4bdb86065855c2034bdbb66fa45 (patch)
treeeeb6aa0bfe9e9aea01c08486a1c6acd2e56b2a24
parent496e25cdb11759eaa2eab9cf2d82b4ebf44ae9d5 (diff)
downloadportage-2186f87c22e0c4bdb86065855c2034bdbb66fa45.tar.gz
portage-2186f87c22e0c4bdb86065855c2034bdbb66fa45.tar.bz2
portage-2186f87c22e0c4bdb86065855c2034bdbb66fa45.zip
Use tries instead of depth for --backtrack.
Also, ensure that we fall back to legacy non-backtracking behavior if backtracking fails for some reason. This is intended to solve regressions reported in forum thread #847890.
-rw-r--r--pym/_emerge/depgraph.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index a9c75be6d..edc920d46 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -5511,14 +5511,18 @@ def backtrack_depgraph(settings, trees, myopts, myparams,
def _backtrack_depgraph(settings, trees, myopts, myparams, myaction, myfiles, spinner):
+ max_retries = myopts.get('--backtrack', 5)
max_depth = myopts.get('--backtrack', 5)
- allow_backtracking = max_depth > 0
+ allow_backtracking = max_retries > 0
backtracker = Backtracker(max_depth)
+ backtracked = False
+ tries = 0
frozen_config = _frozen_depgraph_config(settings, trees,
myopts, spinner)
while backtracker:
+ tries += 1
backtrack_parameters = backtracker.get()
mydepgraph = depgraph(settings, trees, myopts, myparams, spinner,
@@ -5529,21 +5533,22 @@ def _backtrack_depgraph(settings, trees, myopts, myparams, myaction, myfiles, sp
if success or mydepgraph.success_without_autounmask():
break
+ elif tries > max_retries:
+ break
elif mydepgraph.need_restart():
- backtracker.feedback(mydepgraph.get_backtrack_infos())
+ backtracked = True
+ backtracker.feedback(mydepgraph.get_backtrack_infos())
- if not (success or mydepgraph.success_without_autounmask()) and backtracker.backtracked():
- backtrack_parameters = backtracker.get_best_run()
+ if not (success or mydepgraph.success_without_autounmask()) and backtracked:
if "--debug" in myopts:
writemsg_level(
"\n\nbacktracking aborted after %s tries\n\n" % \
- max_depth, noiselevel=-1, level=logging.DEBUG)
+ tries, noiselevel=-1, level=logging.DEBUG)
mydepgraph = depgraph(settings, trees, myopts, myparams, spinner,
frozen_config=frozen_config,
- allow_backtracking=False,
- backtrack_parameters=backtrack_parameters)
+ allow_backtracking=False)
success, favorites = mydepgraph.select_files(myfiles)
return (success, mydepgraph, favorites)