aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVikraman Choudhury <vikraman.choudhury@gmail.com>2011-04-30 00:32:28 +0530
committerVikraman Choudhury <vikraman.choudhury@gmail.com>2011-04-30 00:32:28 +0530
commitaa900dddfd051452d86c51e48dd6906acd67325e (patch)
treec264b59431ca2cf4742beaacf595a57fe44ecad2
parentfirst commit (diff)
downloadgentoostats-aa900dddfd051452d86c51e48dd6906acd67325e.tar.gz
gentoostats-aa900dddfd051452d86c51e48dd6906acd67325e.tar.bz2
gentoostats-aa900dddfd051452d86c51e48dd6906acd67325e.zip
first version of client to read installed packages
-rw-r--r--.gitignore2
-rw-r--r--README4
-rw-r--r--TODO2
-rw-r--r--client/__init__.py1
-rwxr-xr-xclient/bin/client11
-rw-r--r--client/dbapi.py4
-rw-r--r--client/packages.py12
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/vh4x0r/26001
+Proposal: http://www.google-melange.com/gsoc/proposal/review/google/gsoc2011/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 = 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