X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Finit_db.py;h=e15d7680799ab0dc0d69e24ebf5743cc249f3ba4;hb=425e44739cd77ffa01294f23e94ae7eabd5f5ec8;hp=20102cdf72a9a160836f7a748450e0a6977c8dd4;hpb=81d0c91b0d085b66aa40a9e147698f618b825d62;p=dak.git diff --git a/dak/init_db.py b/dak/init_db.py index 20102cdf..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() @@ -183,7 +178,7 @@ class InitDB(object): def do_section(self): """Initalize the section table.""" - c = projectB.cursor() + c = self.projectB.cursor() c.execute("DELETE FROM section") sect_add = "INSERT INTO section (section) VALUES (%s)"