]> git.decadent.org.uk Git - dak.git/commitdiff
Merge remote branch 'mhy/master' into merge
authorMark Hymers <mhy@debian.org>
Wed, 23 Mar 2011 14:37:09 +0000 (14:37 +0000)
committerMark Hymers <mhy@debian.org>
Wed, 23 Mar 2011 14:37:09 +0000 (14:37 +0000)
Signed-off-by: Mark Hymers <mhy@debian.org>
config/backports/dinstall.functions
config/debian-security/dak.conf
config/debian/dinstall.functions
dak/dakdb/update48.py [new file with mode: 0755]
dak/update_db.py
daklib/dbconn.py
tests/dbtest_metadata.py

index 27854f8b66eaf2dde60b547318dd23ce4bba6780..0dfe19ec53077494abfb19cb97935f066db3c267 100644 (file)
@@ -322,7 +322,7 @@ function mkfilesindices() {
 
     ARCHLIST=$(tempfile)
 
-    log "Querying $PGDATABASE..."
+    log "Querying postgres..."
     echo 'SELECT l.path, f.filename, a.arch_string FROM location l JOIN files f ON (f.location = l.id) LEFT OUTER JOIN (binaries b JOIN architecture a ON (b.architecture = a.id)) ON (f.id = b.file)' | psql -At | sed 's/|//;s,^/srv/ftp-master.debian.org/ftp,.,' | sort >$ARCHLIST
 
     includedirs () {
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
index e4de479e20ab2c6cdb9935b8cb695c76a2251112..cac7c7c5ecef56db68f79c36f7b45585d8315d27 100644 (file)
@@ -295,7 +295,7 @@ function mkfilesindices() {
 
     ARCHLIST=$(tempfile)
 
-    log "Querying $PGDATABASE..."
+    log "Querying postgres"
     echo 'SELECT l.path, f.filename, a.arch_string FROM location l JOIN files f ON (f.location = l.id) LEFT OUTER JOIN (binaries b JOIN architecture a ON (b.architecture = a.id)) ON (f.id = b.file)' | psql -At | sed 's/|//;s,^/srv/ftp-master.debian.org/ftp,.,' | sort >$ARCHLIST
 
     includedirs () {
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 b58996b1e019b727dc010c27922038b17c22dd11..3effa47741362500138fd6a18df0b8821837b362 100755 (executable)
@@ -46,7 +46,7 @@ from daklib.daklog import Logger
 ################################################################################
 
 Cnf = None
-required_database_schema = 47
+required_database_schema = 48
 
 ################################################################################
 
index 25fd9c6ee578fa215829afea7005e9c78a3b2755..6782c081145944e57c22a1bf718872e00c7106c9 100755 (executable)
@@ -2992,7 +2992,7 @@ class DBConn(object):
                                      backref=backref('binaries', lazy='dynamic')),
                                  extra_sources = relation(DBSource, secondary=self.tbl_extra_src_references,
                                      backref=backref('extra_binary_references', lazy='dynamic')),
-                                 key = relation(BinaryMetadata,
+                                 key = relation(BinaryMetadata, cascade='all',
                                      collection_class=attribute_mapped_collection('key'))),
                 extension = validator)
 
@@ -3164,7 +3164,7 @@ class DBConn(object):
                                  suites = relation(Suite, secondary=self.tbl_src_associations,
                                      backref=backref('sources', lazy='dynamic')),
                                  srcuploaders = relation(SrcUploader),
-                                 key = relation(SourceMetadata,
+                                 key = relation(SourceMetadata, cascade='all',
                                      collection_class=attribute_mapped_collection('key'))),
                extension = validator)
 
index dff1b05f239505ea80125310391ef74333afe7ea..1b698b85e85148a609ff6643cac77809a9badbc9 100755 (executable)
@@ -76,5 +76,18 @@ class MetadataTestCase(DBDakTestCase):
         self.assertEqual('http://debian.org', self.src_hello.metadata[self.homepage])
         self.assertTrue(self.depends not in self.src_hello.metadata)
 
+    def test_delete(self):
+        '''
+        Tests the delete / cascading behaviour.
+        '''
+        self.setup_metadata()
+        self.session.delete(self.bin_hello)
+        # Remove associated binaries because we have no cascading rule for
+        # them.
+        for binary in self.src_hello.binaries:
+            self.session.delete(binary)
+        self.session.delete(self.src_hello)
+        self.session.flush()
+
 if __name__ == '__main__':
     unittest.main()