From: Thomas Viehmann Date: Sat, 26 Apr 2008 11:03:31 +0000 (+0000) Subject: started nicer NEW .html pages X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c60719bc9a46557970c0c43e90d6f7d0469230b0;p=dak started nicer NEW .html pages --- diff --git a/dak/examine_package.py b/dak/examine_package.py index 217186c3..8143eaca 100755 --- a/dak/examine_package.py +++ b/dak/examine_package.py @@ -97,9 +97,14 @@ def escape_if_needed(s): else: return s -def headline(s, level=2): +def headline(s, level=2, bodyelement=None): if use_html: - print "%s" % (level, html_escape(s), level) + if bodyelement: + print """ + %(title)s + """%{"bodyelement":bodyelement,"title":html_escape(s)} + else: + print "%s" % (level, html_escape(s), level) else: print "---- %s ----" % (s) @@ -440,9 +445,48 @@ def strip_pgp_signature (filename): return contents # Display the .changes [without the signature] -def display_changes (changes_filename): - headline(".changes file for %s" % (changes_filename)) +def display_changes(changes_filename): + if use_html: + print """
+ """ + headline(changes_filename, bodyelement="changes-body") + if use_html: + print """ """ + print """""" + """ + + + + + + + + + + + + + + + """ + print """
""" print_formatted_text(strip_pgp_signature(changes_filename)) + if use_html: + print """
Format:1.7
Date:Mon, 24 Dec 2007 15:32:08 -0200
Source:php-xdebug
Binary:php5-xdebug
Architecture:source amd64
Version:2.0.2-1
Distribution:unstable
Urgency:low
Maintainer:Marcelo Jorge Vieira (metal) <metal@alucinados.com>
Changed-By:Marcelo Jorge Vieira (metal) <metal@alucinados.com>
Description: + php5-xdebug - xdebug extension module for PHP5
Closes:377348
Changes: + php-xdebug (2.0.2-1) unstable; urgency=low
+
+ * Initial release (Closes: #377348)
Files: + c6ee78b58a4d70d66f8a70436b2a943c 632 web optional php-xdebug_2.0.2-1.dsc
+ d3547f74353174884452a51ee9ca687f 279891 web optional php-xdebug_2.0.2.orig.tar.gz
+ 8e7c262113c8ac13f47781e0ac0eb4c3 4107 web optional php-xdebug_2.0.2-1.diff.gz
+ 3c6be09f23931fabf0b3048575390ed3 137930 web optional php5-xdebug_2.0.2-1_amd64.deb
""" def check_changes (changes_filename): display_changes(changes_filename) diff --git a/dak/show_new.py b/dak/show_new.py index 674eca39..445f6d2a 100755 --- a/dak/show_new.py +++ b/dak/show_new.py @@ -44,54 +44,94 @@ 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 +155,24 @@ 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 filestoexamine: + if fn.endswith(".deb") or fn.endswith(".udeb"): + examine_package.check_deb(fn) + elif fn.endswith(".dsc"): + examine_package.check_dsc(fn) html_footer() if sys.stdout != stdout_fd: @@ -139,6 +184,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 +195,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 +230,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))