From: Joerg Jaspert Date: Sat, 3 May 2008 19:50:37 +0000 (+0200) Subject: Merge first version of Marks cleanup branch X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=1408d82381556c9e2b3eaa04412846c766a011db;p=dak.git Merge first version of Marks cleanup branch --- 1408d82381556c9e2b3eaa04412846c766a011db diff --cc dak/examine_package.py index b9ac9af3,47be7f65..d452d71c mode 100644,100644..100755 --- a/dak/examine_package.py +++ b/dak/examine_package.py @@@ -388,38 -343,42 +388,40 @@@ def do_command (command, filename, esca def do_lintian (filename): if use_html: - do_command("lintian --show-overrides --color html", filename, 1) + return do_command("lintian --show-overrides --color html", filename, 1) else: - do_command("lintian --show-overrides --color always", filename, 1) + return do_command("lintian --show-overrides --color always", filename, 1) -def print_copyright (deb_filename): +def get_copyright (deb_filename): package = re_package.sub(r'\1', deb_filename) o = os.popen("dpkg-deb -c %s | egrep 'usr(/share)?/doc/[^/]*/copyright' | awk '{print $6}' | head -n 1" % (deb_filename)) - copyright = o.read()[:-1] + cright = o.read()[:-1] - if copyright == "": - return formatted_text("WARNING: No copyright found, please check package manually.") + if cright == "": + print_formatted_text("WARNING: No copyright found, please check package manually.") + return - doc_directory = re_doc_directory.sub(r'\1', copyright) + doc_directory = re_doc_directory.sub(r'\1', cright) if package != doc_directory: - print_formatted_text("WARNING: wrong doc directory (expected %s, got %s)." % (package, doc_directory)) - return + return formatted_text("WARNING: wrong doc directory (expected %s, got %s)." % (package, doc_directory)) - o = os.popen("dpkg-deb --fsys-tarfile %s | tar xvOf - %s 2>/dev/null" % (deb_filename, copyright)) - copyright = o.read() - copyrightmd5 = md5.md5(copyright).hexdigest() + o = os.popen("dpkg-deb --fsys-tarfile %s | tar xvOf - %s 2>/dev/null" % (deb_filename, cright)) + cright = o.read() + crightmd5 = md5.md5(cright).hexdigest() + res = "" - if printed_copyrights.has_key(copyrightmd5) and printed_copyrights[copyrightmd5] != "%s (%s)" % (package, deb_filename): - res += formatted_text( "NOTE: Copyright is the same as %s.\n\n" % \ - (printed_copyrights[copyrightmd5])) + if printed_copyrights.has_key(crightmd5) and printed_copyrights[crightmd5] != "%s (%s)" % (package, deb_filename): - print_formatted_text( "NOTE: Copyright is the same as %s.\n" % \ ++ res += formatted_text( "NOTE: Copyright is the same as %s.\n" % \ + (printed_copyrights[crightmd5])) else: - printed_copyrights[copyrightmd5] = "%s (%s)" % (package, deb_filename) - return res+formatted_text(copyright) + printed_copyrights[crightmd5] = "%s (%s)" % (package, deb_filename) - - print_formatted_text(cright) ++ res += formatted_text(cright) ++ return res def check_dsc (dsc_filename): - headline(".dsc file for %s" % (dsc_filename)) - (dsc) = read_dsc(dsc_filename) - print_escaped_text(dsc) - headline("lintian check for %s" % (dsc_filename)) - do_lintian(dsc_filename) + (dsc) = read_changes_or_dsc(dsc_filename) + foldable_output(dsc_filename, "dsc", dsc, norow=True) + foldable_output("lintian check for %s" % dsc_filename, "source-lintian", do_lintian(dsc_filename)) def check_deb (deb_filename): filename = os.path.basename(deb_filename) @@@ -479,12 -436,13 +481,12 @@@ def strip_pgp_signature (filename) inside_signature = 0 continue contents += line - file.close() + f.close() return contents -# Display the .changes [without the signature] -def display_changes (changes_filename): - headline(".changes file for %s" % (changes_filename)) - print_formatted_text(strip_pgp_signature(changes_filename)) +def display_changes(changes_filename): + changes = read_changes_or_dsc(changes_filename) + foldable_output(changes_filename, "changes", changes, norow=True) def check_changes (changes_filename): display_changes(changes_filename) diff --cc dak/show_new.py index 2596f864,f6402713..a18847cc mode 100644,100644..100755 --- a/dak/show_new.py +++ b/dak/show_new.py @@@ -158,23 -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"]) + + 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) + queue.check_valid(new) examine_package.display_changes(Upload.pkg.changes_file) - for pkg in new.keys(): - for f in new[pkg]["files"]: - if ( files[f].has_key("new") and not - files[f]["type"] in [ "orig.tar.gz", "orig.tar.bz2", "tar.gz", "tar.bz2", "diff.gz", "diff.bz2"] ): - if f.endswith(".deb") or f.endswith(".udeb"): - examine_package.check_deb(f) - elif f.endswith(".dsc"): - examine_package.check_dsc(f) + 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: @@@ -232,9 -183,9 +232,9 @@@ 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)) + for f in to_delete: + os.remove(os.path.join(Cnf["Show-New::HTMLPath"],f)) ################################################################################