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()
- 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]))
+ res = ""
- print_formatted_text( "NOTE: Copyright is the same as %s.\n" % \
+ if printed_copyrights.has_key(crightmd5) and printed_copyrights[crightmd5] != "%s (%s)" % (package, deb_filename):
++ 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)
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)
# 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:
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))
################################################################################