package text,
binary_id integer,
arch integer,
- suite integer,
- component text)""" )
+ suite integer)""" )
c.execute("""CREATE TABLE udeb_contents (
filename text,
package text,
binary_id integer,
suite integer,
- arch integer,
- component text )""" )
+ arch integer)""" )
c.execute("""ALTER TABLE ONLY deb_contents
ADD CONSTRAINT deb_contents_arch_fkey
if event == "INSERT" or event == "UPDATE":
content_data = plpy.execute(plpy.prepare(
- """SELECT s.section, b.package, b.architecture, c.name, 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 files f on b.file=f.id
JOIN location l on l.id=f.location
JOIN section s on s.id=o.section
- JOIN component c on c.id=l.component
WHERE b.id=$1
AND o.suite=$2
""",
["int", "int"]),
[TD["new"]["bin"], TD["new"]["suite"]])[0]
- component_str = "";
- if not content_data["name"] === "main":
- component_str=content_data["name"]+"/"
-
filenames = plpy.execute(plpy.prepare(
"SELECT bc.file FROM bin_contents bc where bc.binary_id=$1",
["int"]),
for filename in filenames:
plpy.execute(plpy.prepare(
"""INSERT INTO deb_contents
- (file,section,package,binary_id,arch,suite,component)
- VALUES($1,$2,$3,$4,$5,$6,$7)""",
- ["text","text","text","int","int","int","text"]),
- [filename["filename"],
+ (filename,section,package,binary_id,arch,suite)
+ VALUES($1,$2,$3,$4,$5,$6)""",
+ ["text","text","text","int","int","int"]),
+ [filename["file"],
content_data["section"],
content_data["package"],
TD["new"]["bin"],
content_data["architecture"],
- TD["new"]["suite"],
- component_str])
+ TD["new"]["suite"]] )
$$ LANGUAGE plpythonu VOLATILE SECURITY DEFINER;
""")
event = TD["event"]
if event == "UPDATE":
- otype = plpy.execute(plpy.prepare("SELECT type from override_type where id=$1",["int"]),TD["new"]["type"] )[0];
+ otype = plpy.execute(plpy.prepare("SELECT type from override_type where id=$1",["int"]),[TD["new"]["type"]] )[0];
if otype["type"].endswith("deb"):
+ section = plpy.execute(plpy.prepare("SELECT section from section where id=$1",["int"]),[TD["new"]["section"]] )[0];
+
table_name = "%s_contents" % otype["type"]
- plpy.execute(plpy.prepare("UPDATE %s set sections=$1" % table_name
- ["text"]),
- [TD["new"]["section"]])
+ plpy.execute(plpy.prepare("UPDATE %s set section=$1 where package=$2 and suite=$3" % table_name,
+ ["text","text","int"]),
+ [section["section"],
+ TD["new"]["package"],
+ TD["new"]["suite"]])
$$ LANGUAGE plpythonu VOLATILE SECURITY DEFINER;
""")