X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Finit_db.py;h=e15d7680799ab0dc0d69e24ebf5743cc249f3ba4;hb=425e44739cd77ffa01294f23e94ae7eabd5f5ec8;hp=bbf682af31df026dc9614fa0a92c5d21d7458cea;hpb=66e52b75f85d576a84bf5b7127b79252378cbad9;p=dak.git diff --git a/dak/init_db.py b/dak/init_db.py index bbf682af..e15d7680 100755 --- a/dak/init_db.py +++ b/dak/init_db.py @@ -23,8 +23,8 @@ import psycopg2, sys import apt_pkg from daklib import utils -from daklib.DBConn import DBConn -from daklib.Config import Config +from daklib.dbconn import DBConn +from daklib.config import Config ################################################################################ @@ -55,7 +55,7 @@ class InitDB(object): self.projectB = projectB def do_archive(self): - """Initalize the archive table.""" + """initalize the archive table.""" c = self.projectB.cursor() c.execute("DELETE FROM archive") @@ -101,9 +101,6 @@ class InitDB(object): c = self.projectB.cursor() c.execute("DELETE FROM location") - loc_add_mixed = "INSERT INTO location (path, archive, type) " + \ - "VALUES (%s, %s, %s)" - loc_add = "INSERT INTO location (path, component, archive, type) " + \ "VALUES (%s, %s, %s, %s)" @@ -114,9 +111,7 @@ class InitDB(object): utils.fubar("Archive '%s' for location '%s' not found." % (location_config["Archive"], location)) location_type = location_config.get("type") - if location_type == "legacy-mixed": - c.execute(loc_add_mixed, [location, archive_id, location_config["type"]]) - elif location_type == "legacy" or location_type == "pool": + if location_type == "pool": for component in self.Cnf.SubTree("Component").List(): component_id = self.projectB.get_component_id(component) c.execute(loc_add, [location, component_id, archive_id, location_type]) @@ -144,12 +139,12 @@ class InitDB(object): origin = sql_get(suite_config, "Origin") description = sql_get(suite_config, "Description") c.execute(suite_add, [suite.lower(), version, origin, description]) - for architecture in self.Cnf.ValueList("Suite::%s::Architectures" % (suite)): + for architecture in self.Cnf.SubTree("Architectures").List(): architecture_id = self.projectB.get_architecture_id (architecture) if architecture_id < 0: utils.fubar("architecture '%s' not found in architecture" - " table for suite %s." - % (architecture, suite)) + " table for suite %s." + % (architecture, suite)) c.execute(sa_add, [architecture_id]) self.projectB.commit()