import psycopg2
import time
from daklib.dak_exceptions import DBUpdateError
+from daklib.config import Config
################################################################################
-def suites():
+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 = [ 'unstable', 'testing' ]
-# suites = Config().SubTree("Suite").List()
-
+ suites = Config().SubTree("Suite").List()
return suites
def arches(cursor, suite):
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)
+
+ 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)
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
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'],
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"],
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):