* [gentoo-commits] proj/gentoostats:master commit in: client/bin/, /, client/
@ 2011-04-30 13:13 Vikraman Choudhury
0 siblings, 0 replies; 2+ messages in thread
From: Vikraman Choudhury @ 2011-04-30 13:13 UTC (permalink / raw
To: gentoo-commits
commit: 265522ead46dc6c4365aa0237ffb78cf21e7a421
Author: Vikraman Choudhury <vikraman.choudhury <AT> gmail <DOT> com>
AuthorDate: Sat Apr 30 13:11:26 2011 +0000
Commit: Vikraman Choudhury <vikraman.choudhury <AT> gmail <DOT> com>
CommitDate: Sat Apr 30 13:11:26 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoostats.git;a=commit;h=265522ea
read portage variables
---
TODO | 3 +--
client/bin/client | 7 +++++++
client/environment.py | 19 +++++++++++++++++++
3 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/TODO b/TODO
index 3e45289..e0110d1 100644
--- a/TODO
+++ b/TODO
@@ -1,2 +1 @@
-* Add use flags to client
-* Add env vars to client
+* Remove dependency on gentoolkit
diff --git a/client/bin/client b/client/bin/client
index 0720466..26edcb4 100755
--- a/client/bin/client
+++ b/client/bin/client
@@ -2,6 +2,7 @@
from packages import Packages
from useflags import UseFlags
+from environment import Environment
def main ():
p = Packages ()
@@ -11,6 +12,12 @@ def main ():
for x in u.getUseFlags (cpv):
print x,
print
+ e = Environment ()
+ print e.getVar ('CFLAGS')
+ print e.getVar ('CXXFLAGS')
+ print e.getVar ('LDFLAGS')
+ print e.getVar ('CHOST')
+ print e.getVar ('FEATURES')
if __name__ == "__main__":
main ()
diff --git a/client/environment.py b/client/environment.py
new file mode 100644
index 0000000..5300bef
--- /dev/null
+++ b/client/environment.py
@@ -0,0 +1,19 @@
+
+import logging
+from subprocess import *
+
+class Environment:
+
+ def __init__ (self):
+ try:
+ p = Popen (['emerge', '--info'], stdout=PIPE)
+ self.out = p.stdout.readlines ()
+ except OSError, e:
+ fatal ('Cannot run emerge --info')
+ raise e
+
+ def getVar (self, myvar):
+ for line in self.out:
+ if line.startswith (myvar):
+ return line.strip ()
+ return ''
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] proj/gentoostats:master commit in: client/bin/, /, client/
@ 2011-04-29 19:03 Vikraman Choudhury
0 siblings, 0 replies; 2+ messages in thread
From: Vikraman Choudhury @ 2011-04-29 19:03 UTC (permalink / raw
To: gentoo-commits
commit: aa900dddfd051452d86c51e48dd6906acd67325e
Author: Vikraman Choudhury <vikraman.choudhury <AT> gmail <DOT> com>
AuthorDate: Fri Apr 29 19:02:28 2011 +0000
Commit: Vikraman Choudhury <vikraman.choudhury <AT> gmail <DOT> com>
CommitDate: Fri Apr 29 19:02:28 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoostats.git;a=commit;h=aa900ddd
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/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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-30 13:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-30 13:13 [gentoo-commits] proj/gentoostats:master commit in: client/bin/, /, client/ Vikraman Choudhury
-- strict thread matches above, loose matches on Subject: below --
2011-04-29 19:03 Vikraman Choudhury
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox