X-Git-Url: https://git.decadent.org.uk/gitweb/?p=dak.git;a=blobdiff_plain;f=dak%2Fprocess_upload.py;h=9eb23f00309c1d5d30c74bc074ef676b7239e774;hp=bf5cda591d210c71ef735999b0a2643e11a04134;hb=03a86547e5d9b209016cc0b23f825d3baea92f8c;hpb=22182e36af2695babeeebe08bd9fcc733f5fd346 diff --git a/dak/process_upload.py b/dak/process_upload.py index bf5cda59..9eb23f00 100755 --- a/dak/process_upload.py +++ b/dak/process_upload.py @@ -212,7 +212,7 @@ def try_or_reject(function): try: return function(directory, upload, *args, **kwargs) except (daklib.archive.ArchiveException, daklib.checks.Reject) as e: - reason = e + reason = unicode(e) except Exception as e: reason = "There was an uncaught exception when processing your upload:\n{0}\nAny original reject reason follows below.".format(traceback.format_exc()) @@ -243,7 +243,7 @@ def get_processed_upload(upload): pu.changes = open(upload.changes.path, 'r').read() pu.changes_filename = upload.changes.filename - pu.sourceful = upload.changes.source is not None + pu.sourceful = upload.changes.sourceful pu.source = control.get('Source') pu.version = control.get('Version') pu.architecture = control.get('Architecture') @@ -251,6 +251,8 @@ def get_processed_upload(upload): pu.program = "process-upload" + pu.warnings = upload.warnings + return pu @try_or_reject @@ -258,6 +260,7 @@ def accept(directory, upload): cnf = Config() Logger.log(['ACCEPT', upload.changes.filename]) + print "ACCEPT" upload.install() @@ -297,6 +300,7 @@ def accept_to_new(directory, upload): cnf = Config() Logger.log(['ACCEPT-TO-NEW', upload.changes.filename]) + print "ACCEPT-TO-NEW" upload.install_to_new() # TODO: tag bugs pending @@ -316,6 +320,7 @@ def real_reject(directory, upload, reason=None, notify=True): cnf = Config() Logger.log(['REJECT', upload.changes.filename]) + print "REJECT" fs = upload.transaction.fs rejectdir = cnf['Dir::Reject'] @@ -380,6 +385,9 @@ def action(directory, upload): print print "\n".join(package_info) print + if len(upload.warnings) > 0: + print "\n".join(upload.warnings) + print if len(upload.reject_reasons) > 0: print "Reason:" @@ -455,6 +463,13 @@ def process_it(directory, changes, keyrings, session): with daklib.archive.ArchiveUpload(directory, changes, keyrings) as upload: processed = action(directory, upload) if processed and not Options['No-Action']: + session = DBConn().session() + history = SignatureHistory.from_signed_file(upload.changes) + if history.query(session) is None: + session.add(history) + session.commit() + session.close() + unlink_if_exists(os.path.join(directory, changes.filename)) for fn in changes.files: unlink_if_exists(os.path.join(directory, fn))