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>
def do_comments(dir, srcqueue, opref, npref, line, fn, transaction):
session = transaction.session
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
lines = open(os.path.join(dir, comm)).readlines()
if len(lines) == 0 or lines[0] != line + "\n": continue