summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/actions.py52
-rw-r--r--pym/_emerge/depgraph.py32
2 files changed, 46 insertions, 38 deletions
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 4883e3730..f7ec0a15b 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -40,7 +40,7 @@ from _emerge.clear_caches import clear_caches
from _emerge.countdown import countdown
from _emerge.create_depgraph_params import create_depgraph_params
from _emerge.Dependency import Dependency
-from _emerge.depgraph import depgraph, resume_depgraph, _frozen_depgraph_config
+from _emerge.depgraph import backtrack_depgraph, depgraph, resume_depgraph
from _emerge.DepPrioritySatisfiedRange import DepPrioritySatisfiedRange
from _emerge.emergelog import emergelog
from _emerge.is_valid_package_atom import is_valid_package_atom
@@ -301,48 +301,24 @@ def action_build(settings, trees, mtimedb,
print "Calculating dependencies ",
sys.stdout.flush()
- runtime_pkg_mask = None
- allow_backtracking = True
- backtracked = False
- frozen_config = _frozen_depgraph_config(settings, trees,
- myopts, spinner)
myparams = create_depgraph_params(myopts, myaction)
- while True:
- mydepgraph = depgraph(settings, trees, myopts, myparams, spinner,
- frozen_config=frozen_config,
- allow_backtracking=allow_backtracking,
- runtime_pkg_mask=runtime_pkg_mask)
- try:
- retval, favorites = mydepgraph.select_files(myfiles)
- except portage.exception.PackageNotFound, e:
- portage.writemsg("\n!!! %s\n" % str(e), noiselevel=-1)
- return 1
- except portage.exception.PackageSetNotFound, e:
- root_config = trees[settings["ROOT"]]["root_config"]
- display_missing_pkg_set(root_config, e.value)
- return 1
- if not retval:
- if mydepgraph.need_restart():
- runtime_pkg_mask = mydepgraph.get_runtime_pkg_mask()
- backtracked = True
- elif backtracked and allow_backtracking:
- # Backtracking failed, so disable it and do
- # a plain dep calculation + error message.
- allow_backtracking = False
- runtime_pkg_mask = None
- else:
- if show_spinner:
- print "\b\b... done!"
- mydepgraph.display_problems()
- return 1
- else:
- break
-
- del frozen_config, runtime_pkg_mask
+ try:
+ success, mydepgraph, favorites = backtrack_depgraph(
+ settings, trees, myopts, myparams, myaction, myfiles, spinner)
+ except portage.exception.PackageSetNotFound, e:
+ if show_spinner:
+ print "\b\b... done!"
+ root_config = trees[settings["ROOT"]]["root_config"]
+ display_missing_pkg_set(root_config, e.value)
+ return 1
if show_spinner:
print "\b\b... done!"
+ if not success:
+ mydepgraph.display_problems()
+ return 1
+
if "--pretend" not in myopts and \
("--ask" in myopts or "--tree" in myopts or \
"--verbose" in myopts) and \
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 11b4b4963..8297a360e 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -30,6 +30,7 @@ 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
@@ -4887,6 +4888,37 @@ def insert_category_into_atom(atom, category):
ret = None
return ret
+def backtrack_depgraph(settings, trees, myopts, myparams,
+ myaction, myfiles, spinner):
+ """
+ Raises PackageSetNotFound if myfiles contains a missing package set.
+ """
+ runtime_pkg_mask = None
+ allow_backtracking = True
+ backtracked = False
+ frozen_config = _frozen_depgraph_config(settings, trees,
+ myopts, spinner)
+ while True:
+ mydepgraph = depgraph(settings, trees, myopts, myparams, spinner,
+ frozen_config=frozen_config,
+ allow_backtracking=allow_backtracking,
+ runtime_pkg_mask=runtime_pkg_mask)
+ success, favorites = mydepgraph.select_files(myfiles)
+ if not success:
+ if mydepgraph.need_restart():
+ runtime_pkg_mask = mydepgraph.get_runtime_pkg_mask()
+ backtracked = True
+ elif backtracked and allow_backtracking:
+ # Backtracking failed, so disable it and do
+ # a plain dep calculation + error message.
+ allow_backtracking = False
+ runtime_pkg_mask = None
+ else:
+ break
+ else:
+ break
+ return (success, mydepgraph, favorites)
+
def resume_depgraph(settings, trees, mtimedb, myopts, myparams, spinner):
"""
Construct a depgraph for the given resume list. This will raise