X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=inline;f=dak%2Fqueue_report.py;h=aa1c54da702bd7f2cbbde182a0ac7a10fa081ad9;hb=bd0360e12cf6f7e1bf662e87e1f4a0be7c4ba8f7;hp=ff3e082bbf73bb0eef76017b55697d410b8bbc97;hpb=ea17738cea735d71766bfc2bd082f59b3adf2dbb;p=dak.git
diff --git a/dak/queue_report.py b/dak/queue_report.py
index ff3e082b..aa1c54da 100755
--- a/dak/queue_report.py
+++ b/dak/queue_report.py
@@ -36,8 +36,9 @@
import copy, glob, os, stat, sys, time
import apt_pkg
-import daklib.queue
-import daklib.utils
+from daklib import queue
+from daklib import utils
+from daklib.dak_exceptions import *
Cnf = None
Upload = None
@@ -61,7 +62,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 +120,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()))
@@ -197,7 +198,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 """
-
+
"""
@@ -206,16 +207,16 @@ 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"
@@ -252,7 +253,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):
@@ -309,7 +310,6 @@ def process_changes_files(changes_files, type):
maint=""
distribution=""
closes=""
- source_exists=""
for i in per_source_items:
last_modified = time.time()-i[1]["oldest"]
source = i[1]["list"][0]["source"]
@@ -322,8 +322,8 @@ def process_changes_files(changes_files, type):
try:
(maintainer["maintainer822"], maintainer["maintainer2047"],
maintainer["maintainername"], maintainer["maintaineremail"]) = \
- daklib.utils.fix_maintainer (j["maintainer"])
- except daklib.utils.ParseMaintError, msg:
+ utils.fix_maintainer (j["maintainer"])
+ except ParseMaintError, msg:
print "Problems while parsing maintainer address\n"
maintainer["maintainername"] = "Unknown"
maintainer["maintaineremail"] = "Unknown"
@@ -335,7 +335,7 @@ def process_changes_files(changes_files, type):
version = j["version"]
versions[version] = ""
arches_list = arches.keys()
- arches_list.sort(daklib.utils.arch_compare_sw)
+ arches_list.sort(utils.arch_compare_sw)
arch_list = " ".join(arches_list)
version_list = " ".join(versions.keys())
if len(version_list) > max_version_len:
@@ -359,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
@@ -423,22 +423,22 @@ def process_changes_files(changes_files, type):
def main():
global Cnf, Upload
- Cnf = daklib.utils.get_conf()
+ Cnf = 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 = daklib.queue.Upload(Cnf)
+ Upload = queue.Upload(Cnf)
if Cnf.has_key("Queue-Report::Options::New"):
header()