[Popcon-commits] cvs commit to popularity-contest by pere

popcon-commits@lists.alioth.debian.org popcon-commits@lists.alioth.debian.org
Sun, 14 Sep 2003 14:25:01 +0200


Update of /cvsroot/popcon/popularity-contest
In directory quantz:/tmp/cvs-serv25987

Modified Files:
	popanal.py 
Log Message:
Updated popanal.py to process the new arch info, and store resulting
summary in results.host_arch and results.host_gnu_type.


Index: popanal.py
===================================================================
RCS file: /cvsroot/popcon/popularity-contest/popanal.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- popanal.py	7 Sep 2003 17:27:27 -0000	1.1.1.1
+++ popanal.py	14 Sep 2003 12:24:59 -0000	1.2
@@ -34,6 +34,8 @@
 deplist = {}
 provlist = {}
 complained = {}
+host_arch_list = {}
+host_gnu_type_list = {}
 
 
 def parse_depends(depline):
@@ -106,6 +108,9 @@
 
     start_date = 0
 
+    host_arch = None
+    host_gnu_type = None
+
     # initialize a new entry with known data
     def __init__(self, version, owner_id, date):
 	self.entries = {}
@@ -150,6 +155,15 @@
 		sectlist[UNKNOWN].append(package)
 	    votelist[package].vote_for(package, self.entries[package])
 
+        if not host_arch_list.has_key(self.host_arch):
+            host_arch_list[self.host_arch] = 1
+        else:
+            host_arch_list[self.host_arch] = host_arch_list[self.host_arch] + 1
+
+        if not host_gnu_type_list.has_key(self.host_gnu_type):
+            host_gnu_type_list[self.host_gnu_type] = 1
+        else:
+            host_gnu_type_list[self.host_gnu_type] = host_gnu_type_list[self.host_gnu_type] + 1
 
 def headersplit(pairs):
     header = {}
@@ -183,6 +197,12 @@
 	    subcount = subcount + 1
 	    ewrite('#%s' % subcount)
 	    e = Submission(0, header['ID'], header['TIME'])
+
+            if header.has_key('DEB_HOST_ARCH'):
+                e.host_arch = header['DEB_HOST_ARCH']
+
+            if header.has_key('DEB_HOST_GNU_TYPE'):
+                e.host_gnu_type = header['DEB_HOST_GNU_TYPE']
 	    
 	elif split[0]=='END-POPULARITY-CONTEST-0' and e != None:
 	    header = headersplit(split[1:])
@@ -224,3 +244,13 @@
 	out.write("%-30s %5d %5d %5d %5d\n"
 		  % (package, fv.yes, fv.old_unused,
 		     fv.too_recent, fv.empty_package))
+
+    out = open('results.host_arch', 'w')
+    for host_arch in host_arch_list.keys():
+        out.write("%-30s %5d\n"
+                  % (host_arch, host_arch_list[host_arch]))
+
+    out = open('results.host_gnu_type', 'w')
+    for host_gnu_type in host_gnu_type_list.keys():
+        out.write("%-30s %5d\n"
+                  % (host_gnu_type, host_gnu_type_list[host_gnu_type]))