X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fdakdb%2Fupdate28.py;h=79b0e8db8250fb3e657edcf9daf9ba4fdb1706a5;hb=066d01be84db56933591117e616ac35203dffd18;hp=1e32f2dd790fc264045d0567efc20f2f027b0198;hpb=a7e3b49a1c74c49c07e930ec752ce00638bebaf9;p=dak.git diff --git a/dak/dakdb/update28.py b/dak/dakdb/update28.py index 1e32f2dd..79b0e8db 100755 --- a/dak/dakdb/update28.py +++ b/dak/dakdb/update28.py @@ -32,6 +32,7 @@ import psycopg2 import time from daklib.dak_exceptions import DBUpdateError from daklib.config import Config +import string ################################################################################ @@ -50,7 +51,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() @@ -141,16 +142,21 @@ 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.fetchone() + suite_id = suiterow[0] arch_list = arches(c, suite_id) arch_list = arches(c, suite_id) + suitestr=string.replace(suite,'-','_'); 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) ) + arch_str = string.replace(arch_str,"-", "_") + c.execute( "CREATE INDEX ind_deb_contents_%s_%s ON deb_contents (arch,suite) WHERE (arch=2 OR arch=%s) AND suite='%s'"%(arch_str,suitestr,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='%s'"%(sname,suitestr,section,suite_id) ) c.execute( """CREATE OR REPLACE FUNCTION update_contents_for_bin_a() RETURNS trigger AS $$