From: Zac Medico Date: Fri, 21 Aug 2009 22:35:11 +0000 (-0000) Subject: Add some --debug output for backtracking. Also, remove unused imports. X-Git-Tag: v2.2_rc39 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b2136c384e68856cba89d1c571f408620e525210;p=portage.git Add some --debug output for backtracking. Also, remove unused imports. svn path=/main/trunk/; revision=14122 --- diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index fb6c51084..ebb3bfda4 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -3,6 +3,7 @@ # $Id$ import gc +import logging import re import sys import textwrap @@ -17,6 +18,7 @@ bad = create_color_func("BAD") from portage.sets import SETPREFIX from portage.sets.base import InternalPackageSet from portage.util import cmp_sort_key, writemsg, writemsg_stdout +from portage.util import writemsg_level from _emerge.AtomArg import AtomArg from _emerge.Blocker import Blocker @@ -24,7 +26,6 @@ from _emerge.BlockerCache import BlockerCache from _emerge.BlockerDepPriority import BlockerDepPriority from _emerge.changelog import calc_changelog from _emerge.countdown import countdown -from _emerge.create_depgraph_params import create_depgraph_params from _emerge.create_world_atom import create_world_atom from _emerge.Dependency import Dependency from _emerge.DependencyArg import DependencyArg @@ -714,6 +715,18 @@ class depgraph(object): dep.parent, {})["missing dependency"] = \ set([(dep.parent, dep.root, dep.atom)]) self._dynamic_config._need_restart = True + if "--debug" in self._frozen_config.myopts: + msg = [] + msg.append("") + msg.append("") + msg.append("backtracking due to unsatisfied dep:") + msg.append(" parent: %s" % dep.parent) + msg.append(" priority: %s" % dep.priority) + msg.append(" root: %s" % dep.root) + msg.append(" atom: %s" % dep.atom) + msg.append("") + writemsg_level("".join("%s\n" % l for l in msg), + noiselevel=-1, level=logging.DEBUG) return 0 # In some cases, dep_check will return deps that shouldn't @@ -868,6 +881,19 @@ class depgraph(object): self._dynamic_config._runtime_pkg_mask.setdefault( existing_node, {})["slot conflict"] = parent_atoms self._dynamic_config._need_restart = True + if "--debug" in self._frozen_config.myopts: + msg = [] + msg.append("") + msg.append("") + msg.append("backtracking due to slot conflict:") + msg.append(" package: %s" % existing_node) + msg.append(" slot: %s" % existing_node.slot_atom) + msg.append(" parents: %s" % \ + [(str(parent), atom) \ + for parent, atom in parent_atoms]) + msg.append("") + writemsg_level("".join("%s\n" % l for l in msg), + noiselevel=-1, level=logging.DEBUG) return 0 # A slot collision has occurred. Sometimes this coincides @@ -3866,8 +3892,6 @@ class depgraph(object): depth >= mylist[i+1][1]: del mylist[i] - from portage import flatten - from portage.dep import use_reduce, paren_reduce # files to fetch list - avoids counting a same file twice # in size display (verbose mode) myfetchlist=[] @@ -4966,6 +4990,10 @@ def backtrack_depgraph(settings, trees, myopts, myparams, runtime_pkg_mask = mydepgraph.get_runtime_pkg_mask() backtracked += 1 elif backtracked and allow_backtracking: + if "--debug" in myopts: + writemsg_level( + "\n\nbacktracking aborted after %s tries\n\n" % \ + backtracked, noiselevel=-1, level=logging.DEBUG) # Backtracking failed, so disable it and do # a plain dep calculation + error message. allow_backtracking = False