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 1QFsyN-0002mz-4F for garchives@archives.gentoo.org; Fri, 29 Apr 2011 19:03:27 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 480B31C0B7; Fri, 29 Apr 2011 19:03:19 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 09D491C0B4 for ; Fri, 29 Apr 2011 19:03:18 +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 2FCDD1B4020 for ; Fri, 29 Apr 2011 19:03:18 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 3DF2680504 for ; Fri, 29 Apr 2011 19:03:17 +0000 (UTC) From: "Vikraman Choudhury" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Vikraman Choudhury" Message-ID: Subject: [gentoo-commits] proj/gentoostats:master commit in: client/bin/, /, client/ X-VCS-Repository: proj/gentoostats X-VCS-Files: .gitignore README TODO client/__init__.py client/bin/client client/dbapi.py client/packages.py X-VCS-Directories: client/bin/ / client/ X-VCS-Committer: vikraman X-VCS-Committer-Name: Vikraman Choudhury X-VCS-Revision: aa900dddfd051452d86c51e48dd6906acd67325e Date: Fri, 29 Apr 2011 19:03:17 +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: 477fbfae2ea7d83d8efce8464f9cc161 commit: aa900dddfd051452d86c51e48dd6906acd67325e Author: Vikraman Choudhury gmail com> AuthorDate: Fri Apr 29 19:02:28 2011 +0000 Commit: Vikraman Choudhury gmail com> CommitDate: Fri Apr 29 19:02:28 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gentoostats.g= it;a=3Dcommit;h=3Daa900ddd first version of client to read installed packages --- .gitignore | 2 ++ README | 4 ++++ TODO | 2 ++ client/__init__.py | 1 + client/bin/client | 11 +++++++++++ client/dbapi.py | 4 ++++ client/packages.py | 12 ++++++++++++ 7 files changed, 36 insertions(+), 0 deletions(-) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..551cb32 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.*~ +*.pyc diff --git a/README b/README index e69de29..ec04ca0 100644 --- a/README +++ b/README @@ -0,0 +1,4 @@ +Repository for GSoC 2011 project on package statistics for Gentoo + +Project: http://www.google-melange.com/gsoc/project/google/gsoc2011/vh4x= 0r/26001 +Proposal: http://www.google-melange.com/gsoc/proposal/review/google/gsoc= 2011/vh4x0r/1 diff --git a/TODO b/TODO new file mode 100644 index 0000000..3e45289 --- /dev/null +++ b/TODO @@ -0,0 +1,2 @@ +* Add use flags to client +* Add env vars to client diff --git a/client/__init__.py b/client/__init__.py new file mode 100644 index 0000000..3c6cfa2 --- /dev/null +++ b/client/__init__.py @@ -0,0 +1 @@ +# Make this a python package diff --git a/client/bin/client b/client/bin/client new file mode 100755 index 0000000..bdc16c7 --- /dev/null +++ b/client/bin/client @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +from packages import Packages + +def main (): + p =3D Packages () + for cp in p.getInstalledCPs (): + print cp + +if __name__ =3D=3D "__main__": + main () diff --git a/client/dbapi.py b/client/dbapi.py new file mode 100644 index 0000000..d5d65fa --- /dev/null +++ b/client/dbapi.py @@ -0,0 +1,4 @@ +import portage + +PORTDB =3D portage.db[portage.root]["porttree"].dbapi +VARDB =3D portage.db[portage.root]["vartree"].dbapi diff --git a/client/packages.py b/client/packages.py new file mode 100644 index 0000000..5d41061 --- /dev/null +++ b/client/packages.py @@ -0,0 +1,12 @@ + +import logging +from dbapi import VARDB + +class Packages: + def getInstalledCPs (self): + installed_cps =3D sorted (VARDB.cp_all ()) + return installed_cps + + def getInstalledCPVs (self): + installed_cpvs =3D sorted (VARDB.cpv_all ()) + return installed_cpvs