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 1QGg4J-0003ew-G7 for garchives@archives.gentoo.org; Sun, 01 May 2011 23:28:51 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 28B531C0B6; Sun, 1 May 2011 23:28:23 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id ED18E1C0B6 for ; Sun, 1 May 2011 23:28:22 +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 787A81B403A for ; Sun, 1 May 2011 23:28:22 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id C081E80505 for ; Sun, 1 May 2011 23:28:21 +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/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/depgraph.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: dd794a5e94fa846975b440824534aeffd629f60b Date: Sun, 1 May 2011 23:28:21 +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: c027f103d8a7f59889e5d250a29e56e6 commit: dd794a5e94fa846975b440824534aeffd629f60b Author: Zac Medico gentoo org> AuthorDate: Sun May 1 23:27:48 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun May 1 23:27:48 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Ddd794a5e trigger_rebuilds: handle circular deps --- pym/_emerge/depgraph.py | 28 +++++++++++++++++++++++++++- 1 files changed, 27 insertions(+), 1 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 4753bd2..5c39497 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -235,16 +235,42 @@ class _rebuild_config(object): runtime_deps =3D {} leaf_nodes =3D deque(graph.leaf_nodes()) =20 + def ignore_non_runtime(priority): + return not priority.runtime + + def ignore_non_buildtime(priority): + return not priority.buildtime + # Trigger rebuilds bottom-up (starting with the leaves) so that parent= s # will always know which children are being rebuilt. - while leaf_nodes: + while not graph.empty(): + if not leaf_nodes: + # We're interested in intersection of buildtime and runtime, + # so ignore edges that do not contain both. + leaf_nodes.extend(graph.leaf_nodes( + ignore_priority=3Dignore_non_runtime)) + if not leaf_nodes: + leaf_nodes.extend(graph.leaf_nodes( + ignore_priority=3Dignore_non_buildtime)) + if not leaf_nodes: + # We'll have to drop an edge that is both + # buildtime and runtime. This should be + # quite rare. + leaf_nodes.append(graph.order[-1]) + node =3D leaf_nodes.popleft() + if node not in graph: + # This can be triggered by circular dependencies. + continue slot_atom =3D node.slot_atom =20 # Remove our leaf node from the graph, keeping track of deps. parents =3D graph.nodes[node][1].items() graph.remove(node) for parent, priorities in parents: + if parent =3D=3D node: + # Ignore a direct cycle. + continue for priority in priorities: if priority.buildtime: build_deps.setdefault(parent, {})[slot_atom] =3D node