]> err.no Git - dak/commitdiff
dak/process_policy: Process source uploads first master
authorTollef Fog Heen <tfheen@varnish-software.com>
Tue, 15 Oct 2013 09:22:24 +0000 (11:22 +0200)
committerTollef Fog Heen <tfheen@err.no>
Tue, 15 Oct 2013 09:22:24 +0000 (11:22 +0200)
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 <tfheen@err.no>
dak/process_policy.py

index ddd05b7c65166f18b4011dafe47a5f82053ec7ac..e88a502338acee85f62c790ab628ced7e82680a8 100755 (executable)
@@ -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