From: Tollef Fog Heen Date: Tue, 15 Oct 2013 09:22:24 +0000 (+0200) Subject: dak/process_policy: Process source uploads first X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1be5f064750bbe39050ff278a9e6d2baf0e2aa8;p=dak dak/process_policy: Process source uploads first If we only process the NEW queue in readdir order, we risk processing a binary package before its source, which will lead to spurious REJECTs. This processes all source-only uploads first, which prevents that from happening. Signed-off-by: Tollef Fog Heen --- diff --git a/dak/process_policy.py b/dak/process_policy.py index ddd05b7c..e88a5023 100755 --- a/dak/process_policy.py +++ b/dak/process_policy.py @@ -56,7 +56,10 @@ Logger = None def do_comments(dir, srcqueue, opref, npref, line, fn, transaction): session = transaction.session - for comm in [ x for x in os.listdir(dir) if x.startswith(opref) ]: + comms = filter(lambda x: x.startswith(opref), os.listdir(dir)) + # Sort source uploads first. + comms = sorted(comms, key=lambda x: not x.endswith("_source")) + for comm in comms: lines = open(os.path.join(dir, comm)).readlines() if len(lines) == 0 or lines[0] != line + "\n": continue