X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fdakdb%2Fupdate3.py;h=406cc89b3212a59ead022c4037f29663f2f46932;hb=35cd0972b5e14dc8727403e13fccd30776f3ae02;hp=3a628de088bf47b9da5b906428bd5fa68dfa2730;hpb=c48b357e4838eac6de79b0bd6ee5f8862d049dba;p=dak.git diff --git a/dak/dakdb/update3.py b/dak/dakdb/update3.py index 3a628de0..406cc89b 100755 --- a/dak/dakdb/update3.py +++ b/dak/dakdb/update3.py @@ -1,8 +1,13 @@ #!/usr/bin/env python -""" Database Update Script - Remove unused versioncmp """ -# Copyright (C) 2008 Michael Casadevall -# Copyright (C) 2009 Joerg Jaspert +""" +Remove unused versioncmp + +@contact: Debian FTP Master +@copyright: 2008 Michael Casadevall +@copyright: 2009 Joerg Jaspert +@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 @@ -31,11 +36,16 @@ def do_update(self): try: c = self.db.cursor() - c.execute("DROP FUNCTION versioncmp(text, text);") + try: + # This might not exist on a fresh install, so don't fail + # needlessly + c.execute("DROP FUNCTION versioncmp(text, text);") + except: + pass c.execute("UPDATE config SET value = '3' WHERE name = 'db_revision'") self.db.commit() except psycopg2.ProgrammingError, msg: self.db.rollback() - raise DBUpdateError, "Unable to appy versioncmp removal, rollback issued. Error message : %s" % (str(msg) + raise DBUpdateError, "Unable to appy versioncmp removal, rollback issued. Error message : %s" % (str(msg))