X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fqueue_report.py;h=f1e5287f9b29f337a6d1629a194a2ae7b6a6f267;hb=969f96350310474d777d4aa804e38ed96a41bd77;hp=ff3e082bbf73bb0eef76017b55697d410b8bbc97;hpb=2a9824e30623dabdcdab6f371b55a10c21754a25;p=dak.git
diff --git a/dak/queue_report.py b/dak/queue_report.py
old mode 100755
new mode 100644
index ff3e082b..f1e5287f
--- a/dak/queue_report.py
+++ b/dak/queue_report.py
@@ -36,8 +36,8 @@
import copy, glob, os, stat, sys, time
import apt_pkg
-import daklib.queue
-import daklib.utils
+import daklib.queue as queue
+import daklib.utils as utils
Cnf = None
Upload = 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
+
+
+
+
+
+
![](http://www.debian.org/logos/openlogo-nd-50.png)
-
+
![Debian Project](http://www.debian.org/Pics/debian.png)
-
-
-
-
-
+
+
+
+
+
![](http://www.debian.org/Pics/red-upperleft.png) |
- Debian NEW and BYHAND Packages |
-
+ | Debian NEW and BYHAND Packages |
+
![](http://www.debian.org/Pics/red-upperright.png) |
-
-
-
+ |
+
+
![](http://www.debian.org/Pics/red-lowerleft.png) |
-
+ |
![](http://www.debian.org/Pics/red-lowerright.png) |
-
-
- """
+ |
+
+ """
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!](http://www.w3.org/Icons/valid-html401)
-
+
![Valid CSS!](http://jigsaw.w3.org/css-validator/images/vcss)
"""
@@ -206,16 +206,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 +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):
@@ -309,7 +309,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 +321,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 utils.ParseMaintError, msg:
print "Problems while parsing maintainer address\n"
maintainer["maintainername"] = "Unknown"
maintainer["maintaineremail"] = "Unknown"
@@ -335,7 +334,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 +358,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 +422,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()