From e1ebc9d90eba4412cc743131179eb6786030cb03 Mon Sep 17 00:00:00 2001 From: Mark Hymers Date: Sat, 31 Oct 2009 21:34:06 +0000 Subject: [PATCH] When changing Queue -> Build/PolicyQueue, it helps to do a full job Signed-off-by: Mark Hymers --- dak/process_new.py | 2 +- daklib/dbconn.py | 37 +++++++++++++++++++++++++++++++------ daklib/queue_install.py | 4 ++-- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/dak/process_new.py b/dak/process_new.py index f89e40c8..46c8546d 100755 --- a/dak/process_new.py +++ b/dak/process_new.py @@ -832,7 +832,7 @@ def do_accept(upload): if cnf.FindB("Dinstall::SecurityQueueHandling"): upload.dump_vars(cnf["Dir::Queue::Embargoed"]) - upload.move_to_queue(get_queue('embargoed')) + upload.move_to_queue(get_policy_queue('embargoed')) upload.queue_build("embargoed", cnf["Dir::Queue::Embargoed"]) # Check for override disparities upload.Subst["__SUMMARY__"] = summary diff --git a/daklib/dbconn.py b/daklib/dbconn.py index abdea8d3..8999da8f 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -485,9 +485,9 @@ class BuildQueue(object): __all__.append('BuildQueue') @session_wrapper -def get_queue(queuename, session=None): +def get_build_queue(queuename, session=None): """ - Returns Queue object for given C{queue name}, creating it if it does not + Returns BuildQueue object for given C{queue name}, creating it if it does not exist. @type queuename: string @@ -497,18 +497,18 @@ def get_queue(queuename, session=None): @param session: Optional SQLA session object (a temporary one will be generated if not supplied) - @rtype: Queue - @return: Queue object for the given queue + @rtype: BuildQueue + @return: BuildQueue object for the given queue """ - q = session.query(Queue).filter_by(queue_name=queuename) + q = session.query(BuildQueue).filter_by(queue_name=queuename) try: return q.one() except NoResultFound: return None -__all__.append('get_queue') +__all__.append('get_build_queue') ################################################################################ @@ -1659,6 +1659,31 @@ class PolicyQueue(object): __all__.append('PolicyQueue') +@session_wrapper +def get_policy_queue(queuename, session=None): + """ + Returns PolicyQueue object for given C{queue name} + + @type queuename: string + @param queuename: The name of the queue + + @type session: Session + @param session: Optional SQLA session object (a temporary one will be + generated if not supplied) + + @rtype: PolicyQueue + @return: PolicyQueue object for the given queue + """ + + q = session.query(PolicyQueue).filter_by(queue_name=queuename) + + try: + return q.one() + except NoResultFound: + return None + +__all__.append('get_policy_queue') + ################################################################################ class Priority(object): diff --git a/daklib/queue_install.py b/daklib/queue_install.py index b4a38b96..9767a5e2 100644 --- a/daklib/queue_install.py +++ b/daklib/queue_install.py @@ -209,7 +209,7 @@ def is_byhand(u): def do_byhand(u, summary, short_summary, chg, session): return package_to_queue(u, summary, short_summary, - get_queue('byhand'), chg, session, + get_policy_queue('byhand'), chg, session, announce=None) ################################################################################ @@ -226,7 +226,7 @@ def acknowledge_new(u, summary, short_summary, chg, session): print "Moving to NEW queue." u.logger.log(["Moving to new", u.pkg.changes_file]) - q = get_queue('new', session) + q = get_policy_queue('new', session) u.move_to_queue(q) chg.in_queue = q.queue_id -- 2.39.5