X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=dak%2Fqueue_report.py;h=af3bc58d534a9f445bbc3997f6d29c63fd85b5a0;hb=7174357ba1280a47cc1e701235767b413ef2bc1c;hp=f287801b598463b74a0966fe95c450619d3ce0ca;hpb=06ce98c8111a8b09e5603dbbd34324a216412d69;p=dak.git
diff --git a/dak/queue_report.py b/dak/queue_report.py
old mode 100755
new mode 100644
index f287801b..af3bc58d
--- a/dak/queue_report.py
+++ b/dak/queue_report.py
@@ -36,7 +36,8 @@
import copy, glob, os, stat, sys, time
import apt_pkg
-import dak.lib.queue, dak.lib.utils
+import daklib.queue
+import daklib.utils
Cnf = None
Upload = None
@@ -60,7 +61,7 @@ Prints a report of packages in queue directories (usually new and byhand).
nf=notes, first nl=notes, last
Age Keys: m=minutes, h=hours, d=days, w=weeks, o=months, y=years
-
+
"""
sys.exit(exit_code)
@@ -118,77 +119,77 @@ def sg_compare (a, b):
############################################################
def sortfunc(a,b):
- for sorting in direction:
- (sortkey, way, time) = sorting
- ret = 0
- if time == "m":
- x=int(a[sortkey]/60)
- y=int(b[sortkey]/60)
- elif time == "h":
- x=int(a[sortkey]/3600)
- y=int(b[sortkey]/3600)
- elif time == "d":
- x=int(a[sortkey]/86400)
- y=int(b[sortkey]/86400)
- elif time == "w":
- x=int(a[sortkey]/604800)
- y=int(b[sortkey]/604800)
- elif time == "o":
- x=int(a[sortkey]/2419200)
- y=int(b[sortkey]/2419200)
- elif time == "y":
- x=int(a[sortkey]/29030400)
- y=int(b[sortkey]/29030400)
- else:
- x=a[sortkey]
- y=b[sortkey]
- if x < y:
- ret = -1
- elif x > y:
- ret = 1
- if ret != 0:
- if way < 0:
- ret = ret*-1
- return ret
- return 0
+ for sorting in direction:
+ (sortkey, way, time) = sorting
+ ret = 0
+ if time == "m":
+ x=int(a[sortkey]/60)
+ y=int(b[sortkey]/60)
+ elif time == "h":
+ x=int(a[sortkey]/3600)
+ y=int(b[sortkey]/3600)
+ elif time == "d":
+ x=int(a[sortkey]/86400)
+ y=int(b[sortkey]/86400)
+ elif time == "w":
+ x=int(a[sortkey]/604800)
+ y=int(b[sortkey]/604800)
+ elif time == "o":
+ x=int(a[sortkey]/2419200)
+ y=int(b[sortkey]/2419200)
+ elif time == "y":
+ x=int(a[sortkey]/29030400)
+ y=int(b[sortkey]/29030400)
+ else:
+ x=a[sortkey]
+ y=b[sortkey]
+ if x < y:
+ ret = -1
+ elif x > y:
+ ret = 1
+ if ret != 0:
+ if way < 0:
+ ret = ret*-1
+ return ret
+ return 0
############################################################
def header():
print """
-
-
+
+ Debian NEW and BYHAND Packages
+
+
+
+
+
+
-
+
-
-
-
-
-
+
+
+
+
+
|
- Debian NEW and BYHAND Packages |
-
+ | Debian NEW and BYHAND Packages |
+
|
-
-
-
+ |
+
+
|
-
+ |
|
-
-
- """
+ |
+
+ """
def footer():
print "
Timestamp: %s (UTC)
" % (time.strftime("%d.%m.%Y / %H:%M:%S", time.gmtime()))
@@ -196,7 +197,7 @@ def footer():
print "
You may want to look at the REJECT-FAQ for possible reasons why one of the above packages may get rejected.
"
print """
-
+
"""
@@ -205,27 +206,22 @@ def footer():
def table_header(type):
print "
Summary for: %s
" % (type)
print """
-
- Package |
- Version |
- Arch |
- Distribution |
- Age |
- Maintainer |
- Closes |
-
- """
+
+ Package |
+ Version |
+ Arch |
+ Distribution |
+ Age |
+ Maintainer |
+ Closes |
+
+ """
def table_footer(type, source_count, total_count):
print "
\n"
print "
Package count in %s: %s\n" % (type, source_count)
print "
Total Package count: %s
\n" % (total_count)
-def force_to_latin(s):
- """Forces a string to Latin-1."""
- latin1_s = unicode(s,'utf-8')
- return latin1_s.encode('iso8859-1', 'replace')
-
def table_row(source, version, arch, last_mod, maint, distribution, closes):
@@ -243,13 +239,12 @@ def table_row(source, version, arch, last_mod, maint, distribution, closes):
print "
%s | " % (tdclass, source)
print "
" % (tdclass)
for vers in version.split():
- print "%s " % (vers)
+ print "%s " % (source, vers, vers)
print " | %s | " % (tdclass, arch, tdclass)
for dist in distribution:
print "%s " % (dist)
print " | %s | " % (tdclass, last_mod)
(name, mail) = maint.split(":")
- name = force_to_latin(name)
print "
%s | " % (tdclass, mail, name)
print "
" % (tdclass)
@@ -257,7 +252,7 @@ def table_row(source, version, arch, last_mod, maint, distribution, closes):
print "#%s " % (close, close)
print " | "
row_number+=1
-
+
############################################################
def process_changes_files(changes_files, type):
@@ -327,8 +322,8 @@ def process_changes_files(changes_files, type):
try:
(maintainer["maintainer822"], maintainer["maintainer2047"],
maintainer["maintainername"], maintainer["maintaineremail"]) = \
- dak.lib.utils.fix_maintainer (j["maintainer"])
- except dak.lib.utils.ParseMaintError, msg:
+ daklib.utils.fix_maintainer (j["maintainer"])
+ except daklib.utils.ParseMaintError, msg:
print "Problems while parsing maintainer address\n"
maintainer["maintainername"] = "Unknown"
maintainer["maintaineremail"] = "Unknown"
@@ -340,7 +335,7 @@ def process_changes_files(changes_files, type):
version = j["version"]
versions[version] = ""
arches_list = arches.keys()
- arches_list.sort(dak.lib.utils.arch_compare_sw)
+ arches_list.sort(daklib.utils.arch_compare_sw)
arch_list = " ".join(arches_list)
version_list = " ".join(versions.keys())
if len(version_list) > max_version_len:
@@ -364,26 +359,26 @@ def process_changes_files(changes_files, type):
# If we produce html we always have oldest first.
direction.append([4,-1,"ao"])
else:
- if Cnf.has_key("Queue-Report::Options::Sort"):
- for i in Cnf["Queue-Report::Options::Sort"].split(","):
- if i == "ao":
- # Age, oldest first.
- direction.append([4,-1,age])
- elif i == "an":
- # Age, newest first.
- direction.append([4,1,age])
- elif i == "na":
- # Name, Ascending.
- direction.append([0,1,0])
- elif i == "nd":
- # Name, Descending.
- direction.append([0,-1,0])
- elif i == "nl":
- # Notes last.
- direction.append([3,1,0])
- elif i == "nf":
- # Notes first.
- direction.append([3,-1,0])
+ if Cnf.has_key("Queue-Report::Options::Sort"):
+ for i in Cnf["Queue-Report::Options::Sort"].split(","):
+ if i == "ao":
+ # Age, oldest first.
+ direction.append([4,-1,age])
+ elif i == "an":
+ # Age, newest first.
+ direction.append([4,1,age])
+ elif i == "na":
+ # Name, Ascending.
+ direction.append([0,1,0])
+ elif i == "nd":
+ # Name, Descending.
+ direction.append([0,-1,0])
+ elif i == "nl":
+ # Notes last.
+ direction.append([3,1,0])
+ elif i == "nf":
+ # Notes first.
+ direction.append([3,-1,0])
entries.sort(lambda x, y: sortfunc(x, y))
# Yes, in theory you can add several sort options at the commandline with. But my mind is to small
# at the moment to come up with a real good sorting function that considers all the sidesteps you
@@ -428,22 +423,22 @@ def process_changes_files(changes_files, type):
def main():
global Cnf, Upload
- Cnf = dak.lib.utils.get_conf()
+ Cnf = daklib.utils.get_conf()
Arguments = [('h',"help","Queue-Report::Options::Help"),
('n',"new","Queue-Report::Options::New"),
('s',"sort","Queue-Report::Options::Sort", "HasArg"),
('a',"age","Queue-Report::Options::Age", "HasArg")]
for i in [ "help" ]:
- if not Cnf.has_key("Queue-Report::Options::%s" % (i)):
- Cnf["Queue-Report::Options::%s" % (i)] = ""
+ if not Cnf.has_key("Queue-Report::Options::%s" % (i)):
+ Cnf["Queue-Report::Options::%s" % (i)] = ""
apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv)
Options = Cnf.SubTree("Queue-Report::Options")
if Options["Help"]:
- usage()
+ usage()
- Upload = dak.lib.queue.Upload(Cnf)
+ Upload = daklib.queue.Upload(Cnf)
if Cnf.has_key("Queue-Report::Options::New"):
header()