5 Adding table for allowed source formats
7 @contact: Debian FTP Master <ftpmaster@debian.org>
8 @copyright: 2009 Raphael Hertzog <hertzog@debian.org>
9 @license: GNU General Public License version 2 or later
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2 of the License, or
15 # (at your option) any later version.
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 ################################################################################
29 ################################################################################
33 from daklib.dak_exceptions import DBUpdateError
35 ################################################################################
38 print "Adding tables listing allowed source formats"
43 CREATE TABLE src_format (
44 id SERIAL PRIMARY KEY,
45 format_name TEXT NOT NULL,
49 c.execute("INSERT INTO src_format (format_name) VALUES('1.0')")
50 c.execute("INSERT INTO src_format (format_name) VALUES('3.0 (quilt)')")
51 c.execute("INSERT INTO src_format (format_name) VALUES('3.0 (native)')")
54 CREATE TABLE suite_src_formats (
55 suite INT4 NOT NULL REFERENCES suite(id),
56 src_format INT4 NOT NULL REFERENCES src_format(id),
57 PRIMARY KEY (suite, src_format)
61 print "Authorize format 1.0 on all suites by default"
62 c.execute("SELECT id FROM suite")
64 c.execute("SELECT id FROM src_format WHERE format_name = '1.0'")
65 formats = c.fetchall()
68 c.execute("INSERT INTO suite_src_formats (suite, src_format) VALUES(%s, %s)", (s[0], f[0]))
70 print "Authorize all other formats on tpu, unstable & experimental by default"
71 c.execute("SELECT id FROM suite WHERE suite_name IN ('testing-proposed-updates', 'unstable', 'experimental')")
73 c.execute("SELECT id FROM src_format WHERE format_name != '1.0'")
74 formats = c.fetchall()
77 c.execute("INSERT INTO suite_src_formats (suite, src_format) VALUES(%s, %s)", (s[0], f[0]))
79 c.execute("UPDATE config SET value = '15' WHERE name = 'db_revision'")
82 except psycopg2.ProgrammingError as msg:
84 raise DBUpdateError("Unable to apply source format update 15, rollback issued. Error message : %s" % (str(msg)))