]> git.donarmstrong.com Git - dak.git/commitdiff
Merge commit 'private/master' into process-upload
authorFrank Lichtenheld <djpig@debian.org>
Fri, 30 Oct 2009 11:30:29 +0000 (11:30 +0000)
committerFrank Lichtenheld <djpig@debian.org>
Fri, 30 Oct 2009 11:30:29 +0000 (11:30 +0000)
dak/dakdb/update19.py [new file with mode: 0755]
dak/rm.py
dak/update_db.py
daklib/dbconn.py
daklib/utils.py
templates/rm.bug-close

diff --git a/dak/dakdb/update19.py b/dak/dakdb/update19.py
new file mode 100755 (executable)
index 0000000..49a4dbc
--- /dev/null
@@ -0,0 +1,107 @@
+#!/usr/bin/env python
+# coding=utf8
+
+"""
+Move to using the C version of debversion
+
+@contact: Debian FTP Master <ftpmaster@debian.org>
+@copyright: 2009  Mark Hymers <mhy@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
+import os
+import datetime
+import traceback
+
+from daklib.dak_exceptions import DBUpdateError
+from daklib.config import Config
+
+################################################################################
+
+def do_update(self):
+    print "Converting database to use new C based debversion type"
+
+    try:
+        c = self.db.cursor()
+
+        print "Temporarily converting columns to TEXT"
+        c.execute("ALTER TABLE binaries ALTER COLUMN version TYPE TEXT")
+        c.execute("ALTER TABLE source ALTER COLUMN version TYPE TEXT")
+        c.execute("ALTER TABLE upload_blocks ALTER COLUMN version TYPE TEXT")
+        c.execute("ALTER TABLE pending_content_associations ALTER COLUMN version TYPE TEXT")
+
+        print "Dropping old debversion type"
+        c.execute("DROP OPERATOR >(debversion, debversion)")
+        c.execute("DROP OPERATOR <(debversion, debversion)")
+        c.execute("DROP OPERATOR <=(debversion, debversion)")
+        c.execute("DROP OPERATOR >=(debversion, debversion)")
+        c.execute("DROP OPERATOR =(debversion, debversion)")
+        c.execute("DROP OPERATOR <>(debversion, debversion)")
+        c.execute("DROP FUNCTION debversion_eq(debversion,debversion)")
+        c.execute("DROP FUNCTION debversion_ge(debversion,debversion)")
+        c.execute("DROP FUNCTION debversion_gt(debversion,debversion)")
+        c.execute("DROP FUNCTION debversion_le(debversion,debversion)")
+        c.execute("DROP FUNCTION debversion_lt(debversion,debversion)")
+        c.execute("DROP FUNCTION debversion_ne(debversion,debversion)")
+        c.execute("DROP FUNCTION debversion_compare(debversion,debversion)")
+        c.execute("DROP FUNCTION debversion_revision(debversion)")
+        c.execute("DROP FUNCTION debversion_version(debversion)")
+        c.execute("DROP FUNCTION debversion_epoch(debversion)")
+        c.execute("DROP FUNCTION debversion_split(debversion)")
+        c.execute("DROP TYPE debversion")
+
+        # URGH - kill me now
+        print "Importing new debversion type"
+        f = open('/usr/share/postgresql/8.4/contrib/debversion.sql', 'r')
+        cmds = []
+        curcmd = ''
+        for j in f.readlines():
+            j = j.replace('\t', '').replace('\n', '').split('--')[0]
+            if not j.startswith('--'):
+                jj = j.split(';')
+                curcmd += " " + jj[0]
+                if len(jj) > 1:
+                    for jjj in jj[1:]:
+                        if jjj.strip() == '':
+                            cmds.append(curcmd)
+                            curcmd = ''
+                        else:
+                            curcmd += " " + jjj
+
+        for cm in cmds:
+            c.execute(cm)
+
+        print "Converting columns to new debversion type"
+        c.execute("ALTER TABLE binaries ALTER COLUMN version TYPE debversion")
+        c.execute("ALTER TABLE source ALTER COLUMN version TYPE debversion")
+        c.execute("ALTER TABLE upload_blocks ALTER COLUMN version TYPE debversion")
+        c.execute("ALTER TABLE pending_content_associations ALTER COLUMN version TYPE debversion")
+
+        print "Committing"
+        c.execute("UPDATE config SET value = '19' WHERE name = 'db_revision'")
+        self.db.commit()
+
+    except psycopg2.InternalError, msg:
+        self.db.rollback()
+        raise DBUpdateError, "Unable to apply debversion update 19, rollback issued. Error message : %s" % (str(msg))
index be3e16766e86b94d371f58954b3b1964acb8e208..69b35971db1c0d223d5b560c1e82e9c9804355de 100755 (executable)
--- a/dak/rm.py
+++ b/dak/rm.py
@@ -554,7 +554,10 @@ def main ():
         if carbon_copy:
             Subst["__CC__"] += "\nCc: " + ", ".join(carbon_copy)
         Subst["__SUITE_LIST__"] = suites_list
-        Subst["__SUMMARY__"] = summary
+        summarymail = "%s\n------------------- Reason -------------------\n%s\n" % (summary, Options["Reason"])
+        summarymail += "----------------------------------------------\n"
+        Subst["__SUMMARY__"] = summarymail
+        Subst["__SUBJECT__"] = "Removed package(s) from %s" % (suites_list)
         Subst["__ADMIN_ADDRESS__"] = cnf["Dinstall::MyAdminAddress"]
         Subst["__DISTRO__"] = cnf["Dinstall::MyDistribution"]
         Subst["__WHOAMI__"] = whoami
index 701fdfdc868f28790eaadc184b54deda9a04fbf6..e9dfa9a7a12c0401ab9331f772497c6502090227 100755 (executable)
@@ -44,7 +44,7 @@ from daklib.dak_exceptions import DBUpdateError
 ################################################################################
 
 Cnf = None
-required_database_schema = 18
+required_database_schema = 19
 
 ################################################################################
 
index 72b072c1f83bd9f07627bbf87f6f104d6c66b5bb..45e000d395fbf104a8331004e7a95451114ba1f6 100755 (executable)
@@ -40,8 +40,10 @@ import traceback
 
 from inspect import getargspec
 
+import sqlalchemy
 from sqlalchemy import create_engine, Table, MetaData
 from sqlalchemy.orm import sessionmaker, mapper, relation
+from sqlalchemy import types as sqltypes
 
 # Don't remove this, we re-export the exceptions to scripts which import us
 from sqlalchemy.exc import *
@@ -55,6 +57,22 @@ from textutils import fix_maintainer
 
 ################################################################################
 
+# Patch in support for the debversion field type so that it works during
+# reflection
+
+class DebVersion(sqltypes.Text):
+    def get_col_spec(self):
+        return "DEBVERSION"
+
+sa_major_version = sqlalchemy.__version__[0:3]
+if sa_major_version == "0.5":
+        from sqlalchemy.databases import postgres
+        postgres.ischema_names['debversion'] = DebVersion
+else:
+        raise Exception("dak isn't ported to SQLA versions != 0.5 yet.  See daklib/dbconn.py")
+
+################################################################################
+
 __all__ = ['IntegrityError', 'SQLAlchemyError']
 
 ################################################################################
index 29b6032a434cdba3225083c96e5c5207fde21bc7..0b9fa8416ac33099f71ed828ebdd1f9913fa0208 100755 (executable)
@@ -73,6 +73,9 @@ def dak_getstatusoutput(cmd):
 
     output = "".join(pipe.stdout.readlines())
 
+    if output[-1:] == '\n':
+        output = output[:-1]
+
     ret = pipe.wait()
     if ret is None:
         ret = 0
index 7e521e8afb35e2b734e2b2511e30688b3f5ad487..78addd22b9ce49b21236822dbddae553b822b90b 100644 (file)
@@ -6,7 +6,7 @@ X-Debian: DAK
 MIME-Version: 1.0
 Content-Type: text/plain; charset="utf-8"
 Content-Transfer-Encoding: 8bit
-Subject: Bug#__BUG_NUMBER__: fixed
+Subject: Bug#__BUG_NUMBER__: __SUBJECT__
 
 We believe that the bug you reported is now fixed; the following
 package(s) have been removed from __SUITE_LIST__: