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 <gentoo-commits+bounces-381455-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1R2VSO-0008O0-30
	for garchives@archives.gentoo.org; Sat, 10 Sep 2011 21:51:24 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 3D7DC21C04D;
	Sat, 10 Sep 2011 21:51:16 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	by pigeon.gentoo.org (Postfix) with ESMTP id E1E9621C04D
	for <gentoo-commits@lists.gentoo.org>; Sat, 10 Sep 2011 21:51:15 +0000 (UTC)
Received: from pelican.gentoo.org (unknown [66.219.59.40])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 3A0F31B4001
	for <gentoo-commits@lists.gentoo.org>; Sat, 10 Sep 2011 21:51:15 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by pelican.gentoo.org (Postfix) with ESMTP id 5590F80042
	for <gentoo-commits@lists.gentoo.org>; Sat, 10 Sep 2011 21:51:14 +0000 (UTC)
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" <zmedico@gentoo.org>
Message-ID: <d3789b062ba0214c77823345d582875232b27be9.zmedico@gentoo>
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: d3789b062ba0214c77823345d582875232b27be9
Date: Sat, 10 Sep 2011 21:51:14 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: quoted-printable
X-Archives-Salt: 
X-Archives-Hash: cefeec67c80cc96736241bc3f5a4db49

commit:     d3789b062ba0214c77823345d582875232b27be9
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 10 21:50:57 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Sep 10 21:50:57 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a=
=3Dcommit;h=3Dd3789b06

depgraph: refactor virtual slot --update code

This re-implements the change from commit
21330075f07248765016e104b3ba8216903f1ecb in order to avoid executing
unnessary virtual slot expansion code when the given atom specifies a
slot or --update is enabled.

---
 pym/_emerge/depgraph.py |   54 ++++++++++++++++++++++-------------------=
-----
 1 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 3cb85dc..2c39608 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -6530,32 +6530,34 @@ class _dep_check_composite_db(dbapi):
 		ret =3D self._match_cache.get(atom)
 		if ret is not None:
 			return ret[:]
+
+		ret =3D []
 		pkg, existing =3D self._depgraph._select_package(self._root, atom)
-		if not pkg:
-			ret =3D []
-		else:
-			# Return the highest available from select_package() as well as
-			# any matching slots in the graph db.
+
+		if pkg is not None and self._visible(pkg):
+			self._cpv_pkg_map[pkg.cpv] =3D pkg
+			ret.append(pkg.cpv)
+
+		if pkg is not None and \
+			atom.slot is None and \
+			"--update" not in self._depgraph._frozen_config.myopts and \
+			pkg.cp.startswith("virtual/"):
+			# For new-style virtual lookahead that occurs inside dep_check()
+			# for bug #141118, examine all slots. This is needed so that newer
+			# slots will not unnecessarily be pulled in when a satisfying lower
+			# slot is already installed. For example, if virtual/jdk-1.5 is
+			# satisfied via gcj-jdk then there's no need to pull in a newer
+			# slot to satisfy a virtual/jdk dependency, unless --update is
+			# enabled.
 			slots =3D set()
-			slots.add(pkg.metadata["SLOT"])
-			if pkg.cp.startswith("virtual/"):
-				# For new-style virtual lookahead that occurs inside
-				# dep_check(), examine all slots. This is needed
-				# so that newer slots will not unnecessarily be pulled in
-				# when a satisfying lower slot is already installed. For
-				# example, if virtual/jdk-1.4 is satisfied via kaffe then
-				# there's no need to pull in a newer slot to satisfy a
-				# virtual/jdk dependency.
-				for virt_pkg in self._depgraph._iter_match_pkgs_any(
-					self._depgraph._frozen_config.roots[self._root], atom):
-					if virt_pkg.cp !=3D pkg.cp:
-						continue
-					slots.add(virt_pkg.slot)
-			ret =3D []
-			if self._visible(pkg):
-				self._cpv_pkg_map[pkg.cpv] =3D pkg
-				ret.append(pkg.cpv)
-			slots.remove(pkg.metadata["SLOT"])
+			slots.add(pkg.slot)
+			for virt_pkg in self._depgraph._iter_match_pkgs_any(
+				self._depgraph._frozen_config.roots[self._root], atom):
+				if virt_pkg.cp !=3D pkg.cp:
+					continue
+				slots.add(virt_pkg.slot)
+
+			slots.remove(pkg.slot)
 			while slots:
 				slot_atom =3D atom.with_slot(slots.pop())
 				pkg, existing =3D self._depgraph._select_package(
@@ -6569,10 +6571,6 @@ class _dep_check_composite_db(dbapi):
=20
 			if len(ret) > 1:
 				self._cpv_sort_ascending(ret)
-				if "--update" in self._depgraph._frozen_config.myopts:
-					# With --update, we want to force selection of
-					# the highest available version.
-					ret =3D [ret[-1]]
=20
 		self._match_cache[atom] =3D ret
 		return ret[:]