diff --git a/tools/repostats.py b/tools/repostats.py index b52b2ddf..ad7c6124 100755 --- a/tools/repostats.py +++ b/tools/repostats.py @@ -14,6 +14,7 @@ import os sys.path.append('.') import pisi.specfile +import pisi.purl class Histogram: def __init__(self): @@ -52,27 +53,66 @@ def scan_pspec(folder): dirs.remove(".svn") return paks +hosts = Histogram() people = Histogram() licenses = Histogram() +components = Histogram() mostp_name = None 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.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: mostp_count = len(spec.source.patches) mostp_name = spec.source.name name = spec.source.packager.name lices = spec.source.license + partof = spec.source.partof + if partof: + components.add(partof) people.add(name) for lice in lices: licenses.add(lice) + host = pisi.purl.PUrl(spec.source.archiveUri).location() + hosts.add(host) print "
Toplam %d kod paketi, ve bunlardan oluşturulacak %d ikili paket var.
" % (len(paks), nr_binpaks) +echo(u"Toplam peç sayısı %d
" % nr_patches) +if mostp_count > 0: + echo(u"En çok peçlenen yazılım %d peçle %s!
" % (mostp_count, mostp_name)) + +if errors != []: + print "| %s | %s |
Hata yok, tebrikler!
" + +print "| %s | %s | " % (name, cnt) +print "
| %s | %s | " % (name, cnt)) @@ -83,7 +123,9 @@ for name,cnt in licenses.get_list(): print "
| %s | %s | " % (name, cnt) print "
En çok peçlenen yazılım %d peçle %s!
" % (mostp_count, mostp_name)) +echo(u"| %s | %s | " % (name, cnt) +print "