1 |
hwoarang 13/09/29 14:22:30 |
2 |
|
3 |
Modified: gmn_bugzie.py .cvsignore |
4 |
Log: |
5 |
gmn_bugzie.py: Make it work again with latest bugzilla |
6 |
|
7 |
Whitespace fixes |
8 |
|
9 |
Revision Changes Path |
10 |
1.2 src/gwn/gmn_bugzie.py |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/gwn/gmn_bugzie.py?rev=1.2&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/gwn/gmn_bugzie.py?rev=1.2&content-type=text/plain |
14 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo/src/gwn/gmn_bugzie.py?r1=1.1&r2=1.2 |
15 |
|
16 |
Index: gmn_bugzie.py |
17 |
=================================================================== |
18 |
RCS file: /var/cvsroot/gentoo/src/gwn/gmn_bugzie.py,v |
19 |
retrieving revision 1.1 |
20 |
retrieving revision 1.2 |
21 |
diff -u -r1.1 -r1.2 |
22 |
--- gmn_bugzie.py 21 May 2008 00:34:05 -0000 1.1 |
23 |
+++ gmn_bugzie.py 29 Sep 2013 14:22:30 -0000 1.2 |
24 |
@@ -1,6 +1,7 @@ |
25 |
#!/usr/bin/python |
26 |
|
27 |
import httplib, string, time, sys, os |
28 |
+import urllib2 |
29 |
|
30 |
def strip(x): |
31 |
'''Removes quotation marks |
32 |
@@ -10,7 +11,7 @@ |
33 |
x=x[1:] |
34 |
if x[-1]=='\"': |
35 |
x=x[0:-1] |
36 |
- |
37 |
+ |
38 |
return x |
39 |
|
40 |
def get_page(site, uri, header): |
41 |
@@ -18,14 +19,10 @@ |
42 |
and a dictionary of header values, returns the |
43 |
requested resource. Will return an empty string |
44 |
if something goes wrong.''' |
45 |
- conn = httplib.HTTPConnection(site) |
46 |
- conn.request("GET",uri,'',header) |
47 |
- response = conn.getresponse() |
48 |
- if response.status == 200: |
49 |
- page = response.read() |
50 |
- else: |
51 |
- page = "" |
52 |
- return page |
53 |
+ conn = urllib2.Request("https://"+site+uri, None, header) |
54 |
+ response = urllib2.urlopen(conn) |
55 |
+ page = response.read() |
56 |
+ return page |
57 |
|
58 |
def group_results(result, group_by, details): |
59 |
'''Given a column to group by, will accumulate a count |
60 |
@@ -40,11 +37,11 @@ |
61 |
the result more like 'select group_by, count(*), [column for column in details] |
62 |
from bugzilla group by group_by, [column for column in details]'.''' |
63 |
|
64 |
- |
65 |
+ |
66 |
lines = result.split("\n") |
67 |
|
68 |
field_names = string.split(lines[0],',') |
69 |
- |
70 |
+ |
71 |
by_group = {} |
72 |
detailDict = {} |
73 |
for line in lines[1:]: |
74 |
@@ -53,7 +50,7 @@ |
75 |
#capture the first result for each unique group_by |
76 |
if (by_group[b[group_by]] == 1): |
77 |
detailDict[b[group_by]] = b |
78 |
- |
79 |
+ |
80 |
|
81 |
count_by_group = [[bug_count, group] for group, bug_count in by_group.items()] |
82 |
count_by_group.sort() |
83 |
@@ -65,9 +62,9 @@ |
84 |
'''Given a CSV generated from reports.cgi will return a dictionary |
85 |
with the sum for each row. The grand total will also be added |
86 |
to the 'Total' entry.''' |
87 |
- |
88 |
+ |
89 |
lines = result.split("\n") |
90 |
- |
91 |
+ |
92 |
result_dict = {} |
93 |
total = 0 |
94 |
|
95 |
@@ -77,7 +74,7 @@ |
96 |
total += summed |
97 |
result_dict[split_list[0]] = summed |
98 |
result_dict['Total'] = total |
99 |
- |
100 |
+ |
101 |
return result_dict |
102 |
|
103 |
# get dates from command line, else use now (time.time()) |
104 |
@@ -153,11 +150,13 @@ |
105 |
print "Major:%d" % severities.get('"major"',0) |
106 |
|
107 |
cleft = 0 |
108 |
+#8. Closed Bugs |
109 |
for i in range(0,9): |
110 |
print "%s:%d" % (strip(groups_that_closed_most[i][2][0]), groups_that_closed_most[i][1]) |
111 |
cleft += groups_that_closed_most[i][1] |
112 |
print "Others:%d" % (total_closed - cleft) |
113 |
|
114 |
+#9. Open Bugs |
115 |
oleft = 0 |
116 |
for i in range(0,9): |
117 |
print "%s:%d" % (strip(groups_that_opened_most[i][2][0]), groups_that_opened_most[i][1]) |
118 |
|
119 |
|
120 |
|
121 |
1.2 src/gwn/.cvsignore |
122 |
|
123 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/gwn/.cvsignore?rev=1.2&view=markup |
124 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/gwn/.cvsignore?rev=1.2&content-type=text/plain |
125 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo/src/gwn/.cvsignore?r1=1.1&r2=1.2 |
126 |
|
127 |
Index: .cvsignore |
128 |
=================================================================== |
129 |
RCS file: /var/cvsroot/gentoo/src/gwn/.cvsignore,v |
130 |
retrieving revision 1.1 |
131 |
retrieving revision 1.2 |
132 |
diff -u -r1.1 -r1.2 |
133 |
--- .cvsignore 29 Sep 2013 14:06:09 -0000 1.1 |
134 |
+++ .cvsignore 29 Sep 2013 14:22:30 -0000 1.2 |
135 |
@@ -1 +1,2 @@ |
136 |
devaway.txt |
137 |
+breport |