X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=dak%2Fexamine_package.py;h=482eceec72a72c00ac83873690135bc6558b7fcd;hb=5751d50d131a78e48a321f02d5fd68aeb2436ff8;hp=5b247f0cf61ee1e9c1cb9b69a4e9e434bf85724a;hpb=4e514e56a317d099acbc2dcb4a57561ee5df3fb6;p=dak.git diff --git a/dak/examine_package.py b/dak/examine_package.py index 5b247f0c..482eceec 100755 --- a/dak/examine_package.py +++ b/dak/examine_package.py @@ -42,6 +42,12 @@ to stdout. Those functions can be used in multithreaded parts of dak. ################################################################################ +# suppress some deprecation warnings in squeeze related to md5 module +import warnings +warnings.filterwarnings('ignore', \ + "the md5 module is deprecated; use hashlib instead", \ + DeprecationWarning) + import errno import os import re @@ -54,7 +60,8 @@ import commands import threading from daklib import utils -from daklib.dbconn import DBConn, get_binary_from_name_suite +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, \ re_contrib, re_nonfree, re_localhost, re_newlinespace, \ re_package, re_doc_directory @@ -319,9 +326,9 @@ def read_changes_or_dsc (suite, filename, session = None): def create_depends_string (suite, depends_tree, session = None): result = "" if suite == 'experimental': - suite_where = "in ('experimental','unstable')" + suite_list = ['experimental','unstable'] else: - suite_where = "= '%s'" % suite + suite_list = [suite] comma_count = 1 for l in depends_tree: @@ -333,17 +340,16 @@ def create_depends_string (suite, depends_tree, session = None): result += " | " # doesn't do version lookup yet. - res = get_binary_from_name_suite(d['name'], suite_where, session) - if res.rowcount > 0: - i = res.fetchone() - + component = get_component_by_package_suite(d['name'], suite_list, \ + session = session) + if component is not None: adepends = d['name'] if d['version'] != '' : adepends += " (%s)" % (d['version']) - if i[2] == "contrib": + if component == "contrib": result += colour_output(adepends, "contrib") - elif i[2] == "non-free": + elif component == "non-free": result += colour_output(adepends, "nonfree") else : result += colour_output(adepends, "main") @@ -521,30 +527,10 @@ def check_deb (suite, deb_filename, session = None): # Read a file, strip the signature and return the modified contents as # a string. def strip_pgp_signature (filename): - inputfile = utils.open_file (filename) - contents = "" - inside_signature = 0 - skip_next = 0 - for line in inputfile.readlines(): - if line[:-1] == "": - continue - if inside_signature: - continue - if skip_next: - skip_next = 0 - continue - if line.startswith("-----BEGIN PGP SIGNED MESSAGE"): - skip_next = 1 - continue - if line.startswith("-----BEGIN PGP SIGNATURE"): - inside_signature = 1 - continue - if line.startswith("-----END PGP SIGNATURE"): - inside_signature = 0 - continue - contents += line - inputfile.close() - return contents + with utils.open_file(filename) as f: + data = f.read() + signedfile = SignedFile(data, keyrings=(), require_signature=False) + return signedfile.contents def display_changes(suite, changes_filename): global printed