X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fprocess_new.py;h=aaae0581ca818fd1b86e06895cc3fbc679de3d3b;hb=1da70e1ded7f59d105a47279d4c463c522edc609;hp=c13ff781051f28fa13c2ab1baf72211c1229dc9c;hpb=9632ed2777f3993753916c397200b6c9d0fd96e5;p=dak.git diff --git a/dak/process_new.py b/dak/process_new.py index c13ff781..aaae0581 100755 --- a/dak/process_new.py +++ b/dak/process_new.py @@ -39,10 +39,10 @@ import copy, errno, os, readline, stat, sys, time import apt_pkg, apt_inst import examine_package -import daklib.database as database -import daklib.logging as logging -import daklib.queue as queue -import daklib.utils as utils +from daklib import database +from daklib import logging +from daklib import queue +from daklib import utils # Globals Cnf = None @@ -151,7 +151,7 @@ def indiv_sg_compare (a, b): def sg_compare (a, b): a = a[1] b = b[1] - """Sort by have note, time of oldest upload.""" + """Sort by have note, source already in database and time of oldest upload.""" # Sort by have note a_note_state = a["note_state"] b_note_state = b["note_state"] @@ -159,6 +159,10 @@ def sg_compare (a, b): return -1 elif a_note_state > b_note_state: return 1 + # Sort by source already in database (descending) + source_in_database = cmp(a["source_in_database"], b["source_in_database"]) + if source_in_database: + return -source_in_database # Sort by time of oldest upload return cmp(a["oldest"], b["oldest"]) @@ -193,6 +197,9 @@ def sort_changes(changes_files): per_source[source]["list"].append(cache[filename]) # Determine oldest time and have note status for each source group for source in per_source.keys(): + q = projectB.query("SELECT 1 FROM source WHERE source = '%s'" % source) + ql = q.getresult() + per_source[source]["source_in_database"] = len(ql)>0 source_list = per_source[source]["list"] first = source_list[0] oldest = os.stat(first["filename"])[stat.ST_MTIME]