]> git.decadent.org.uk Git - dak.git/commitdiff
Merge remote branch 'stew/contents' into merge
authorJoerg Jaspert <joerg@debian.org>
Sat, 9 Jan 2010 19:41:12 +0000 (20:41 +0100)
committerJoerg Jaspert <joerg@debian.org>
Sat, 9 Jan 2010 19:41:12 +0000 (20:41 +0100)
* stew/contents:
  fix errant middle click
  forgot to save update29
  fix errors found by epydoc
  update29 to get rid of old contents tables

Signed-off-by: Joerg Jaspert <joerg@debian.org>
dak/dakdb/update28.py
dak/dakdb/update29.py [new file with mode: 0644]
daklib/dbconn.py

index dc39409a39814c41ff96416e45ff35403c6a5e50..042a6ac493454cd437f05a561f8c08b58e7b5a50 100755 (executable)
@@ -168,7 +168,7 @@ def do_update(self):
     if event == "INSERT" or event == "UPDATE":
 
        content_data = plpy.execute(plpy.prepare(
-            """SELECT s.section, b.package, b.architecture, ot.type
+            \"\"\"SELECT s.section, b.package, b.architecture, ot.type
             FROM override o
             JOIN override_type ot on o.type=ot.id
             JOIN binaries b on b.package=o.package
@@ -177,14 +177,14 @@ def do_update(self):
             JOIN section s on s.id=o.section
             WHERE b.id=$1
             AND o.suite=$2
-            """,
+            \"\"\",
             ["int", "int"]),
             [TD["new"]["bin"], TD["new"]["suite"]])[0]
 
        tablename="%s_contents" % content_data['type']
 
-       plpy.execute(plpy.prepare("""DELETE FROM %s
-                   WHERE package=$1 and arch=$2 and suite=$3""" % tablename,
+       plpy.execute(plpy.prepare(\"\"\"DELETE FROM %s
+                   WHERE package=$1 and arch=$2 and suite=$3\"\"\" % tablename,
                    ['text','int','int']),
                    [content_data['package'],
                    content_data['architecture'],
@@ -197,9 +197,9 @@ def do_update(self):
 
        for filename in filenames:
            plpy.execute(plpy.prepare(
-               """INSERT INTO %s
+               \"\"\"INSERT INTO %s
                    (filename,section,package,binary_id,arch,suite)
-                   VALUES($1,$2,$3,$4,$5,$6)""" % tablename,
+                   VALUES($1,$2,$3,$4,$5,$6)\"\"\" % tablename,
                ["text","text","text","int","int","int"]),
                [filename["file"],
                 content_data["section"],
@@ -234,9 +234,9 @@ $$ LANGUAGE plpythonu VOLATILE SECURITY DEFINER;
     event = TD["event"]
     if event == "UPDATE" or event == "INSERT":
         row = TD["new"]
-        r = plpy.execute(plpy.prepare( """SELECT 1 from suite_architectures sa
+        r = plpy.execute(plpy.prepare( \"\"\"SELECT 1 from suite_architectures sa
                   JOIN binaries b ON b.architecture = sa.architecture
-                  WHERE b.id = $1 and sa.suite = $2""",
+                  WHERE b.id = $1 and sa.suite = $2\"\"\",
                 ["int", "int"]),
                 [row["bin"], row["suite"]])
         if not len(r):
diff --git a/dak/dakdb/update29.py b/dak/dakdb/update29.py
new file mode 100644 (file)
index 0000000..d25c101
--- /dev/null
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+# coding=utf8
+
+"""
+Adding content fields
+
+@contact: Debian FTP Master <ftpmaster@debian.org>
+@copyright: 2010  Mike O'Connor <stew@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
+import time
+from daklib.dak_exceptions import DBUpdateError
+
+################################################################################
+
+def do_update(self):
+    print "revert update6 since we have a new scheme for contents"
+
+    try:
+        c = self.db.cursor()
+        c.execute("""DROP FUNCTION comma_concat(text, text) CASCADE;""" );
+        c.execute("""DROP TABLE pending_content_associations;""")
+        c.execute("""DROP TABLE content_associations;""")
+        c.execute("""DROP TABLE content_file_names;""")
+        c.execute("""DROP TABLE content_file_paths;""")
+
+        c.execute("UPDATE config SET value = '29' WHERE name = 'db_revision'")
+        self.db.commit()
+
+    except psycopg2.ProgrammingError, msg:
+        self.db.rollback()
+        raise DBUpdateError, "Unable to appy debversion updates, rollback issued. Error message : %s" % (str(msg))
index 88e954fed6879c9ecfff9c576c353ef6dadb7ae7..de055bcd3a4205b661ab2bd440d141fc58476206 100755 (executable)
@@ -2941,7 +2941,7 @@ class DBConn(object):
                                  fingerprint = relation(Fingerprint),
                                  source_files = relation(ChangePendingFile,
                                                          secondary=self.tbl_changes_pending_source_files,
-                                                         backref="pending_sources")))
+                                                         backref="pending_sources"),
                                  files = relation(KnownChangePendingFile, backref="changesfile")))
 
         mapper(KnownChangePendingFile, self.tbl_changes_pending_files,