X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fupdate_db.py;h=fc17850f36324ec2ce51935ba9cbd3014aaa120e;hb=9f60404f843f292e4b7e36eeebb97120b35d34d9;hp=62f0889b8abe93713851731ff0051e1f742c3161;hpb=17d6f9dcd28e2698466f4f3396ecf8262aeba283;p=dak.git diff --git a/dak/update_db.py b/dak/update_db.py index 62f0889b..fc17850f 100755 --- a/dak/update_db.py +++ b/dak/update_db.py @@ -46,7 +46,7 @@ from daklib.daklog import Logger ################################################################################ Cnf = None -required_database_schema = 64 +required_database_schema = 96 ################################################################################ @@ -134,7 +134,7 @@ Updates dak's database schema to the lastest version. You should disable crontab self.db = psycopg2.connect(connect_str) - except Exception, e: + except Exception as e: print "FATAL: Failed connect to database (%s)" % str(e) sys.exit(1) @@ -171,7 +171,7 @@ Updates dak's database schema to the lastest version. You should disable crontab message = "updated database schema from %d to %d" % (database_revision, i+1) print message logger.log([message]) - except DBUpdateError, e: + except DBUpdateError as e: # Seems the update did not work. print "Was unable to update database schema from %d to %d." % (database_revision, i+1) print "The error message received was %s" % (e) @@ -190,9 +190,9 @@ Updates dak's database schema to the lastest version. You should disable crontab if not cnf.has_key("Update-DB::Options::%s" % (i)): cnf["Update-DB::Options::%s" % (i)] = "" - arguments = apt_pkg.ParseCommandLine(cnf.Cnf, arguments, sys.argv) + arguments = apt_pkg.parse_commandline(cnf.Cnf, arguments, sys.argv) - options = cnf.SubTree("Update-DB::Options") + options = cnf.subtree("Update-DB::Options") if options["Help"]: self.usage() elif arguments: @@ -205,7 +205,7 @@ Updates dak's database schema to the lastest version. You should disable crontab fcntl.lockf(lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB) else: utils.warn("Lock directory doesn't exist yet - not locking") - except IOError, e: + except IOError as e: if errno.errorcode[e.errno] == 'EACCES' or errno.errorcode[e.errno] == 'EAGAIN': utils.fubar("Couldn't obtain lock; assuming another 'dak process-unchecked' is already running.")