X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=dak%2Fshow_new.py;h=4b485f2669ad7e0a642ff2d3712809f5a7b4b79f;hb=93d36869f2334d117d195b01ed7faa14db9c1da8;hp=674eca391917220e7c297db232c72520be8d2fc6;hpb=2764c503d2f9c2177873f861c9dad76bcd2c04ca;p=dak.git diff --git a/dak/show_new.py b/dak/show_new.py index 674eca39..4b485f26 100755 --- a/dak/show_new.py +++ b/dak/show_new.py @@ -28,9 +28,9 @@ import copy, os, sys, time import apt_pkg import examine_package -import daklib.database -import daklib.queue -import daklib.utils +from daklib import database +from daklib import queue +from daklib import utils # Globals Cnf = None @@ -44,54 +44,97 @@ sources = set() ################################################################################ ################################################################################ -def html_header(name): +def html_header(name, filestoexamine): if name.endswith('.changes'): name = ' '.join(name.split('_')[:2]) - print """ -
""" - print "
- ![]() | """
- print """Debian NEW package overview for %s | """ % (name) - print """
- ![]() |
-
- ![]() |
-
- ![]() |
-
Timestamp: %s (UTC)
" % (time.strftime("%d.%m.%Y / %H:%M:%S", time.gmtime())) - print """ -Timestamp: %s (UTC)
"""% (time.strftime("%d.%m.%Y / %H:%M:%S", time.gmtime())) + print """ + + +""" ################################################################################ @@ -106,7 +149,7 @@ def do_pkg(changes_file): changes["suite"] = copy.copy(changes["distribution"]) # Find out what's new - new = daklib.queue.determine_new(changes, files, projectB, 0) + new = queue.determine_new(changes, files, projectB, 0) stdout_fd = sys.stdout @@ -115,19 +158,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"]) - daklib.queue.check_valid(new) + 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) + + 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 +186,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) @@ -147,9 +195,10 @@ def usage (exit_code=0): def init(): global Cnf, Options, Upload, projectB - Cnf = daklib.utils.get_conf() + Cnf = 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)): @@ -161,7 +210,7 @@ def init(): if Options["help"]: usage() - Upload = daklib.queue.Upload(Cnf) + Upload = queue.Upload(Cnf) projectB = Upload.projectB @@ -177,15 +226,15 @@ def main(): examine_package.use_html=1 for changes_file in changes_files: - changes_file = daklib.utils.validate_changes_file_arg(changes_file, 0) + changes_file = utils.validate_changes_file_arg(changes_file, 0) if not changes_file: continue print "\n" + changes_file do_pkg (changes_file) files = set(os.listdir(Cnf["Show-New::HTMLPath"])) - to_delete = files.difference(sources) - for file in to_delete: - os.remove(os.path.join(Cnf["Show-New::HTMLPath"],file)) + to_delete = filter(lambda x: x.endswith(".html"), files.difference(sources)) + for f in to_delete: + os.remove(os.path.join(Cnf["Show-New::HTMLPath"],f)) ################################################################################