X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fprocess_policy.py;h=8103fd0ba808453e8a63b02aaaa2cfd658648c68;hb=772655d608069f12e400e0d6c7b7fac76eb98083;hp=61c4ef395702112020d1b67f6f1520ce10954ca4;hpb=22182e36af2695babeeebe08bd9fcc733f5fd346;p=dak.git diff --git a/dak/process_policy.py b/dak/process_policy.py index 61c4ef39..8103fd0b 100755 --- a/dak/process_policy.py +++ b/dak/process_policy.py @@ -68,6 +68,10 @@ def do_comments(dir, srcqueue, opref, npref, line, fn, transaction): else: changes_prefix = changes_prefix + '.changes' + # We need to escape "_" as we use it with the LIKE operator (via the + # SQLA startwith) later. + changes_prefix = changes_prefix.replace("_", r"\_") + uploads = session.query(PolicyQueueUpload).filter_by(policy_queue=srcqueue) \ .join(PolicyQueueUpload.changes).filter(DBChange.changesname.startswith(changes_prefix)) \ .order_by(PolicyQueueUpload.source_id) @@ -138,6 +142,9 @@ def comment_accept(upload, srcqueue, comments, transaction): if upload.source is not None: transaction.copy_source(upload.source, suite, source_component_func(upload.source), allow_tainted=allow_tainted) for db_binary in upload.binaries: + # build queues may miss the source package if this is a binary-only upload + if suite != upload.target_suite: + transaction.copy_source(db_binary.source, suite, source_component_func(db_binary.source), allow_tainted=allow_tainted) transaction.copy_binary(db_binary, suite, binary_component_func(db_binary), allow_tainted=allow_tainted, extra_archives=[upload.target_suite.archive]) # Copy .changes if needed @@ -157,7 +164,7 @@ def comment_accept(upload, srcqueue, comments, transaction): Logger.log(["Policy Queue ACCEPT", srcqueue.queue_name, changesname]) pu = get_processed_upload(upload) - daklib.announce.announce_accept(upload) + daklib.announce.announce_accept(pu) # TODO: code duplication. Similar code is in process-upload. # Move .changes to done @@ -232,7 +239,9 @@ def real_comment_reject(upload, srcqueue, comments, transaction, notify=True, ma if not Options["No-Action"]: Logger.log(["Policy Queue REJECT", srcqueue.queue_name, upload.changes.changesname]) + changes = upload.changes remove_upload(upload, transaction) + session.delete(changes) ################################################################################ @@ -252,7 +261,6 @@ def remove_upload(upload, transaction): fs.unlink(os.path.join(queuedir, upload.changes.changesname)) session.delete(upload) - session.delete(changes) session.flush() ################################################################################ @@ -264,7 +272,7 @@ def get_processed_upload(upload): pu.changed_by = upload.changes.changedby pu.fingerprint = upload.changes.fingerprint - pu.suites = [] + pu.suites = [ upload.target_suite ] pu.from_policy_suites = [ upload.target_suite ] changes_path = os.path.join(upload.policy_queue.path, upload.changes.changesname)