X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fexamine_package.py;h=8e2ce20b987135538e4a0d76cab2be7a8df72665;hb=5092f26ebf1d8ce76088ed442c2b0a9a1dadf095;hp=65e81b5def1dce9f039b42c633ed0b16424c0855;hpb=96b8f67f11f629aa033adecb3c07e2ce24965997;p=dak.git diff --git a/dak/examine_package.py b/dak/examine_package.py index 65e81b5d..8e2ce20b 100755 --- a/dak/examine_package.py +++ b/dak/examine_package.py @@ -61,9 +61,11 @@ import threading from daklib import utils 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 +from daklib.dak_exceptions import ChangesUnicodeError ################################################################################ @@ -558,30 +560,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