X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fexamine_package.py;h=7c005783f9a46cff048b24e5eb52e1436050930a;hb=362ea497d3c9ee5891fca772132269d809a0547a;hp=eabd8850806d8e7a3d2cbcd49b145fe4eaf87d6a;hpb=94dcb438da061093e80d33a4f3485c45314e06ea;p=dak.git diff --git a/dak/examine_package.py b/dak/examine_package.py index eabd8850..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,7 +525,7 @@ 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" + \ @@ -604,7 +615,7 @@ def main (): if Options["Html-Output"]: global use_html - use_html = 1 + use_html = True stdout_fd = sys.stdout