summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-05-24 19:52:17 -0700
committerZac Medico <zmedico@gentoo.org>2011-05-24 19:52:17 -0700
commit20498936b79906dfcb31a84cfd9e97ee20c94147 (patch)
tree39c236d1cb9ee81b3d538dfac87d46b0a570a462 /pym
parentfe1022a42fcbfd28c8eab09fe029462a68a62846 (diff)
downloadportage-20498936b79906dfcb31a84cfd9e97ee20c94147.tar.gz
portage-20498936b79906dfcb31a84cfd9e97ee20c94147.tar.bz2
portage-20498936b79906dfcb31a84cfd9e97ee20c94147.zip
depgraph: detect deps broken by autounmask
This will fix bug #368429.
Diffstat (limited to 'pym')
-rw-r--r--pym/_emerge/depgraph.py38
1 files changed, 37 insertions, 1 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 34639258e..fec23779a 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -2740,15 +2740,18 @@ class depgraph(object):
def _show_unsatisfied_dep(self, root, atom, myparent=None, arg=None,
- check_backtrack=False):
+ check_backtrack=False, check_autounmask_breakage=False):
"""
When check_backtrack=True, no output is produced and
the method either returns or raises _backtrack_mask if
a matching package has been masked by backtracking.
"""
backtrack_mask = False
+ autounmask_broke_use_dep = False
atom_set = InternalPackageSet(initial_atoms=(atom.without_use,),
allow_repo=True)
+ atom_set_with_use = InternalPackageSet(initial_atoms=(atom,),
+ allow_repo=True)
xinfo = '"%s"' % atom.unevaluated_atom
if arg:
xinfo='"%s"' % arg
@@ -2823,6 +2826,8 @@ class depgraph(object):
or atom.violated_conditionals(self._pkg_use_enabled(pkg), pkg.iuse.is_valid_flag).use:
missing_use.append(pkg)
if not mreasons:
+ if atom_set_with_use.findAtomForPackage(pkg):
+ autounmask_broke_use_dep = True
continue
except InvalidAtom:
writemsg("violated_conditionals raised " + \
@@ -2855,6 +2860,12 @@ class depgraph(object):
else:
return
+ if check_autounmask_breakage:
+ if autounmask_broke_use_dep:
+ raise self._autounmask_breakage()
+ else:
+ return
+
missing_use_reasons = []
missing_iuse_reasons = []
for pkg in missing_use:
@@ -6342,6 +6353,13 @@ class depgraph(object):
backtracking.
"""
+ class _autounmask_breakage(_internal_exception):
+ """
+ This is raised by _show_unsatisfied_dep() when it's called with
+ check_autounmask_breakage=True and a matching package has been
+ been disqualified due to autounmask changes.
+ """
+
def need_restart(self):
return self._dynamic_config._need_restart and \
not self._dynamic_config._skip_restart
@@ -6349,6 +6367,15 @@ class depgraph(object):
def success_without_autounmask(self):
return self._dynamic_config._success_without_autounmask
+ def autounmask_breakage_detected(self):
+ try:
+ for pargs, kwargs in self._dynamic_config._unsatisfied_deps_for_display:
+ self._show_unsatisfied_dep(
+ *pargs, check_autounmask_breakage=True, **kwargs)
+ except self._autounmask_breakage:
+ return True
+ return False
+
def get_backtrack_infos(self):
return self._dynamic_config._backtrack_infos
@@ -6640,6 +6667,15 @@ def _backtrack_depgraph(settings, trees, myopts, myparams, myaction, myfiles, sp
allow_backtracking=False,
backtrack_parameters=backtracker.get_best_run())
success, favorites = mydepgraph.select_files(myfiles)
+ if not success and mydepgraph.autounmask_breakage_detected():
+ if "--debug" in myopts:
+ writemsg_level(
+ "\n\nautounmask breakage detectedn\n",
+ noiselevel=-1, level=logging.DEBUG)
+ myopts["--autounmask"] = "n"
+ mydepgraph = depgraph(settings, trees, myopts, myparams, spinner,
+ frozen_config=frozen_config, allow_backtracking=False)
+ success, favorites = mydepgraph.select_files(myfiles)
return (success, mydepgraph, favorites)