X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fprocess_unchecked.py;h=0e2d61669dc983d4686fd8afc1005a3826fdfc0f;hb=895a32ee49e0f870daa087c1784f843038450847;hp=15aea62e54fbba80a0d65bf19b378145bc6e1618;hpb=020f423243aaeab5ede2313b274131067386213f;p=dak.git diff --git a/dak/process_unchecked.py b/dak/process_unchecked.py index 15aea62e..0e2d6166 100755 --- a/dak/process_unchecked.py +++ b/dak/process_unchecked.py @@ -30,10 +30,11 @@ import commands, errno, fcntl, os, re, shutil, stat, sys, time, tempfile, traceback import apt_inst, apt_pkg -import daklib.database as database -import daklib.logging as logging -import daklib.queue as queue -import daklib.utils as utils +from daklib import database +from daklib import logging +from daklib import queue +from daklib import utils +from daklib.dak_exceptions import * from types import * @@ -181,19 +182,19 @@ def check_changes(): # Parse the .changes field into a dictionary try: changes.update(utils.parse_changes(filename)) - except utils.cant_open_exc: + except CantOpenError: reject("%s: can't read file." % (filename)) return 0 - except utils.changes_parse_error_exc, line: + except ParseChangesError, line: reject("%s: parse error, can't grok: %s." % (filename, line)) return 0 # Parse the Files field from the .changes into another dictionary try: files.update(utils.build_file_list(changes)) - except utils.changes_parse_error_exc, line: + except ParseChangesError, line: reject("%s: parse error, can't grok: %s." % (filename, line)) - except utils.nk_format_exc, format: + except UnknownFormatError, format: reject("%s: unknown format '%s'." % (filename, format)) return 0 @@ -226,7 +227,7 @@ def check_changes(): (changes["maintainer822"], changes["maintainer2047"], changes["maintainername"], changes["maintaineremail"]) = \ utils.fix_maintainer (changes["maintainer"]) - except utils.ParseMaintError, msg: + except ParseMaintError, msg: reject("%s: Maintainer field ('%s') failed to parse: %s" \ % (filename, changes["maintainer"], msg)) @@ -235,7 +236,7 @@ def check_changes(): (changes["changedby822"], changes["changedby2047"], changes["changedbyname"], changes["changedbyemail"]) = \ utils.fix_maintainer (changes.get("changed-by", "")) - except utils.ParseMaintError, msg: + except ParseMaintError, msg: (changes["changedby822"], changes["changedby2047"], changes["changedbyname"], changes["changedbyemail"]) = \ ("", "", "", "") @@ -685,21 +686,24 @@ def check_dsc(): # Parse the .dsc file try: dsc.update(utils.parse_changes(dsc_filename, signing_rules=1)) - except utils.cant_open_exc: + except CantOpenError: # if not -n copy_to_holding() will have done this for us... if Options["No-Action"]: reject("%s: can't read file." % (dsc_filename)) - except utils.changes_parse_error_exc, line: + except ParseChangesError, line: reject("%s: parse error, can't grok: %s." % (dsc_filename, line)) - except utils.invalid_dsc_format_exc, line: + except InvalidDscError, line: reject("%s: syntax error on line %s." % (dsc_filename, line)) # Build up the file list of files mentioned by the .dsc try: dsc_files.update(utils.build_file_list(dsc, is_a_dsc=1)) - except utils.no_files_exc: + except NoFilesFieldError: reject("%s: no Files: field." % (dsc_filename)) return 0 - except utils.changes_parse_error_exc, line: + except UnknownFormatError, format: + reject("%s: unknown format '%s'." % (filename, format)) + return 0 + except ParseChangesError, line: reject("%s: parse error, can't grok: %s." % (dsc_filename, line)) return 0 @@ -723,7 +727,7 @@ def check_dsc(): # Validate the Maintainer field try: utils.fix_maintainer (dsc["maintainer"]) - except utils.ParseMaintError, msg: + except ParseMaintError, msg: reject("%s: Maintainer field ('%s') failed to parse: %s" \ % (dsc_filename, dsc["maintainer"], msg)) @@ -905,10 +909,10 @@ def check_urgency (): if changes["architecture"].has_key("source"): if not changes.has_key("urgency"): changes["urgency"] = Cnf["Urgency::Default"] + changes["urgency"] = changes["urgency"].lower() if changes["urgency"] not in Cnf.ValueList("Urgency::Valid"): reject("%s is not a valid urgency; it will be treated as %s by testing." % (changes["urgency"], Cnf["Urgency::Default"]), "Warning: ") changes["urgency"] = Cnf["Urgency::Default"] - changes["urgency"] = changes["urgency"].lower() ################################################################################ @@ -945,9 +949,9 @@ def check_hashes (): try: fs = utils.build_file_list(changes, 0, "checksums-%s" % h, h) check_hash(".changes %s" % (h), fs, h, f, files) - except utils.no_files_exc: + except NoFilesFieldError: reject("No Checksums-%s: field in .changes" % (h)) - except utils.changes_parse_error_exc, line: + except ParseChangesError, line: reject("parse error for Checksums-%s in .changes, can't grok: %s." % (h, line)) if "source" not in changes["architecture"]: continue @@ -955,9 +959,9 @@ def check_hashes (): try: fs = utils.build_file_list(dsc, 1, "checksums-%s" % h, h) check_hash(".dsc %s" % (h), fs, h, f, dsc_files) - except utils.no_files_exc: + except NoFilesFieldError: reject("No Checksums-%s: field in .dsc" % (h)) - except utils.changes_parse_error_exc, line: + except ParseChangesError, line: reject("parse error for Checksums-%s in .dsc, can't grok: %s." % (h, line)) ################################################################################ @@ -974,7 +978,7 @@ def check_hash (where, lfiles, key, testfn, basedict = None): try: file_handle = utils.open_file(f) - except utils.cant_open_exc: + except CantOpenError: continue # Check hash @@ -1090,7 +1094,7 @@ def check_signed_by_key(): else: sponsored = 1 if ("source" in changes["architecture"] and - utils.is_email_alias(uid_email)): + uid_email and utils.is_email_alias(uid_email)): sponsor_addresses = utils.gpg_get_key_addresses(changes["fingerprint"]) if (changes["maintaineremail"] not in sponsor_addresses and changes["changedbyemail"] not in sponsor_addresses):