]> git.decadent.org.uk Git - dak.git/commitdiff
process-new: display existing overrides
authorLuca Falavigna <dktrkranz@debian.org>
Sun, 21 Apr 2013 13:28:00 +0000 (13:28 +0000)
committerLuca Falavigna <dktrkranz@debian.org>
Sun, 21 Apr 2013 13:28:00 +0000 (13:28 +0000)
Display overrides belonging to other sources to avoid accepting
packages which "steal" binary packages (Closes: #697729).

dak/process_new.py

index e3dc5de13e735a35b479335a60841cf18256db97..93ebb83d5bf2ea5b810c45ab206d4df71b0c1579 100755 (executable)
@@ -64,6 +64,7 @@ from daklib.dak_exceptions import CantOpenError, AlreadyLockedError, CantGetLock
 from daklib.summarystats import SummaryStats
 from daklib.config import Config
 from daklib.policy import UploadCopy, PolicyQueueUploadHandler
+from sqlalchemy.sql import not_
 
 # Globals
 Options = None
@@ -118,6 +119,21 @@ class Priority_Completer:
 
 ################################################################################
 
+def claimed_overrides(upload, missing, session):
+    source = [upload.source.source]
+    binaries = set([x.package for x in upload.binaries])
+    suites = ('unstable','experimental')
+    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))
+
+################################################################################
+
 def print_new (upload, missing, indexed, session, file=sys.stdout):
     check_valid(missing, session)
     index = 0
@@ -137,6 +153,11 @@ def print_new (upload, missing, indexed, session, file=sys.stdout):
         if not m['valid']:
             line = line + ' [!]'
         print >>file, line
+    claimed = claimed_overrides(upload, missing, session)
+    if claimed.count():
+        print '\nCLAIMED OVERRIDES'
+        for c in claimed:
+            print '%s:\t%s' % (c.source.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" \