#!/usr/bin/env python
-# Various statistical pr0nography fun and games
+""" Various statistical pr0nography fun and games """
# Copyright (C) 2000, 2001, 2002, 2003, 2006 James Troup <james@nocrew.org>
# This program is free software; you can redistribute it and/or modify
import pg, sys
import apt_pkg
-import dak.lib.utils as utils
+from daklib import utils
################################################################################
def daily_install_stats():
stats = {}
- file = utils.open_file("2001-11")
- for line in file.readlines():
- split = line.strip().split('~')
+ f = utils.open_file("2001-11")
+ for line in f.readlines():
+ split = line.strip().split('|')
program = split[1]
if program != "katie" and program != "process-accepted":
continue
q = projectB.query("SELECT id, suite_name FROM suite")
suite_ql = q.getresult()
for i in suite_ql:
- (id, name) = i
- suites[id] = name
- suite_ids[name] = id
+ (sid, name) = i
+ suites[sid] = name
+ suite_ids[name] = sid
# Build up architecture mapping
q = projectB.query("SELECT id, arch_string FROM architecture")
for i in q.getresult():
- (id, name) = i
- arches[id] = name
- arch_ids[name] = id
+ (aid, name) = i
+ arches[aid] = name
+ arch_ids[name] = aid
# Pre-create the dictionary
for suite_id in suites.keys():
d[suite_id] = {}
for arch in Cnf.ValueList("Suite::%s::Architectures" % (suite)):
suite_arches[suite_id][arch] = ""
suite_id_list.append(suite_id)
- output_list = map(lambda x: output_format(x), suite_list)
+ output_list = [ output_format(i) for i in suite_list ]
longest_suite = longest(output_list)
arch_list = arches.values()
arch_list.sort()
Cnf = utils.get_conf()
Arguments = [('h',"help","Stats::Options::Help")]
for i in [ "help" ]:
- if not Cnf.has_key("Stats::Options::%s" % (i)):
- Cnf["Stats::Options::%s" % (i)] = ""
+ if not Cnf.has_key("Stats::Options::%s" % (i)):
+ Cnf["Stats::Options::%s" % (i)] = ""
args = apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv)
Options = Cnf.SubTree("Stats::Options")
if Options["Help"]:
- usage()
+ usage()
if len(args) < 1:
utils.warn("dak stats requires a MODE argument")
if __name__ == '__main__':
main()
-