diff options
author | Vikraman Choudhury <vikraman.choudhury@gmail.com> | 2011-04-30 00:32:28 +0530 |
---|---|---|
committer | Vikraman Choudhury <vikraman.choudhury@gmail.com> | 2011-04-30 00:32:28 +0530 |
commit | aa900dddfd051452d86c51e48dd6906acd67325e (patch) | |
tree | c264b59431ca2cf4742beaacf595a57fe44ecad2 | |
parent | first commit (diff) | |
download | gentoostats-aa900dddfd051452d86c51e48dd6906acd67325e.tar.gz gentoostats-aa900dddfd051452d86c51e48dd6906acd67325e.tar.bz2 gentoostats-aa900dddfd051452d86c51e48dd6906acd67325e.zip |
first version of client to read installed packages
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | client/__init__.py | 1 | ||||
-rwxr-xr-x | client/bin/client | 11 | ||||
-rw-r--r-- | client/dbapi.py | 4 | ||||
-rw-r--r-- | 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 @@ -0,0 +1,4 @@ +Repository for GSoC 2011 project on package statistics for Gentoo + +Project: http://www.google-melange.com/gsoc/project/google/gsoc2011/vh4x0r/26001 +Proposal: http://www.google-melange.com/gsoc/proposal/review/google/gsoc2011/vh4x0r/1 @@ -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 = Packages () + for cp in p.getInstalledCPs (): + print cp + +if __name__ == "__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 = portage.db[portage.root]["porttree"].dbapi +VARDB = 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 = sorted (VARDB.cp_all ()) + return installed_cps + + def getInstalledCPVs (self): + installed_cpvs = sorted (VARDB.cpv_all ()) + return installed_cpvs |