paket sayıları, kaynak siteler, komponentler, hata raporlama.
This commit is contained in:
+46
-4
@@ -14,6 +14,7 @@ import os
|
|||||||
|
|
||||||
sys.path.append('.')
|
sys.path.append('.')
|
||||||
import pisi.specfile
|
import pisi.specfile
|
||||||
|
import pisi.purl
|
||||||
|
|
||||||
class Histogram:
|
class Histogram:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -52,27 +53,66 @@ def scan_pspec(folder):
|
|||||||
dirs.remove(".svn")
|
dirs.remove(".svn")
|
||||||
return paks
|
return paks
|
||||||
|
|
||||||
|
hosts = Histogram()
|
||||||
people = Histogram()
|
people = Histogram()
|
||||||
licenses = Histogram()
|
licenses = Histogram()
|
||||||
|
components = Histogram()
|
||||||
mostp_name = None
|
mostp_name = None
|
||||||
mostp_count = 0
|
mostp_count = 0
|
||||||
|
nr_binpaks = 0
|
||||||
|
nr_patches = 0
|
||||||
|
|
||||||
for pak in scan_pspec(sys.argv[1]):
|
errors = []
|
||||||
|
|
||||||
|
paks = scan_pspec(sys.argv[1])
|
||||||
|
for pak in paks:
|
||||||
spec = pisi.specfile.SpecFile()
|
spec = pisi.specfile.SpecFile()
|
||||||
spec.read(os.path.join(pak, "pspec.xml"))
|
try:
|
||||||
|
spec.read(os.path.join(pak, "pspec.xml"))
|
||||||
|
except Exception, inst:
|
||||||
|
errors.append([pak, str(inst)])
|
||||||
|
continue
|
||||||
|
if spec.verify() is False:
|
||||||
|
errors.append([pak, "specfile verification failed"])
|
||||||
|
continue
|
||||||
|
nr_binpaks += len(spec.packages)
|
||||||
|
nr_patches += len(spec.source.patches)
|
||||||
if len(spec.source.patches) > mostp_count:
|
if len(spec.source.patches) > mostp_count:
|
||||||
mostp_count = len(spec.source.patches)
|
mostp_count = len(spec.source.patches)
|
||||||
mostp_name = spec.source.name
|
mostp_name = spec.source.name
|
||||||
name = spec.source.packager.name
|
name = spec.source.packager.name
|
||||||
lices = spec.source.license
|
lices = spec.source.license
|
||||||
|
partof = spec.source.partof
|
||||||
|
if partof:
|
||||||
|
components.add(partof)
|
||||||
people.add(name)
|
people.add(name)
|
||||||
for lice in lices:
|
for lice in lices:
|
||||||
licenses.add(lice)
|
licenses.add(lice)
|
||||||
|
host = pisi.purl.PUrl(spec.source.archiveUri).location()
|
||||||
|
hosts.add(host)
|
||||||
|
|
||||||
print "<html><head><title>%s İstatistikleri</title>" % (sys.argv[1])
|
print "<html><head><title>%s İstatistikleri</title>" % (sys.argv[1])
|
||||||
print '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'
|
print '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'
|
||||||
print "</head><body>"
|
print "</head><body>"
|
||||||
|
|
||||||
|
print "<p>Toplam %d kod paketi, ve bunlardan oluşturulacak %d ikili paket var.</p>" % (len(paks), nr_binpaks)
|
||||||
|
echo(u"<p>Toplam peç sayısı %d</p>" % nr_patches)
|
||||||
|
if mostp_count > 0:
|
||||||
|
echo(u"<p>En çok peçlenen yazılım %d peçle %s!</p>" % (mostp_count, mostp_name))
|
||||||
|
|
||||||
|
if errors != []:
|
||||||
|
print "<h1>Hatalar</h1><table>"
|
||||||
|
for e in errors:
|
||||||
|
print "<tr><td>%s</td><td>%s</td></tr>" % (e[0], e[1])
|
||||||
|
print "</table>"
|
||||||
|
else:
|
||||||
|
print "<p>Hata yok, tebrikler!</p>"
|
||||||
|
|
||||||
|
print "<h1>Komponentler</h1><table>"
|
||||||
|
for name,cnt in components.get_list():
|
||||||
|
print "<tr><td>%s</td><td>%s</td>" % (name, cnt)
|
||||||
|
print "</table>"
|
||||||
|
|
||||||
print "<h1>Paketleyiciler</h1><table>"
|
print "<h1>Paketleyiciler</h1><table>"
|
||||||
for name,cnt in people.get_list():
|
for name,cnt in people.get_list():
|
||||||
echo("<tr><td>%s</td><td>%s</td>" % (name, cnt))
|
echo("<tr><td>%s</td><td>%s</td>" % (name, cnt))
|
||||||
@@ -83,7 +123,9 @@ for name,cnt in licenses.get_list():
|
|||||||
print "<tr><td>%s</td><td>%s</td>" % (name, cnt)
|
print "<tr><td>%s</td><td>%s</td>" % (name, cnt)
|
||||||
print "</table>"
|
print "</table>"
|
||||||
|
|
||||||
if mostp_count > 0:
|
echo(u"<h1>Kod kaynakları</h1><table>")
|
||||||
echo(u"<p>En çok peçlenen yazılım %d peçle %s!</p>" % (mostp_count, mostp_name))
|
for name,cnt in hosts.get_list():
|
||||||
|
print "<tr><td>%s</td><td>%s</td>" % (name, cnt)
|
||||||
|
print "</table>"
|
||||||
|
|
||||||
print "</body>"
|
print "</body>"
|
||||||
|
|||||||
Reference in New Issue
Block a user