5 More suite config into the DB
7 @contact: Debian FTP Master <ftpmaster@debian.org>
8 @copyright: 2008 Michael Casadevall <mcasadevall@debian.org>
9 @copyright: 2009 Joerg Jaspert <joerg@debian.org>
10 @license: GNU General Public License version 2 or later
13 # This program is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 2 of the License, or
16 # (at your option) any later version.
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write to the Free Software
25 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 ################################################################################
29 # * Ganneff ponders how to best write the text to -devel. (need to tell em in
30 # case they find more bugs). "We fixed the fucking idiotic broken implementation
31 # to be less so" is probably not the nicest, even if perfect valid, way to say so
33 ################################################################################
37 from daklib.dak_exceptions import DBUpdateError
38 from daklib.utils import get_conf
40 ################################################################################
43 print "Moving some more of the suite config into the DB"
49 c.execute("ALTER TABLE suite ADD COLUMN copychanges TEXT;")
50 query = "UPDATE suite SET copychanges = %s WHERE suite_name = %s" #: Update query
51 for suite in Cnf.SubTree("Suite").List():
52 copychanges = Cnf.Find("Suite::%s::CopyChanges" % (suite))
53 print "[CopyChanges] Processing suite %s" % (suite)
57 c.execute(query, [copychanges, suite])
59 c.execute("ALTER TABLE suite ADD COLUMN copydotdak TEXT;")
60 query = "UPDATE suite SET copydotdak = %s WHERE suite_name = %s" #: Update query
61 for suite in Cnf.SubTree("Suite").List():
62 copydotdak = Cnf.Find("Suite::%s::CopyDotDak" % (suite))
63 print "[CopyDotDak] Processing suite %s" % (suite)
67 c.execute(query, [copydotdak, suite])
69 c.execute("ALTER TABLE suite ADD COLUMN commentsdir TEXT;")
70 query = "UPDATE suite SET commentsdir = %s WHERE suite_name = %s" #: Update query
71 for suite in Cnf.SubTree("Suite").List():
72 commentsdir = Cnf.Find("Suite::%s::CommentsDir" % (suite))
73 print "[CommentsDir] Processing suite %s" % (suite)
77 c.execute(query, [commentsdir, suite])
79 c.execute("ALTER TABLE suite ADD COLUMN overridesuite TEXT;")
80 query = "UPDATE suite SET overridesuite = %s WHERE suite_name = %s" #: Update query
81 for suite in Cnf.SubTree("Suite").List():
82 overridesuite = Cnf.Find("Suite::%s::OverrideSuite" % (suite))
83 print "[OverrideSuite] Processing suite %s" % (suite)
87 c.execute(query, [overridesuite, suite])
89 c.execute("ALTER TABLE suite ADD COLUMN changelogbase TEXT;")
90 query = "UPDATE suite SET changelogbase = %s WHERE suite_name = %s" #: Update query
91 for suite in Cnf.SubTree("Suite").List():
92 changelogbase = Cnf.Find("Suite::%s::ChangeLogBase" % (suite))
93 print "[ChangeLogBase] Processing suite %s" % (suite)
97 c.execute(query, [changelogbase, suite])
99 c.execute("UPDATE config SET value = '8' WHERE name = 'db_revision'")
102 except psycopg2.ProgrammingError, msg:
104 raise DBUpdateError, "Unable to apply suite config updates, rollback issued. Error message : %s" % (str(msg))