--- /dev/null
+#!/usr/bin/env python
+# coding=utf8
+
+"""
+Make announce field an array
+
+@contact: Debian FTP Master <ftpmaster@debian.org>
+@copyright: 2011 Mark Hymers <mhy@debian.org>
+@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))
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: