X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fdakdb%2Fupdate28.py;h=bd91231cc6d97fd116832fdd112b58329272de8d;hb=51a1b371b7f8325f26d8eef6d8bd6ce9d8d31a45;hp=19c354a7d9fff23b9a6b0b373983f0d8158a149a;hpb=434a38739a3b037a533725f63d3f0df8ff26103c;p=dak.git diff --git a/dak/dakdb/update28.py b/dak/dakdb/update28.py index 19c354a7..bd91231c 100755 --- a/dak/dakdb/update28.py +++ b/dak/dakdb/update28.py @@ -31,6 +31,7 @@ keep contents of binary packages in tables so we can generate contents.gz files import psycopg2 import time from daklib.dak_exceptions import DBUpdateError +from daklib.config import Config ################################################################################ @@ -38,11 +39,7 @@ def _suites(): """ return a list of suites to operate on """ - if Config().has_key( "%s::%s" %(options_prefix,"Suite")): - suites = utils.split_args(Config()[ "%s::%s" %(options_prefix,"Suite")]) - else: - suites = Config().SubTree("Suite").List() - + suites = Config().SubTree("Suite").List() return suites def arches(cursor, suite): @@ -53,7 +50,7 @@ def arches(cursor, suite): cursor.execute("""SELECT s.architecture, a.arch_string FROM suite_architectures s JOIN architecture a ON (s.architecture=a.id) - WHERE suite = :suite""", {'suite' : suite }) + WHERE suite = '%s'""" % suite) while True: r = cursor.fetchone() @@ -144,16 +141,19 @@ def do_update(self): suites = _suites() for suite in [i.lower() for i in suites]: - suite_id = DBConn().get_suite_id(suite) + + c.execute("SELECT id FROM suite WHERE suite_name ='%s'" % suite ) + suiterow = c.fetchall() + suite_id=suiterow[0] arch_list = arches(c, suite_id) arch_list = arches(c, suite_id) for (arch_id,arch_str) in arch_list: - c.execute( "CREATE INDEX ind_deb_contents_%s_%s ON deb_contents (arch,suite) WHERE (arch=2 OR arch=%d) AND suite=$d"%(arch_str,suite,arch_id,suite_id) ) + c.execute( "CREATE INDEX ind_deb_contents_%s_%s ON deb_contents (arch,suite) WHERE (arch=2 OR arch=%d) AND suite=%d"%(arch_str,suite,arch_id,suite_id) ) for section, sname in [("debian-installer","main"), ("non-free/debian-installer", "nonfree")]: - c.execute( "CREATE INDEX ind_udeb_contents_%s_%s ON udeb_contents (section,suite) WHERE section=%s AND suite=$d"%(sname,suite,section,suite_id) ) + c.execute( "CREATE INDEX ind_udeb_contents_%s_%s ON udeb_contents (section,suite) WHERE section=%s AND suite=%d"%(sname,suite,section,suite_id) ) c.execute( """CREATE OR REPLACE FUNCTION update_contents_for_bin_a() RETURNS trigger AS $$