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 1R7WjQ-0007Y7-HS for garchives@archives.gentoo.org; Sat, 24 Sep 2011 18:13:44 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5A4D821C05B; Sat, 24 Sep 2011 18:13:36 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 17F4A21C05B for ; Sat, 24 Sep 2011 18:13:35 +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 C96CD1B4009 for ; Sat, 24 Sep 2011 18:13:34 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id DEC0C80042 for ; Sat, 24 Sep 2011 18:13: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: <64e7f6e3364cb5eceb9ccc1a1d915fe1f5cb810d.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/dbapi/porttree.py X-VCS-Directories: pym/portage/dbapi/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 64e7f6e3364cb5eceb9ccc1a1d915fe1f5cb810d Date: Sat, 24 Sep 2011 18:13: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: 95d3c4cf49f52826d3d27384b08cb1ba commit: 64e7f6e3364cb5eceb9ccc1a1d915fe1f5cb810d Author: Zac Medico gentoo org> AuthorDate: Sat Sep 24 18:13:14 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Sat Sep 24 18:13:14 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D64e7f6e3 portdbapi: combine gvisible and visible methods There's no need to have separate methods, and this allows us to avoid using separate aux_get calls in each method. --- pym/portage/dbapi/porttree.py | 49 ++++++++++++++++-------------------= ----- 1 files changed, 20 insertions(+), 29 deletions(-) diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.p= y index ac58375..ba0da34 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -875,18 +875,18 @@ class portdbapi(dbapi): elif level =3D=3D "match-visible": # find all visible matches if mydep.repo is not None or len(self.porttrees) =3D=3D 1: - myval =3D self.gvisible(self.visible( + myval =3D self.visible( self.xmatch("match-all", mydep), - mytree=3Dmytree), mytree=3Dmytree) + mytree=3Dmytree) else: myval =3D set() # We iterate over self.porttrees, since it's common to # tweak this attribute in order to adjust match behavior. for tree in self.porttrees: repo =3D self.repositories.get_name_for_location(tree) - myval.update(self.gvisible(self.visible( + myval.update(self.visible( self.xmatch("match-all", mydep.with_repo(repo)), - mytree=3Dtree), mytree=3Dtree)) + mytree=3Dtree)) myval =3D list(myval) if len(myval) > 1: self._cpv_sort_ascending(myval) @@ -1016,32 +1016,18 @@ class portdbapi(dbapi): def match(self, mydep, use_cache=3D1): return self.xmatch("match-visible", mydep) =20 - def visible(self, mylist, mytree=3DNone): - """two functions in one. Accepts a list of cpv values and uses the pa= ckage.mask *and* - packages file to remove invisible entries, returning remaining items. = This function assumes - that all entries in mylist have the same category and package name.""" - if not mylist: - return [] - - db_keys =3D ["repository", "SLOT"] - visible =3D [] - getMaskAtom =3D self.settings._getMaskAtom - for cpv in mylist: - try: - metadata =3D dict(zip(db_keys, - self.aux_get(cpv, db_keys, mytree=3Dmytree))) - except KeyError: - # masked by corruption - continue - if not metadata["SLOT"]: - continue - if getMaskAtom(cpv, metadata): - continue - visible.append(cpv) - return visible - def gvisible(self, mylist, mytree=3DNone): - "strip out group-masked (not in current group) entries" + warnings.warn("The 'gvisible' method of " + "portage.dbapi.porttree.portdbapi " + "is deprecated, and the functionality " + "has been combined into the 'visible' method", + DeprecationWarning, stacklevel=3D2) + return self.visible(mylist, mytree=3Dmytree) + + def visible(self, mylist, mytree=3DNone): + """ + Return a new list containing only visible packages. + """ =20 if mylist is None: return [] @@ -1051,6 +1037,7 @@ class portdbapi(dbapi): local_config =3D self.settings.local_config chost =3D self.settings.get('CHOST', '') accept_chost =3D self.settings._accept_chost + getMaskAtom =3D self.settings._getMaskAtom for mycpv in mylist: metadata.clear() try: @@ -1069,6 +1056,10 @@ class portdbapi(dbapi): continue if _eapi_is_deprecated(eapi): continue + if not metadata["SLOT"]: + continue + if getMaskAtom(mycpv, metadata): + continue if self.settings._getMissingKeywords(mycpv, metadata): continue if local_config: