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 1Q3ImF-000528-4K for garchives@archives.gentoo.org; Sat, 26 Mar 2011 01:58:55 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DB5AC1C0CA; Sat, 26 Mar 2011 01:58:37 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id AB2781C0C4 for ; Sat, 26 Mar 2011 01:58:37 +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 310C81B41B0 for ; Sat, 26 Mar 2011 01:58:37 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 99B3F8006E for ; Sat, 26 Mar 2011 01:58:36 +0000 (UTC) From: "Nirbheek Chauhan" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Nirbheek Chauhan" Message-ID: Subject: [gentoo-commits] proj/gnome:master commit in: scripts/ X-VCS-Repository: proj/gnome X-VCS-Files: scripts/slot_rindex.py X-VCS-Directories: scripts/ X-VCS-Committer: nirbheek X-VCS-Committer-Name: Nirbheek Chauhan X-VCS-Revision: b243ed092dcdc3658ed75b9e1f0d73e7945e3031 Date: Sat, 26 Mar 2011 01:58:36 +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: 1d37b3517758082e2315bf91cccda79d commit: b243ed092dcdc3658ed75b9e1f0d73e7945e3031 Author: Nirbheek Chauhan gentoo org> AuthorDate: Sat Mar 26 01:40:29 2011 +0000 Commit: Nirbheek Chauhan gentoo org> CommitDate: Sat Mar 26 01:52:13 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gnome.git;a=3D= commit;h=3Db243ed09 slot_rindex.py: use os.environ to toggle PORTAGE_ONLY --- scripts/slot_rindex.py | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/slot_rindex.py b/scripts/slot_rindex.py index 3610813..c77817f 100755 --- a/scripts/slot_rindex.py +++ b/scripts/slot_rindex.py @@ -13,6 +13,7 @@ # =20 import sys +import os import os.path as osp =20 import portage @@ -32,6 +33,8 @@ if len(sys.argv) < 2: =20 KEY =3D sys.argv[1] PORTAGE_ONLY =3D False +if os.environ.has_key('PORTAGE_ONLY'): + PORTAGE_ONLY =3D os.environ['PORTAGE_ONLY'] =20 ######################## ### Output Functions ### @@ -119,27 +122,33 @@ def get_deps_both(cpv, depvars=3DDEPVARS): def get_revdeps_rindex(key): """ Given a key, returns a reverse-dependency list of that key using the= tinderbox rindex + list will be a sorted list of unique cpvs """ import urllib2 RINDEX =3D "http://tinderbox.dev.gentoo.org/misc/rindex" - revdeps =3D [] + revdeps =3D set() rdeps_raw =3D urllib2.urlopen('/'.join([RINDEX, key])).read().split(= ) for i in rdeps_raw: cpv =3D i.split(':')[0] if portage.isvalidatom('=3D'+cpv): - revdeps.append(cpv) + revdeps.add(cpv) + revdeps =3D list(revdeps) + revdeps.sort() return revdeps =20 def get_revdeps_portage(key): """ Given a key, returns a reverse-dependency list of that key using por= tage API + list will be a sorted list of unique cpvs """ - revdeps =3D [] + revdeps =3D set() for cp in portdb.cp_all(): cpvrs =3D portdb.xmatch('match-all', cp) for cpvr in cpvrs: if key in get_deps_both(cpvr)[0]: - revdeps.append(cpvr) + revdeps.add(cpvr) + revdeps =3D list(revdeps) + revdeps.sort() return revdeps =20 ###################