]> git.decadent.org.uk Git - dak.git/commitdiff
Merge branch 'contents'
authorTorsten Werner <twerner@debian.org>
Wed, 23 Mar 2011 16:01:35 +0000 (17:01 +0100)
committerTorsten Werner <twerner@debian.org>
Wed, 23 Mar 2011 16:01:35 +0000 (17:01 +0100)
config/debian-security/dak.conf
dak/dakdb/update48.py [new file with mode: 0755]
dak/update_db.py

index 58f77c11cfb0aa914cc91269b4694b16292a8fdb..b03e0f89826e67cd3bfe3e0d7589fad153a2b8aa 100644 (file)
@@ -262,10 +262,13 @@ Dir
 
 DB
 {
-  Name "obscurity";
-  Host ""; 
-  Port -1;
-
+  Service "obscurity";
+  // PoolSize should be at least ThreadCount + 1
+  PoolSize 5;
+  // MaxOverflow shouldn't exceed postgresql.conf's max_connections - PoolSize
+  MaxOverflow 13;
+  // should be false for encoding == SQL_ASCII
+  Unicode "false"
 };
 
 Architectures
diff --git a/dak/dakdb/update48.py b/dak/dakdb/update48.py
new file mode 100755 (executable)
index 0000000..67ea8c5
--- /dev/null
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+# coding=utf8
+
+"""
+Suite.version can be null
+
+@contact: Debian FTP Master <ftpmaster@debian.org>
+@copyright: 2011 Joerg Jaspert <joerg@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 socket import gethostname;
+
+################################################################################
+def do_update(self):
+    """
+    Add table for source contents.
+    """
+    print __doc__
+    try:
+        c = self.db.cursor()
+
+        c.execute("ALTER TABLE suite ALTER COLUMN version DROP NOT NULL")
+        c.execute("UPDATE suite SET version=NULL WHERE version='-'")
+
+        c.execute("UPDATE config SET value = '48' WHERE name = 'db_revision'")
+        self.db.commit()
+
+    except psycopg2.ProgrammingError, msg:
+        self.db.rollback()
+        raise DBUpdateError, 'Unable to apply sick update 48, rollback issued. Error message : %s' % (str(msg))
index 985051ece2951cdb003b3ef86493bca4cdb1a080..3effa47741362500138fd6a18df0b8821837b362 100755 (executable)
@@ -46,7 +46,7 @@ from daklib.daklog import Logger
 ################################################################################
 
 Cnf = None
-required_database_schema = 47
+required_database_schema = 48
 
 ################################################################################
 
@@ -123,9 +123,12 @@ Updates dak's database schema to the lastest version. You should disable crontab
 
         try:
             # Build a connect string
-            connect_str = "dbname=%s"% (cnf["DB::Name"])
-            if cnf["DB::Host"] != '': connect_str += " host=%s" % (cnf["DB::Host"])
-            if cnf["DB::Port"] != '-1': connect_str += " port=%d" % (int(cnf["DB::Port"]))
+            if cnf["DB::Service"]:
+                connect_str = "service=%s" % cnf["DB::Service"]
+            else:
+                connect_str = "dbname=%s"% (cnf["DB::Name"])
+                if cnf["DB::Host"] != '': connect_str += " host=%s" % (cnf["DB::Host"])
+                if cnf["DB::Port"] != '-1': connect_str += " port=%d" % (int(cnf["DB::Port"]))
 
             self.db = psycopg2.connect(connect_str)