X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fqueue_report.py;h=af3bc58d534a9f445bbc3997f6d29c63fd85b5a0;hb=f89e353cb89593444b3e841cadc7175a3f4e9081;hp=18fa867a0f4e5885d62016b5d4eaa179dbc8247d;hpb=e2ae71066cbb134753d7bfceb16e87d0b76dfd6e;p=dak.git diff --git a/dak/queue_report.py b/dak/queue_report.py old mode 100755 new mode 100644 index 18fa867a..af3bc58d --- a/dak/queue_report.py +++ b/dak/queue_report.py @@ -36,7 +36,7 @@ import copy, glob, os, stat, sys, time import apt_pkg -import daklib.queue +import daklib.queue import daklib.utils Cnf = None @@ -61,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) @@ -119,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 Project -
-
- - - +
+ +
+ + + - - + - - - + + - - -
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())) @@ -197,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 """ Valid HTML 4.01! - + Valid CSS! """ @@ -206,27 +206,22 @@ def footer(): def table_header(type): print "

Summary for: %s

" % (type) print """
- - - - - - - - - - """ + + + + + + + + + + """ def table_footer(type, source_count, total_count): print "
PackageVersionArchDistributionAgeMaintainerCloses
PackageVersionArchDistributionAgeMaintainerCloses

\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): @@ -244,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) @@ -258,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): @@ -365,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 @@ -435,14 +429,14 @@ def main(): ('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 = daklib.queue.Upload(Cnf)