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 1QZ4pF-0002aQ-TQ for garchives@archives.gentoo.org; Tue, 21 Jun 2011 17:33:22 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BA1F01C00C; Tue, 21 Jun 2011 17:33:14 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 861E01C00C for ; Tue, 21 Jun 2011 17:33:14 +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 1B2A22AC01F for ; Tue, 21 Jun 2011 17:33:14 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 608B48003C for ; Tue, 21 Jun 2011 17:33:13 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: Subject: [gentoo-commits] proj/qa-scripts:master commit in: / X-VCS-Repository: proj/qa-scripts X-VCS-Files: packages-inheriting-eclasses.py X-VCS-Directories: / X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: d685925b2aec1969e159becadc946298dd47850d Date: Tue, 21 Jun 2011 17:33:13 +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: e3bfe5d943d8cbfefdf059c4e177edbe commit: d685925b2aec1969e159becadc946298dd47850d Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Tue Jun 21 17:31:42 2011 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Tue Jun 21 17:33:48 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/qa-scripts.gi= t;a=3Dcommit;h=3Dd685925b Add a script to list packages which use a particular eclass. --- packages-inheriting-eclasses.py | 56 +++++++++++++++++++++++++++++++++= ++++++ 1 files changed, 56 insertions(+), 0 deletions(-) diff --git a/packages-inheriting-eclasses.py b/packages-inheriting-eclass= es.py new file mode 100755 index 0000000..900426b --- /dev/null +++ b/packages-inheriting-eclasses.py @@ -0,0 +1,56 @@ +#!/usr/bin/python + +import collections, os, os.path, sys +import pkgcore.config # tested with pkgcore-0.6.4 + +def main(argv): + try: + outputdir =3D argv[1] + except IndexError: + print('Usage: %s output-directory/' % argv[0]) + return 1 + + c =3D pkgcore.config.load_config() + portdir =3D c.repo['portdir'] + + output =3D collections.defaultdict(set) + + for p in portdir: + for eclass in p.data['_eclasses_']: + output[eclass].add('%s/%s\n' % (p.category, p.PN)) + + try: + os.mkdir(outputdir) + except OSError: + pass # XXX: removing old eclasses? + + os.chdir(outputdir) + for eclass in output: + f =3D open('%s.txt' % eclass, 'w') + f.writelines(sorted(output[eclass])) + f.close() + + f =3D open('index.html', 'w') + f.write(''' + + + + Packages inheriting eclasses + + +

Packages inheriting eclasses

+ + + +''' % (max([len(e) for e in output]), '\n'.join(['
  • %s.eclass (%d packages),
  • ' % (e, e, len(output[e])) for e= in sorted(output)]))) + f.close() + + return 0 + +if __name__ =3D=3D '__main__': + sys.exit(main(sys.argv))