From 1b7bdd311021297a2ad171c2ad8107c95f32e66d Mon Sep 17 00:00:00 2001 From: Ansgar Burchardt Date: Sun, 20 Oct 2013 14:09:18 +0200 Subject: [PATCH] dak/process_policy.py: process sourceful uploads first Bug: http://bugs.debian.org/703876 --- dak/process_policy.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dak/process_policy.py b/dak/process_policy.py index ddd05b7c..7dd55a83 100755 --- a/dak/process_policy.py +++ b/dak/process_policy.py @@ -56,6 +56,7 @@ Logger = None def do_comments(dir, srcqueue, opref, npref, line, fn, transaction): session = transaction.session + actions = [] for comm in [ x for x in os.listdir(dir) if x.startswith(opref) ]: lines = open(os.path.join(dir, comm)).readlines() if len(lines) == 0 or lines[0] != line + "\n": continue @@ -75,15 +76,20 @@ def do_comments(dir, srcqueue, opref, npref, line, fn, transaction): uploads = session.query(PolicyQueueUpload).filter_by(policy_queue=srcqueue) \ .join(PolicyQueueUpload.changes).filter(DBChange.changesname.startswith(changes_prefix)) \ .order_by(PolicyQueueUpload.source_id) - for u in uploads: - print "Processing changes file: %s" % u.changes.changesname - fn(u, srcqueue, "".join(lines[1:]), transaction) + reason = "".join(lines[1:]) + actions.extend((u, reason) for u in uploads) if opref != npref: newcomm = npref + comm[len(opref):] newcomm = utils.find_next_free(os.path.join(dir, newcomm)) transaction.fs.move(os.path.join(dir, comm), newcomm) + actions.sort() + + for u, reason in actions: + print("Processing changes file: {0}".format(u.changes.changesname)) + fn(u, srcqueue, reason, transaction) + ################################################################################ def try_or_reject(function): -- 2.39.5