5 Debian Archive Kit Database Update Script
6 Copyright © 2008 Michael Casadevall <mcasadevall@debian.org>
7 Copyright © 2009 Joerg Jaspert <joerg@debian.org>
9 Debian Archive Kit Database Update Script 8
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 ################################################################################
28 # * Ganneff ponders how to best write the text to -devel. (need to tell em in
29 # case they find more bugs). "We fixed the fucking idiotic broken implementation
30 # to be less so" is probably not the nicest, even if perfect valid, way to say so
32 ################################################################################
36 from daklib.dak_exceptions import DBUpdateError
37 from daklib.utils import get_conf
39 ################################################################################
42 print "Moving some more of the suite config into the DB"
48 c.execute("ALTER TABLE suite ADD COLUMN copychanges TEXT;")
49 query = "UPDATE suite SET copychanges = %s WHERE suite_name = %s" #: Update query
50 for suite in Cnf.SubTree("Suite").List():
51 copychanges = Cnf.Find("Suite::%s::CopyChanges" % (suite))
52 print "[CopyChanges] Processing suite %s" % (suite)
56 c.execute(query, [copychanges, suite])
58 c.execute("ALTER TABLE suite ADD COLUMN copydotdak TEXT;")
59 query = "UPDATE suite SET copydotdak = %s WHERE suite_name = %s" #: Update query
60 for suite in Cnf.SubTree("Suite").List():
61 copydotdak = Cnf.Find("Suite::%s::CopyDotDak" % (suite))
62 print "[CopyDotDak] Processing suite %s" % (suite)
66 c.execute(query, [copydotdak, suite])
68 c.execute("ALTER TABLE suite ADD COLUMN commentsdir TEXT;")
69 query = "UPDATE suite SET commentsdir = %s WHERE suite_name = %s" #: Update query
70 for suite in Cnf.SubTree("Suite").List():
71 commentsdir = Cnf.Find("Suite::%s::CommentsDir" % (suite))
72 print "[CommentsDir] Processing suite %s" % (suite)
76 c.execute(query, [commentsdir, suite])
78 c.execute("ALTER TABLE suite ADD COLUMN overridesuite TEXT;")
79 query = "UPDATE suite SET overridesuite = %s WHERE suite_name = %s" #: Update query
80 for suite in Cnf.SubTree("Suite").List():
81 overridesuite = Cnf.Find("Suite::%s::OverrideSuite" % (suite))
82 print "[OverrideSuite] Processing suite %s" % (suite)
86 c.execute(query, [overridesuite, suite])
88 c.execute("ALTER TABLE suite ADD COLUMN changelogbase TEXT;")
89 query = "UPDATE suite SET changelogbase = %s WHERE suite_name = %s" #: Update query
90 for suite in Cnf.SubTree("Suite").List():
91 changelogbase = Cnf.Find("Suite::%s::ChangeLogBase" % (suite))
92 print "[ChangeLogBase] Processing suite %s" % (suite)
96 c.execute(query, [changelogbase, suite])
98 c.execute("UPDATE config SET value = '8' WHERE name = 'db_revision'")
101 except psycopg2.ProgrammingError, msg:
103 raise DBUpdateError, "Unable to apply suite config updates, rollback issued. Error message : %s" % (str(msg))