4 Add views for new obsolete source detection.
6 @contact: Debian FTP Master <ftpmaster@debian.org>
7 @copyright: 2009 Torsten Werner <twerner@debian.org>
8 @license: GNU General Public License version 2 or later
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 print "Add/modify views for obsolete source detection."
33 print "Replace old views."
34 # joins src_associations and source
36 CREATE OR REPLACE VIEW source_suite AS
37 SELECT src_associations.id, source.id AS src, source.source, source.version,
38 src_associations.suite, suite.suite_name, source.install_date
40 JOIN src_associations ON source.id = src_associations.source
41 JOIN suite ON suite.id = src_associations.suite;
43 # joins bin_associations and binaries
45 CREATE OR REPLACE VIEW bin_associations_binaries AS
46 SELECT bin_associations.id, bin_associations.bin, binaries.package,
47 binaries.version, bin_associations.suite, binaries.architecture,
50 JOIN binaries ON bin_associations.bin = binaries.id;
53 print "Grant permissions to views."
54 c.execute("GRANT SELECT ON binfiles_suite_component_arch TO PUBLIC;");
55 c.execute("GRANT SELECT ON srcfiles_suite_component TO PUBLIC;");
56 c.execute("GRANT SELECT ON binaries_suite_arch TO PUBLIC;");
57 c.execute("GRANT SELECT ON newest_all_associations TO PUBLIC;");
58 c.execute("GRANT SELECT ON obsolete_any_by_all_associations TO PUBLIC;");
59 c.execute("GRANT SELECT ON newest_any_associations TO PUBLIC;");
60 c.execute("GRANT SELECT ON obsolete_any_associations TO PUBLIC;");
61 c.execute("GRANT SELECT ON source_suite TO PUBLIC;");
62 c.execute("GRANT SELECT ON newest_source TO PUBLIC;");
63 c.execute("GRANT SELECT ON newest_src_association TO PUBLIC;");
64 c.execute("GRANT SELECT ON any_associations_source TO PUBLIC;");
65 c.execute("GRANT SELECT ON src_associations_src TO PUBLIC;");
66 c.execute("GRANT SELECT ON almost_obsolete_src_associations TO PUBLIC;");
67 c.execute("GRANT SELECT ON obsolete_src_associations TO PUBLIC;");
68 c.execute("GRANT SELECT ON bin_associations_binaries TO PUBLIC;");
69 c.execute("GRANT SELECT ON src_associations_bin TO PUBLIC;");
70 c.execute("GRANT SELECT ON almost_obsolete_all_associations TO PUBLIC;");
71 c.execute("GRANT SELECT ON obsolete_all_associations TO PUBLIC;");
74 c.execute("UPDATE config SET value = '27' WHERE name = 'db_revision'")
77 except psycopg2.InternalError, msg:
79 raise DBUpdateError, "Database error, rollback issued. Error message : %s" % (str(msg))