X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Finit_db.py;h=eac3b6eb0f031dcd657479c53138feb18f008468;hb=e2ae71066cbb134753d7bfceb16e87d0b76dfd6e;hp=928c9a046babd2bfef87f4aa28701227820b3ee4;hpb=7aaaad3135c9164390af5897925660842368660b;p=dak.git diff --git a/dak/init_db.py b/dak/init_db.py index 928c9a04..eac3b6eb 100755 --- a/dak/init_db.py +++ b/dak/init_db.py @@ -21,8 +21,8 @@ import pg, sys import apt_pkg -import dak.lib.database as database -import dak.lib.utils as utils +import daklib.database +import daklib.utils ################################################################################ @@ -49,7 +49,7 @@ def get (c, i): def main (): global Cnf, projectB - Cnf = utils.get_conf() + Cnf = daklib.utils.get_conf() Arguments = [('h',"help","Init-DB::Options::Help")] for i in [ "help" ]: if not Cnf.has_key("Init-DB::Options::%s" % (i)): @@ -62,7 +62,7 @@ def main (): usage() projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"])) - database.init(Cnf, projectB) + daklib.database.init(Cnf, projectB) # archive @@ -104,17 +104,17 @@ def main (): projectB.query("DELETE FROM location") for location in Cnf.SubTree("Location").List(): Location = Cnf.SubTree("Location::%s" % (location)) - archive_id = database.get_archive_id(Location["Archive"]) + archive_id = daklib.database.get_archive_id(Location["Archive"]) type = Location.get("type") if type == "legacy-mixed": projectB.query("INSERT INTO location (path, archive, type) VALUES ('%s', %d, '%s')" % (location, archive_id, Location["type"])) elif type == "legacy" or type == "pool": for component in Cnf.SubTree("Component").List(): - component_id = database.get_component_id(component) + component_id = daklib.database.get_component_id(component) projectB.query("INSERT INTO location (path, component, archive, type) VALUES ('%s', %d, %d, '%s')" % (location, component_id, archive_id, type)) else: - utils.fubar("E: type '%s' not recognised in location %s." % (type, location)) + daklib.utils.fubar("E: type '%s' not recognised in location %s." % (type, location)) projectB.query("COMMIT WORK") # suite @@ -129,9 +129,9 @@ def main (): projectB.query("INSERT INTO suite (suite_name, version, origin, description) VALUES ('%s', %s, %s, %s)" % (suite.lower(), version, origin, description)) for architecture in Cnf.ValueList("Suite::%s::Architectures" % (suite)): - architecture_id = database.get_architecture_id (architecture) + architecture_id = daklib.database.get_architecture_id (architecture) if architecture_id < 0: - utils.fubar("architecture '%s' not found in architecture table for suite %s." % (architecture, suite)) + daklib.utils.fubar("architecture '%s' not found in architecture table for suite %s." % (architecture, suite)) projectB.query("INSERT INTO suite_architectures (suite, architecture) VALUES (currval('suite_id_seq'), %d)" % (architecture_id)) projectB.query("COMMIT WORK")