From: Zac Medico Date: Sun, 28 Jul 2013 23:02:46 +0000 (-0700) Subject: depgraph: avoid conflicts during _complete_graph X-Git-Tag: v2.2.0_alpha191~8 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6175b127b82dc2c777c7d134085457946d1e36e5;p=portage.git depgraph: avoid conflicts during _complete_graph During _complete_graph, it was possible for _select_pkg_from_graph to make some poor package selections that would result in conflicts when there were two matches in different slots that conflicted with eachother. --- diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 939adde49..a7316f018 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -5084,9 +5084,16 @@ class depgraph(object): matches = graph_db.match_pkgs(atom) if not matches: return None, None - pkg = matches[-1] # highest match - in_graph = self._dynamic_config._slot_pkg_map[root].get(pkg.slot_atom) - return pkg, in_graph + + # There may be multiple matches, and they may + # conflict with eachother, so choose the highest + # version that has already been added to the graph. + for pkg in reversed(matches): + if pkg in self._dynamic_config.digraph: + return pkg, pkg + + # Fall back to installed packages + return self._select_pkg_from_installed(root, atom, onlydeps=onlydeps) def _select_pkg_from_installed(self, root, atom, onlydeps=False): """