]> err.no Git - dak/commitdiff
Use distinct() to avoid listing duplicated claimed overrides
authorLuca Falavigna <dktrkranz@debian.org>
Mon, 22 Apr 2013 20:52:52 +0000 (20:52 +0000)
committerLuca Falavigna <dktrkranz@debian.org>
Mon, 22 Apr 2013 20:52:52 +0000 (20:52 +0000)
dak/process_new.py

index 93ebb83d5bf2ea5b810c45ab206d4df71b0c1579..53b4bf7be608cb341dd128b78254123024c96611 100755 (executable)
@@ -126,11 +126,16 @@ def claimed_overrides(upload, missing, session):
     for m in missing:
         if m['type'] != 'dsc':
             binaries.remove(m['package'])
-    return session.query(DBBinary).filter(DBBinary.package.in_(binaries)). \
-                         join(DBBinary.source). \
-                         filter(not_(DBSource.source.in_(source))). \
-                         join(DBBinary.suites). \
-                         filter(Suite.suite_name.in_(suites))
+    if binaries:
+        return session.query(DBBinary.package, DBSource.source).distinct(). \
+                             filter(DBBinary.package.in_(binaries)). \
+                             join(DBBinary.source). \
+                             filter(not_(DBSource.source.in_(source))). \
+                             join(DBBinary.suites). \
+                             filter(Suite.suite_name.in_(suites)). \
+                             order_by(DBSource.source, DBBinary.package)
+    else:
+        return None
 
 ################################################################################
 
@@ -154,10 +159,10 @@ def print_new (upload, missing, indexed, session, file=sys.stdout):
             line = line + ' [!]'
         print >>file, line
     claimed = claimed_overrides(upload, missing, session)
-    if claimed.count():
+    if claimed and claimed.count():
         print '\nCLAIMED OVERRIDES'
         for c in claimed:
-            print '%s:\t%s' % (c.source.source, c.package)
+            print '%s: %s' % (c.source, c.package)
     notes = get_new_comments(upload.policy_queue, upload.changes.source)
     for note in notes:
         print "\nAuthor: %s\nVersion: %s\nTimestamp: %s\n\n%s" \