diff options
-rw-r--r-- | pym/_emerge/depgraph.py | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 47da7f725..2cc9e170a 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -318,9 +318,19 @@ class depgraph(object): return write = sys.stderr.write + backtrack_masked = [] for pkg, parent_atoms in missed_updates: + try: + for parent, root, atom in parent_atoms: + self._show_unsatisfied_dep(root, atom, myparent=parent, + check_backtrack=True) + except self._backtrack_mask: + # This is displayed below in abbreviated form. + backtrack_masked.append((pkg, parent_atoms)) + continue + write("\n!!! The following update has been skipped " + \ "due to unsatisfied dependencies:\n\n") @@ -333,6 +343,18 @@ class depgraph(object): self._show_unsatisfied_dep(root, atom, myparent=parent) write("\n") + if backtrack_masked: + # These are shown in abbreviated form, in order to avoid terminal + # flooding from mask messages as reported in bug #285832. + write("\n!!! The following update(s) have been skipped " + \ + "due to unsatisfied dependencies\n" + \ + "!!! triggered by backtracking:\n\n") + for pkg, parent_atoms in backtrack_masked: + write(str(pkg.slot_atom)) + if pkg.root != '/': + write(" for %s" % (pkg.root,)) + write("\n") + sys.stderr.flush() def _show_missed_update_slot_conflicts(self, missed_updates): @@ -1993,7 +2015,14 @@ class depgraph(object): return selected_atoms - def _show_unsatisfied_dep(self, root, atom, myparent=None, arg=None): + def _show_unsatisfied_dep(self, root, atom, myparent=None, arg=None, + check_backtrack=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 atom_set = InternalPackageSet(initial_atoms=(atom,)) xinfo = '"%s"' % atom if arg: @@ -2038,6 +2067,7 @@ class depgraph(object): self._dynamic_config._runtime_pkg_mask[pkg] mreasons.append('backtracking: %s' % \ ', '.join(sorted(backtrack_reasons))) + backtrack_mask = True if mreasons: masked_pkg_instances.add(pkg) if atom.use: @@ -2047,6 +2077,12 @@ class depgraph(object): masked_packages.append( (root_config, pkgsettings, cpv, metadata, mreasons)) + if check_backtrack: + if backtrack_mask: + raise self._backtrack_mask() + else: + return + missing_use_reasons = [] missing_iuse_reasons = [] for pkg in missing_use: @@ -4933,6 +4969,13 @@ class depgraph(object): graph in order to avoid making a potentially unsafe decision. """ + class _backtrack_mask(_internal_exception): + """ + This is raised by _show_unsatisfied_dep() when it's called with + check_backtrack=True and a matching package has been masked by + backtracking. + """ + def need_restart(self): return self._dynamic_config._need_restart |