X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fexamine_package.py;h=7c005783f9a46cff048b24e5eb52e1436050930a;hb=077bf03c4495465e28388f52e471877b7afa821a;hp=b56785bd084c2a4d1032c52789f0deeaf6b08131;hpb=9e40c7aa193ec9a3e4041369298167c9d0402fdf;p=dak.git diff --git a/dak/examine_package.py b/dak/examine_package.py index b56785bd..7c005783 100755 --- a/dak/examine_package.py +++ b/dak/examine_package.py @@ -60,6 +60,7 @@ import commands import threading from daklib import utils +from daklib.config import Config from daklib.dbconn import DBConn, get_component_by_package_suite from daklib.gpg import SignedFile from daklib.regexes import html_escaping, re_html_escaping, re_version, re_spacestrip, \ @@ -77,7 +78,7 @@ printed.copyrights = {} package_relations = {} #: Store relations of packages for later output # default is to not output html. -use_html = 0 +use_html = False ################################################################################ @@ -446,7 +447,7 @@ def output_deb_info(suite, filename, packagename, session = None): to_print += " "+format_field(key,field_value)+'\n' return to_print -def do_command (command, filename, escaped=0): +def do_command (command, filename, escaped=False): o = os.popen("%s %s" % (command, filename)) if escaped: return escaped_text(o.read()) @@ -454,10 +455,20 @@ def do_command (command, filename, escaped=0): return formatted_text(o.read()) def do_lintian (filename): + cnf = Config() + cmd = [] + + user = cnf.get('Dinstall::UnprivUser') or None + if user is not None: + cmd.extend(['sudo', '-H', '-u', user]) + + color = 'always' if use_html: - return do_command("lintian --show-overrides --color html", filename, 1) - else: - return do_command("lintian --show-overrides --color always", filename, 1) + color = 'html' + + cmd.extend(['lintian', '--show-overrides', '--color', color]) + + return do_command(' '.join(cmd), filename, escaped=True) def get_copyright (deb_filename): global printed @@ -514,13 +525,14 @@ def get_readme_source (dsc_filename): return res def check_dsc (suite, dsc_filename, session = None): - (dsc) = read_changes_or_dsc(suite, dsc_filename, session) + dsc = read_changes_or_dsc(suite, dsc_filename, session) + dsc_basename = os.path.basename(dsc_filename) return foldable_output(dsc_filename, "dsc", dsc, norow=True) + \ "\n" + \ - foldable_output("lintian check for %s" % dsc_filename, + foldable_output("lintian check for %s" % dsc_basename, "source-lintian", do_lintian(dsc_filename)) + \ "\n" + \ - foldable_output("README.source for %s" % dsc_filename, + foldable_output("README.source for %s" % dsc_basename, "source-readmesource", get_readme_source(dsc_filename)) def check_deb (suite, deb_filename, session = None): @@ -603,7 +615,7 @@ def main (): if Options["Html-Output"]: global use_html - use_html = 1 + use_html = True stdout_fd = sys.stdout