X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fshow_new.py;h=34baba954940946f1184253da5e40a9cd40cf051;hb=d9822f04453a1b62ca0aa66e2efeea35f654778f;hp=674eca391917220e7c297db232c72520be8d2fc6;hpb=2764c503d2f9c2177873f861c9dad76bcd2c04ca;p=dak.git diff --git a/dak/show_new.py b/dak/show_new.py old mode 100755 new mode 100644 index 674eca39..34baba95 --- a/dak/show_new.py +++ b/dak/show_new.py @@ -29,7 +29,7 @@ import copy, os, sys, time import apt_pkg import examine_package import daklib.database -import daklib.queue +import daklib.queue import daklib.utils # Globals @@ -44,54 +44,98 @@ sources = set() ################################################################################ ################################################################################ -def html_header(name): +def html_header(name, filestoexamine): if name.endswith('.changes'): name = ' '.join(name.split('_')[:2]) - print """ - """ - print "%s - Debian NEW package overview" % (name) - print """ - - - -
- - - - Debian Project -
-
- - - """ - print """""" % (name) - print """ - - - - - -
- Debian NEW package overview for %s -
- -
- """ + print """ + + + + %(name)s - Debian NEW package overview + + + + + + +
+ + corner image + corner image + corner image + corner image + + Debian NEW package overview for %(name)s + +
+ """%{"name":name} + + # we assume only one source (.dsc) per changes here + print """ + " def html_footer(): - print "

Timestamp: %s (UTC)

" % (time.strftime("%d.%m.%Y / %H:%M:%S", time.gmtime())) - print """ - Valid HTML 4.01! - - Valid CSS! - """ - print "" - + print """

Timestamp: %s (UTC)

"""% (time.strftime("%d.%m.%Y / %H:%M:%S", time.gmtime())) + print """

+ Valid HTML 4.01! + + Valid CSS! +

+ + +""" ################################################################################ @@ -115,19 +159,23 @@ def do_pkg(changes_file): # do not generate html output if that source/version already has one. if not os.path.exists(os.path.join(Cnf["Show-New::HTMLPath"],htmlname)): sys.stdout = open(os.path.join(Cnf["Show-New::HTMLPath"],htmlname),"w") - html_header(changes["source"]) + + filestoexamine = [] + for pkg in new.keys(): + for fn in new[pkg]["files"]: + if ( files[fn].has_key("new") and not + files[fn]["type"] in [ "orig.tar.gz", "orig.tar.bz2", "tar.gz", "tar.bz2", "diff.gz", "diff.bz2"] ): + filestoexamine.append(fn) + + html_header(changes["source"], filestoexamine) daklib.queue.check_valid(new) examine_package.display_changes(Upload.pkg.changes_file) - for pkg in new.keys(): - for file in new[pkg]["files"]: - if ( files[file].has_key("new") and not - files[file]["type"] in [ "orig.tar.gz", "orig.tar.bz2", "tar.gz", "tar.bz2", "diff.gz", "diff.bz2"] ): - if file.endswith(".deb") or file.endswith(".udeb"): - examine_package.check_deb(file) - elif file.endswith(".dsc"): - examine_package.check_dsc(file) + for fn in filter(lambda fn: fn.endswith(".dsc"), filestoexamine): + examine_package.check_dsc(fn) + for fn in filter(lambda fn: fn.endswith(".deb") or fn.endswith(".udeb"), filestoexamine): + examine_package.check_deb(fn) html_footer() if sys.stdout != stdout_fd: @@ -139,6 +187,7 @@ def do_pkg(changes_file): def usage (exit_code=0): print """Usage: dak show-new [OPTION]... [CHANGES]... -h, --help show this help and exit. + -p, --html-path [path] override output directory. """ sys.exit(exit_code) @@ -149,7 +198,8 @@ def init(): Cnf = daklib.utils.get_conf() - Arguments = [('h',"help","Show-New::Options::Help")] + Arguments = [('h',"help","Show-New::Options::Help"), + ("p","html-path","Show-New::HTMLPath","HasArg")] for i in ["help"]: if not Cnf.has_key("Show-New::Options::%s" % (i)): @@ -183,7 +233,7 @@ def main(): print "\n" + changes_file do_pkg (changes_file) files = set(os.listdir(Cnf["Show-New::HTMLPath"])) - to_delete = files.difference(sources) + to_delete = filter(lambda x: x.endswith(".html"), files.difference(sources)) for file in to_delete: os.remove(os.path.join(Cnf["Show-New::HTMLPath"],file))