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 1QH5sp-0005Zp-4p for garchives@archives.gentoo.org; Tue, 03 May 2011 03:02:43 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3821C1C033; Tue, 3 May 2011 03:02:35 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id EBEA71C033 for ; Tue, 3 May 2011 03:02:34 +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 620E71B404C for ; Tue, 3 May 2011 03:02:34 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id AB21C80504 for ; Tue, 3 May 2011 03:02:33 +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: <7edab967a1660094eb3f55fd13679d0939384f27.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/dbapi/cpv_expand.py X-VCS-Directories: pym/portage/dbapi/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 7edab967a1660094eb3f55fd13679d0939384f27 Date: Tue, 3 May 2011 03:02:33 +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: 67770c9b1f62d38f4925ca5a44d6c490 commit: 7edab967a1660094eb3f55fd13679d0939384f27 Author: Zac Medico gentoo org> AuthorDate: Tue May 3 03:00:54 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Tue May 3 03:01:48 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D7edab967 cpv_expand: avoid old-style virtual code This allows portageq calls to avoid loading vdb_metadata.pickle in most cases, which greatly improves performance. --- pym/portage/dbapi/cpv_expand.py | 24 ++++++++++-------------- 1 files changed, 10 insertions(+), 14 deletions(-) diff --git a/pym/portage/dbapi/cpv_expand.py b/pym/portage/dbapi/cpv_expa= nd.py index c42e427..9ce0d3d 100644 --- a/pym/portage/dbapi/cpv_expand.py +++ b/pym/portage/dbapi/cpv_expand.py @@ -17,8 +17,6 @@ def cpv_expand(mycpv, mydb=3DNone, use_cache=3D1, setti= ngs=3DNone): mysplit =3D _pkgsplit(myslash[-1]) if settings is None: settings =3D globals()["settings"] - virts =3D settings.getvirtuals() - virts_p =3D settings.get_virts_p() if len(myslash)>2: # this is illegal case. mysplit=3D[] @@ -28,24 +26,21 @@ def cpv_expand(mycpv, mydb=3DNone, use_cache=3D1, set= tings=3DNone): mykey=3Dmyslash[0]+"/"+mysplit[0] else: mykey=3Dmycpv - if mydb and virts and mykey in virts: - writemsg("mydb.__class__: %s\n" % (mydb.__class__), 1) - if hasattr(mydb, "cp_list"): - if not mydb.cp_list(mykey, use_cache=3Duse_cache): - writemsg("virts[%s]: %s\n" % (str(mykey),virts[mykey]), 1) - mykey_orig =3D mykey[:] - for vkey in virts[mykey]: + if hasattr(mydb, "cp_list") and \ + not mydb.cp_list(mykey, use_cache=3Duse_cache): + virts =3D settings.getvirtuals().get(mykey) + if virts: + mykey_orig =3D mykey + for vkey in virts: # The virtuals file can contain a versioned atom, so # it may be necessary to remove the operator and # version from the atom before it is passed into # dbapi.cp_list(). if mydb.cp_list(vkey.cp): mykey =3D str(vkey) - writemsg(_("virts chosen: %s\n") % (mykey), 1) break if mykey =3D=3D mykey_orig: - mykey =3D str(virts[mykey][0]) - writemsg(_("virts defaulted: %s\n") % (mykey), 1) + mykey =3D str(virts[0]) #we only perform virtual expansion if we are passed a dbapi else: #specific cpv, no category, ie. "foo-1.0" @@ -81,8 +76,9 @@ def cpv_expand(mycpv, mydb=3DNone, use_cache=3D1, setti= ngs=3DNone): mykey=3Dmatches[0] =20 if not mykey and not isinstance(mydb, list): - if myp in virts_p: - mykey=3Dvirts_p[myp][0] + virts_p =3D settings.get_virts_p().get(myp) + if virts_p: + mykey =3D virts_p[0] #again, we only perform virtual expansion if we have a dbapi (not a l= ist) if not mykey: mykey=3D"null/"+myp