From: Mark Hymers Date: Wed, 10 Aug 2011 19:59:23 +0000 (+0100) Subject: Make suite.announce an ARRAY X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=562e9142aecc36c33c8cbafe67461d423bf539b5;p=dak Make suite.announce an ARRAY Signed-off-by: Mark Hymers --- diff --git a/dak/dakdb/update65.py b/dak/dakdb/update65.py new file mode 100755 index 00000000..8dd83a1b --- /dev/null +++ b/dak/dakdb/update65.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# coding=utf8 + +""" +Make announce field an array + +@contact: Debian FTP Master +@copyright: 2011 Mark Hymers +@license: GNU General Public License version 2 or later +""" + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +################################################################################ + +import psycopg2 +from daklib.dak_exceptions import DBUpdateError +from daklib.config import Config + +################################################################################ +def do_update(self): + """ + Make announce field an array + """ + print __doc__ + try: + c = self.db.cursor() + + c.execute("ALTER TABLE suite RENAME COLUMN announce TO announce_temp") + c.execute("ALTER TABLE suite ADD COLUMN announce TEXT[]") + c.execute("UPDATE suite SET announce = ARRAY[announce_temp] WHERE announce_temp IS NOT NULL") + c.execute("ALTER TABLE suite DROP COLUMN announce_temp") + + c.execute("UPDATE config SET value = '65' WHERE name = 'db_revision'") + self.db.commit() + + except psycopg2.ProgrammingError, msg: + self.db.rollback() + raise DBUpdateError, 'Unable to apply sick update 65, rollback issued. Error message : %s' % (str(msg)) diff --git a/dak/update_db.py b/dak/update_db.py index 62f0889b..0245b957 100755 --- a/dak/update_db.py +++ b/dak/update_db.py @@ -46,7 +46,7 @@ from daklib.daklog import Logger ################################################################################ Cnf = None -required_database_schema = 64 +required_database_schema = 65 ################################################################################ diff --git a/daklib/queue.py b/daklib/queue.py index 20e04bd6..a44ad6d2 100755 --- a/daklib/queue.py +++ b/daklib/queue.py @@ -2019,19 +2019,19 @@ distribution.""" announcetemplate = os.path.join(cnf["Dir::Templates"], 'process-unchecked.announce') - lists_done = {} + lists_todo = {} summary = "" - self.Subst["__SHORT_SUMMARY__"] = short_summary - + # Get a unique list of target lists for dist in self.pkg.changes["distribution"].keys(): suite = get_suite(dist) if suite is None: continue - announce_list = suite.announce - if announce_list == "" or lists_done.has_key(announce_list): - continue + for tgt in suite.announce: + lists_todo[tgt] = 1 + + self.Subst["__SHORT_SUMMARY__"] = short_summary - lists_done[announce_list] = 1 + for announce_list in lists_todo.keys(): summary += "Announcing to %s\n" % (announce_list) if action: