-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpackager-stats
executable file
·115 lines (93 loc) · 3.91 KB
/
packager-stats
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 TUBITAK/UEKAE
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# Please read the COPYING file.
import sys
import bz2
import piksemel
tubitak_devel = {}
non_tubitak_devel = {}
packagestats = {"tubitak_maintained" : 0,
"nontubitak_maintained" : 0,
}
# TUBITAK employees who are maintainers of at least one package
TUBITAK = [
"H. İbrahim Güngör",
"Gökhan Özbulak",
"Serdar Dalgıç",
"Ozan Çağlayan",
"Fatih Aşıcı",
"Fatih Arslan",
"Bertan Gündoğdu",
"Renan Çakırerk",
"Metin Akdere",
"Gökmen Göksel",
"Mehmet Özdemir",
"Beyza Ermis",
"Çağlar Kilimci",
"Eren Türkay",
"Ekin Meroğlu",
"Koray Löker",
"Mehmet Emre Atasever",
"Mete Bilgin",
"Semen Cirit",
"Akın Ömeroğlu",
"Kaan Özdinçer",
"Pamir Talazan",
]
def parseRepoIndex(index):
if index.endswith("bz2"):
doc = piksemel.parseString(bz2.decompress(file(index).read()))
else:
doc = piksemel.parse(index)
for spec in doc.tags("SpecFile"):
pkgr = spec.getTag("Source").getTag("Packager")
name = pkgr.getTagData("Name")
email = pkgr.getTagData("Email")
curdict = None
if name not in TUBITAK:
curdict = non_tubitak_devel
packagestats["nontubitak_maintained"] += 1
else:
curdict = tubitak_devel
packagestats["tubitak_maintained"] += 1
if curdict.has_key(name):
curdict[name] += 1
else:
curdict[name] = 1
if len(sys.argv) < 2:
print "Usage: packagerStats <sourceRepoIndexFile> <sourceRepoIndexFile> ..."
sys.exit(1)
for i in range(1,len(sys.argv)):
parseRepoIndex(sys.argv[i])
from operator import itemgetter
tubitak_sortedlist = sorted(tubitak_devel.iteritems(), key=itemgetter(1), reverse=True)
nontubitak_sortedlist = sorted(non_tubitak_devel.iteritems(), key=itemgetter(1), reverse=True)
print "TUBITAK developers"
print "------------------"
for devel in tubitak_sortedlist:
print devel[0] + " - " + str(devel[1])
print
print "Non-TUBITAK developers"
print "----------------------"
for devel in nontubitak_sortedlist:
print devel[0] + " - " + str(devel[1])
print
total_maintained = packagestats["tubitak_maintained"] + packagestats["nontubitak_maintained"]
print "Total source pisi packages in given Pardus repositories are %d.\n" % total_maintained
print "%4d (%.0f%%) are maintained by non-TUBITAK developers." % (packagestats["nontubitak_maintained"], 100.0*packagestats["nontubitak_maintained"]/total_maintained)
print "%4d (%.0f%%) are maintained by TUBITAK developers.\n" % (packagestats["tubitak_maintained"], 100.0*packagestats["tubitak_maintained"]/total_maintained)
print "The total number of non-TUBITAK maintainers is %d." % len(non_tubitak_devel)
print "The total number of TUBITAK maintainers is %d.\n" % len(tubitak_devel)
total_developers = len(tubitak_devel) + len(non_tubitak_devel)
print "%d / %d = %0.1f packages per non-TUBITAK maintainer." % (packagestats["nontubitak_maintained"], len(non_tubitak_devel), float(packagestats["nontubitak_maintained"]) / float(len(non_tubitak_devel)))
print "%d / %d = %0.1f packages per TUBITAK maintainer." % (packagestats["tubitak_maintained"], len(tubitak_devel), float(packagestats["tubitak_maintained"]) / float(len(tubitak_devel)))
print
print "%d / %d = %0.1f packages per maintainer.\n" % (total_maintained, total_developers, float(total_maintained)/float(total_developers))