From: Luca Falavigna Date: Sun, 21 Apr 2013 13:28:00 +0000 (+0000) Subject: process-new: display existing overrides X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4352e332c61215f801202e976041882e62d0cbb3;p=dak process-new: display existing overrides Display overrides belonging to other sources to avoid accepting packages which "steal" binary packages (Closes: #697729). --- diff --git a/dak/process_new.py b/dak/process_new.py index e3dc5de1..93ebb83d 100755 --- a/dak/process_new.py +++ b/dak/process_new.py @@ -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" \