From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1PoRAG-0003yY-Uy for garchives@archives.gentoo.org; Sun, 13 Feb 2011 01:54:17 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4A546E0932; Sun, 13 Feb 2011 01:54:10 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 0554CE0932 for ; Sun, 13 Feb 2011 01:54:09 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7AB531B43C5 for ; Sun, 13 Feb 2011 01:54:09 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id C8CF48006A for ; Sun, 13 Feb 2011 01:54:08 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dep/, pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/depgraph.py pym/portage/dep/dep_check.py X-VCS-Directories: pym/portage/dep/ pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: c42004eb552c9117d221b0e2063e8696efca35dc Date: Sun, 13 Feb 2011 01:54:08 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 702ab6eeba7cc607ef7d335324f8e758 commit: c42004eb552c9117d221b0e2063e8696efca35dc Author: Zac Medico gentoo org> AuthorDate: Sun Feb 13 01:52:11 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Feb 13 01:52:11 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dc42004eb depgraph: return virtual edges from select_atoms --- pym/_emerge/depgraph.py | 78 ++++++++++++++++++++++--------------= ----- pym/portage/dep/dep_check.py | 7 ++-- 2 files changed, 46 insertions(+), 39 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index fb54f50..e571763 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -12,7 +12,7 @@ import textwrap from itertools import chain =20 import portage -from portage import os +from portage import os, OrderedDict from portage import _unicode_decode from portage.const import PORTAGE_PACKAGE_ATOM from portage.dbapi import dbapi @@ -1277,31 +1277,16 @@ class depgraph(object): # by dep_zapdeps. We preserve actual parent/child relationships # here in order to avoid distorting the dependency graph like # <=3Dportage-2.1.6.x did. - while selected_atoms: - - # Since _select_atoms currently doesn't return parent - # info for recursively traversed virtuals, the parent - # is not known here. However, this package may have - # already been added to graph above, so we add packages - # with parents first. This way, parents are already - # recorded before a given package is added, which allows - # us to avoid triggering a slot conflict before the - # parent is known. - for virt_pkg, atoms in selected_atoms.items(): - try: - if self._dynamic_config.digraph.parent_nodes(virt_pkg): - break - except KeyError: - pass + for virt_dep, atoms in selected_atoms.items(): =20 - selected_atoms.pop(virt_pkg) + virt_pkg =3D virt_dep.child =20 if debug: writemsg_level("Candidates: %s: %s\n" % \ (virt_pkg.cpv, [str(x) for x in atoms]), noiselevel=3D-1, level=3Dlogging.DEBUG) =20 - if not self._add_pkg(virt_pkg, None): + if not self._add_pkg(virt_pkg, virt_dep): return 0 =20 for atom, child in self._minimize_children( @@ -2162,26 +2147,47 @@ class depgraph(object): selected_atoms =3D mycheck[1] else: chosen_atoms =3D frozenset(mycheck[1]) - selected_atoms =3D {parent : []} - for node in atom_graph: - if isinstance(node, Atom): - continue + selected_atoms =3D OrderedDict() + node_stack =3D [(parent, None, None)] + traversed_nodes =3D set() + while node_stack: + node, node_parent, parent_atom =3D node_stack.pop() + traversed_nodes.add(node) if node is parent: - pkg =3D parent + k =3D parent else: - pkg, virt_atom =3D node - if virt_atom not in chosen_atoms: - continue - if not portage.match_from_list(virt_atom, [pkg]): - # Typically this means that the atom - # specifies USE deps that are unsatisfied - # by the selected package. The caller will - # record this as an unsatisfied dependency - # when necessary. + if node_parent is parent: + if priority is None: + node_priority =3D None + else: + node_priority =3D priority.copy() + else: + # virtuals only have runtime deps + node_priority =3D self._priority(runtime=3DTrue) + k =3D Dependency(atom=3Dparent_atom, + blocker=3Dparent_atom.blocker, child=3Dnode, + depth=3Dnode.depth, parent=3Dnode_parent, + priority=3Dnode_priority, root=3Dnode.root) + + child_atoms =3D atom_graph.child_nodes(node) + selected_atoms[k] =3D [atom for atom in \ + child_atoms if atom in chosen_atoms] + for child_atom in child_atoms: + if child_atom not in chosen_atoms: continue - - selected_atoms[pkg] =3D [atom for atom in \ - atom_graph.child_nodes(node) if atom in chosen_atoms] + for child_node in atom_graph.child_nodes(child_atom): + if child_node in traversed_nodes: + continue + if not portage.match_from_list( + child_atom, [child_node]): + # Typically this means that the atom + # specifies USE deps that are unsatisfied + # by the selected package. The caller will + # record this as an unsatisfied dependency + # when necessary. + continue + child_node.depth =3D node.depth + 1 + node_stack.append((child_node, node, child_atom)) =20 return selected_atoms =20 diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py index ed85be6..200f016 100644 --- a/pym/portage/dep/dep_check.py +++ b/pym/portage/dep/dep_check.py @@ -36,7 +36,7 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, myse= ttings, myroot=3D"/", if parent is not None: if virt_parent is not None: graph_parent =3D virt_parent - parent =3D virt_parent[0] + parent =3D virt_parent else: graph_parent =3D parent eapi =3D parent.metadata["EAPI"] @@ -154,7 +154,7 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, my= settings, myroot=3D"/", % (depstring,), noiselevel=3D-1, level=3Dlogging.DEBUG) =20 # Set EAPI used for validation in dep_check() recursion. - mytrees["virt_parent"] =3D (pkg, virt_atom) + mytrees["virt_parent"] =3D pkg =20 try: mycheck =3D dep_check(depstring, mydbapi, mysettings, @@ -175,6 +175,7 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, my= settings, myroot=3D"/", a.append(mycheck[1]) if atom_graph is not None: atom_graph.add(virt_atom, graph_parent) + atom_graph.add(pkg, virt_atom) # Plain old-style virtuals. New-style virtuals are preferred. if not pkgs: for y in mychoices: @@ -560,7 +561,7 @@ def dep_check(depstring, mydbapi, mysettings, use=3D"= yes", mode=3DNone, myuse=3DNone, eapi =3D None if parent is not None: if virt_parent is not None: - current_parent =3D virt_parent[0] + current_parent =3D virt_parent else: current_parent =3D parent =20