X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fdakdb%2Fupdate28.py;h=19c354a7d9fff23b9a6b0b373983f0d8158a149a;hb=95aac686c837c7272472eaf0e601da9b1ac24aed;hp=dc39409a39814c41ff96416e45ff35403c6a5e50;hpb=f634a4b19d5ec88a368914a6068d4d78cde886a2;p=dak.git diff --git a/dak/dakdb/update28.py b/dak/dakdb/update28.py index dc39409a..19c354a7 100755 --- a/dak/dakdb/update28.py +++ b/dak/dakdb/update28.py @@ -34,7 +34,7 @@ from daklib.dak_exceptions import DBUpdateError ################################################################################ -def suites(): +def _suites(): """ return a list of suites to operate on """ @@ -141,8 +141,7 @@ def do_update(self): c.execute("""CREATE INDEX ind_deb_contents_binary ON deb_contents(binary_id);""" ) - - suites = self.suites() + suites = _suites() for suite in [i.lower() for i in suites]: suite_id = DBConn().get_suite_id(suite) @@ -168,7 +167,7 @@ def do_update(self): if event == "INSERT" or event == "UPDATE": content_data = plpy.execute(plpy.prepare( - """SELECT s.section, b.package, b.architecture, ot.type + \"\"\"SELECT s.section, b.package, b.architecture, ot.type FROM override o JOIN override_type ot on o.type=ot.id JOIN binaries b on b.package=o.package @@ -177,14 +176,14 @@ def do_update(self): JOIN section s on s.id=o.section WHERE b.id=$1 AND o.suite=$2 - """, + \"\"\", ["int", "int"]), [TD["new"]["bin"], TD["new"]["suite"]])[0] tablename="%s_contents" % content_data['type'] - plpy.execute(plpy.prepare("""DELETE FROM %s - WHERE package=$1 and arch=$2 and suite=$3""" % tablename, + plpy.execute(plpy.prepare(\"\"\"DELETE FROM %s + WHERE package=$1 and arch=$2 and suite=$3\"\"\" % tablename, ['text','int','int']), [content_data['package'], content_data['architecture'], @@ -197,9 +196,9 @@ def do_update(self): for filename in filenames: plpy.execute(plpy.prepare( - """INSERT INTO %s + \"\"\"INSERT INTO %s (filename,section,package,binary_id,arch,suite) - VALUES($1,$2,$3,$4,$5,$6)""" % tablename, + VALUES($1,$2,$3,$4,$5,$6)\"\"\" % tablename, ["text","text","text","int","int","int"]), [filename["file"], content_data["section"], @@ -234,9 +233,9 @@ $$ LANGUAGE plpythonu VOLATILE SECURITY DEFINER; event = TD["event"] if event == "UPDATE" or event == "INSERT": row = TD["new"] - r = plpy.execute(plpy.prepare( """SELECT 1 from suite_architectures sa + r = plpy.execute(plpy.prepare( \"\"\"SELECT 1 from suite_architectures sa JOIN binaries b ON b.architecture = sa.architecture - WHERE b.id = $1 and sa.suite = $2""", + WHERE b.id = $1 and sa.suite = $2\"\"\", ["int", "int"]), [row["bin"], row["suite"]]) if not len(r):