]> git.decadent.org.uk Git - dak.git/blobdiff - dak/update_db.py
Merge commit 'origin/master'
[dak.git] / dak / update_db.py
index 5d5fef477b06972e57bc26b9ec937a283b7840b5..e9dfa9a7a12c0401ab9331f772497c6502090227 100755 (executable)
@@ -1,7 +1,11 @@
 #!/usr/bin/env python
 
-""" Database Update Main Script """
+""" Database Update Main Script
+
+@contact: Debian FTP Master <ftpmaster@debian.org>
 # Copyright (C) 2008  Michael Casadevall <mcasadevall@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
 
 ################################################################################
 
-import psycopg2, sys, fcntl, os
+import psycopg2
+import sys
+import fcntl
+import os
 import apt_pkg
 import time
 import errno
-from daklib import database
+
 from daklib import utils
+from daklib.dak_exceptions import DBUpdateError
 
 ################################################################################
 
 Cnf = None
-projectB = None
-required_database_schema = 3
+required_database_schema = 19
 
 ################################################################################
 
@@ -78,8 +85,6 @@ Updates dak's database schema to the lastest version. You should disable crontab
 ################################################################################
 
     def get_db_rev(self):
-        global projectB
-
         # We keep database revision info the config table
         # Try and access it
 
@@ -136,7 +141,7 @@ Updates dak's database schema to the lastest version. You should disable crontab
             sys.exit(0)
 
         for i in range (database_revision, required_database_schema):
-            print "updating databse schema from " + str(database_revision) + " to " + str(i+1)
+            print "updating database schema from " + str(database_revision) + " to " + str(i+1)
             try:
                 dakdb = __import__("dakdb", globals(), locals(), ['update'+str(i+1)])
                 update_module = getattr(dakdb, "update"+str(i+1))
@@ -151,7 +156,7 @@ Updates dak's database schema to the lastest version. You should disable crontab
 ################################################################################
 
     def init (self):
-        global Cnf, projectB
+        global Cnf
 
         Cnf = utils.get_conf()
         arguments = [('h', "help", "Update-DB::Options::Help")]