Gentoo Archives: gentoo-commits

From: Vikraman Choudhury <vikraman.choudhury@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gentoostats:master commit in: server/, server/templates/
Date: Sun, 03 Jul 2011 19:20:23
Message-Id: f5f0837b3bb3a7bdbf3adde70a6defcb3819c602.vikraman@gentoo
1 commit: f5f0837b3bb3a7bdbf3adde70a6defcb3819c602
2 Author: Vikraman Choudhury <vikraman.choudhury <AT> gmail <DOT> com>
3 AuthorDate: Sun Jul 3 18:03:33 2011 +0000
4 Commit: Vikraman Choudhury <vikraman.choudhury <AT> gmail <DOT> com>
5 CommitDate: Sun Jul 3 18:03:33 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoostats.git;a=commit;h=f5f0837b
7
8 more stats pages
9
10 ---
11 server/app.py | 16 ++++++++++++++++
12 server/arch.py | 10 ++++++++++
13 server/feature.py | 10 ++++++++++
14 server/kwd.py | 10 ++++++++++
15 server/lang.py | 10 ++++++++++
16 server/mirror.py | 10 ++++++++++
17 server/profile.py | 10 ++++++++++
18 server/repo.py | 10 ++++++++++
19 server/templates/arch.html | 11 +++++++++++
20 server/templates/feature.html | 11 +++++++++++
21 server/templates/keyword.html | 12 ++++++++++++
22 server/templates/lang.html | 11 +++++++++++
23 server/templates/mirror.html | 11 +++++++++++
24 server/templates/profile.html | 11 +++++++++++
25 server/templates/repo.html | 12 ++++++++++++
26 server/templates/use.html | 11 +++++++++++
27 server/use.py | 10 ++++++++++
28 17 files changed, 186 insertions(+), 0 deletions(-)
29
30 diff --git a/server/app.py b/server/app.py
31 index 89ade62..ba77639 100755
32 --- a/server/app.py
33 +++ b/server/app.py
34 @@ -4,10 +4,26 @@ import web
35 import config
36 from config import render
37 from index import Index
38 +from arch import Arch
39 +from profile import Profile
40 +from mirror import Mirror
41 +from feature import Feature
42 +from kwd import Keyword
43 +from use import Use
44 +from repo import Repo
45 +from lang import Lang
46 from host import Host
47
48 urls = (
49 r'/', 'Index',
50 + r'/arch', 'Arch',
51 + r'/profile', 'Profile',
52 + r'/mirror', 'Mirror',
53 + r'/feature', 'Feature',
54 + r'/keyword', 'Keyword',
55 + r'/use', 'Use',
56 + r'/repo', 'Repo',
57 + r'/lang', 'Lang',
58 r'/host/(.+)', 'Host'
59 )
60
61
62 diff --git a/server/arch.py b/server/arch.py
63 new file mode 100644
64 index 0000000..a389b8f
65 --- /dev/null
66 +++ b/server/arch.py
67 @@ -0,0 +1,10 @@
68 +
69 +from config import render, db
70 +
71 +class Arch(object):
72 + def GET(self):
73 + arch_count = db.select('ENV', what='ARCH, COUNT(UUID) AS HOSTS', group='ARCH')
74 + arch_data = dict()
75 + for t in arch_count:
76 + arch_data[t['ARCH']] = {'HOSTS':t['HOSTS']}
77 + return render.arch(arch_data)
78
79 diff --git a/server/feature.py b/server/feature.py
80 new file mode 100644
81 index 0000000..4b79da5
82 --- /dev/null
83 +++ b/server/feature.py
84 @@ -0,0 +1,10 @@
85 +
86 +from config import render, db
87 +
88 +class Feature(object):
89 + def GET(self):
90 + feature_count = db.query('SELECT FEATURE,COUNT(UUID) AS HOSTS FROM HOST_FEATURES NATURAL JOIN FEATURES GROUP BY FEATURE')
91 + feature_data = dict()
92 + for t in feature_count:
93 + feature_data[t['FEATURE']] = {'HOSTS':t['HOSTS']}
94 + return render.feature(feature_data)
95
96 diff --git a/server/kwd.py b/server/kwd.py
97 new file mode 100644
98 index 0000000..88fc799
99 --- /dev/null
100 +++ b/server/kwd.py
101 @@ -0,0 +1,10 @@
102 +
103 +from config import render, db
104 +
105 +class Keyword(object):
106 + def GET(self):
107 + keyword_count = db.query('SELECT KEYWORD, COUNT(DISTINCT IPKEY) AS PACKAGES, COUNT(DISTINCT UUID) AS HOSTS FROM GLOBAL_KEYWORDS NATURAL JOIN KEYWORDS NATURAL JOIN INSTALLED_PACKAGES GROUP BY KEYWORD')
108 + keyword_data = dict()
109 + for t in keyword_count:
110 + keyword_data[t['KEYWORD']] = {'HOSTS':t['HOSTS'],'PACKAGES':t['PACKAGES']}
111 + return render.keyword(keyword_data)
112
113 diff --git a/server/lang.py b/server/lang.py
114 new file mode 100644
115 index 0000000..3f4ebfb
116 --- /dev/null
117 +++ b/server/lang.py
118 @@ -0,0 +1,10 @@
119 +
120 +from config import render, db
121 +
122 +class Lang(object):
123 + def GET(self):
124 + lang_count = db.query('SELECT LANG,COUNT(UUID) AS HOSTS FROM HOST_LANG NATURAL JOIN LANG GROUP BY LANG')
125 + lang_data = dict()
126 + for t in lang_count:
127 + lang_data[t['LANG']] = {'HOSTS':t['HOSTS']}
128 + return render.lang(lang_data)
129
130 diff --git a/server/mirror.py b/server/mirror.py
131 new file mode 100644
132 index 0000000..7084831
133 --- /dev/null
134 +++ b/server/mirror.py
135 @@ -0,0 +1,10 @@
136 +
137 +from config import render, db
138 +
139 +class Mirror(object):
140 + def GET(self):
141 + mirror_count = db.query('SELECT MIRROR,COUNT(UUID) AS HOSTS FROM HOST_MIRRORS NATURAL JOIN GENTOO_MIRRORS GROUP BY MIRROR')
142 + mirror_data = dict()
143 + for t in mirror_count:
144 + mirror_data[t['MIRROR']] = {'HOSTS':t['HOSTS']}
145 + return render.mirror(mirror_data)
146
147 diff --git a/server/profile.py b/server/profile.py
148 new file mode 100644
149 index 0000000..211963c
150 --- /dev/null
151 +++ b/server/profile.py
152 @@ -0,0 +1,10 @@
153 +
154 +from config import render, db
155 +
156 +class Profile(object):
157 + def GET(self):
158 + profile_count = db.select('ENV', what='PROFILE, COUNT(UUID) AS HOSTS', group='PROFILE')
159 + profile_data = dict()
160 + for t in profile_count:
161 + profile_data[t['PROFILE']] = {'HOSTS':t['HOSTS']}
162 + return render.profile(profile_data)
163
164 diff --git a/server/repo.py b/server/repo.py
165 new file mode 100644
166 index 0000000..4348248
167 --- /dev/null
168 +++ b/server/repo.py
169 @@ -0,0 +1,10 @@
170 +
171 +from config import render, db
172 +
173 +class Repo(object):
174 + def GET(self):
175 + repo_count = db.query('select REPO,COUNT(DISTINCT IPKEY) AS PACKAGES,COUNT(DISTINCT UUID) AS HOSTS from INSTALLED_PACKAGES natural join REPOSITORIES group by REPO')
176 + repo_data = dict()
177 + for t in repo_count:
178 + repo_data[t['REPO']] = {'HOSTS':t['HOSTS'], 'PACKAGES':t['PACKAGES']}
179 + return render.repo(repo_data)
180
181 diff --git a/server/templates/arch.html b/server/templates/arch.html
182 new file mode 100644
183 index 0000000..535399c
184 --- /dev/null
185 +++ b/server/templates/arch.html
186 @@ -0,0 +1,11 @@
187 +$def with (arch_data)
188 +$var title: Arch
189 +
190 +<table border="1">
191 + <tr>
192 + <th>Arch</th>
193 + <th>Hosts</th>
194 + </tr>
195 + $for arch in arch_data.keys():
196 + <tr><td>$arch</td><td>$arch_data[arch]['HOSTS']</td></tr>
197 +</table>
198
199 diff --git a/server/templates/feature.html b/server/templates/feature.html
200 new file mode 100644
201 index 0000000..03c4bbd
202 --- /dev/null
203 +++ b/server/templates/feature.html
204 @@ -0,0 +1,11 @@
205 +$def with (feature_data)
206 +$var title: Feature
207 +
208 +<table border="1">
209 + <tr>
210 + <th>Feature</th>
211 + <th>Hosts</th>
212 + </tr>
213 + $for feature in feature_data.keys():
214 + <tr><td>$feature</td><td>$feature_data[feature]['HOSTS']</td></tr>
215 +</table>
216
217 diff --git a/server/templates/keyword.html b/server/templates/keyword.html
218 new file mode 100644
219 index 0000000..4855040
220 --- /dev/null
221 +++ b/server/templates/keyword.html
222 @@ -0,0 +1,12 @@
223 +$def with (keyword_data)
224 +$var title: Keyword
225 +
226 +<table border="1">
227 + <tr>
228 + <th>Keyword</th>
229 + <th>Hosts</th>
230 + <th>Packages</th>
231 + </tr>
232 + $for keyword in keyword_data.keys():
233 + <tr><td>$keyword</td><td>$keyword_data[keyword]['HOSTS']</td><td>$keyword_data[keyword]['PACKAGES']</td></tr>
234 +</table>
235
236 diff --git a/server/templates/lang.html b/server/templates/lang.html
237 new file mode 100644
238 index 0000000..cfda84a
239 --- /dev/null
240 +++ b/server/templates/lang.html
241 @@ -0,0 +1,11 @@
242 +$def with (lang_data)
243 +$var title: Lang
244 +
245 +<table border="1">
246 + <tr>
247 + <th>Lang</th>
248 + <th>Hosts</th>
249 + </tr>
250 + $for lang in lang_data.keys():
251 + <tr><td>$lang</td><td>$lang_data[lang]['HOSTS']</td></tr>
252 +</table>
253
254 diff --git a/server/templates/mirror.html b/server/templates/mirror.html
255 new file mode 100644
256 index 0000000..a6189bc
257 --- /dev/null
258 +++ b/server/templates/mirror.html
259 @@ -0,0 +1,11 @@
260 +$def with (mirror_data)
261 +$var title: Mirror
262 +
263 +<table border="1">
264 + <tr>
265 + <th>Mirror</th>
266 + <th>Hosts</th>
267 + </tr>
268 + $for mirror in mirror_data.keys():
269 + <tr><td>$mirror</td><td>$mirror_data[mirror]['HOSTS']</td></tr>
270 +</table>
271
272 diff --git a/server/templates/profile.html b/server/templates/profile.html
273 new file mode 100644
274 index 0000000..702b03b
275 --- /dev/null
276 +++ b/server/templates/profile.html
277 @@ -0,0 +1,11 @@
278 +$def with (profile_data)
279 +$var title: Profile
280 +
281 +<table border="1">
282 + <tr>
283 + <th>Profile/th>
284 + <th>Hosts</th>
285 + </tr>
286 + $for profile in profile_data.keys():
287 + <tr><td>$profile</td><td>$profile_data[profile]['HOSTS']</td></tr>
288 +</table>
289
290 diff --git a/server/templates/repo.html b/server/templates/repo.html
291 new file mode 100644
292 index 0000000..63371bb
293 --- /dev/null
294 +++ b/server/templates/repo.html
295 @@ -0,0 +1,12 @@
296 +$def with (repo_data)
297 +$var title: Repository
298 +
299 +<table border="1">
300 + <tr>
301 + <th>Repository</th>
302 + <th>Hosts</th>
303 + <th>Packages</th>
304 + </tr>
305 + $for repo in repo_data.keys():
306 + <tr><td>$repo</td><td>$repo_data[repo]['HOSTS']</td><td>$repo_data[repo]['PACKAGES']</td></tr>
307 +</table>
308
309 diff --git a/server/templates/use.html b/server/templates/use.html
310 new file mode 100644
311 index 0000000..209f8f8
312 --- /dev/null
313 +++ b/server/templates/use.html
314 @@ -0,0 +1,11 @@
315 +$def with (use_data)
316 +$var title: Use
317 +
318 +<table border="1">
319 + <tr>
320 + <th>Use</th>
321 + <th>Hosts</th>
322 + </tr>
323 + $for use in use_data.keys():
324 + <tr><td>$use</td><td>$use_data[use]['HOSTS']</td></tr>
325 +</table>
326
327 diff --git a/server/use.py b/server/use.py
328 new file mode 100644
329 index 0000000..dfdcfaf
330 --- /dev/null
331 +++ b/server/use.py
332 @@ -0,0 +1,10 @@
333 +
334 +from config import render, db
335 +
336 +class Use(object):
337 + def GET(self):
338 + use_count = db.query('SELECT USEFLAG,COUNT(UUID) AS HOSTS FROM GLOBAL_USEFLAGS NATURAL JOIN USEFLAGS GROUP BY USEFLAG')
339 + use_data = dict()
340 + for t in use_count:
341 + use_data[t['USEFLAG']] = {'HOSTS':t['HOSTS']}
342 + return render.use(use_data)