1 """
2 src_associations_full view, now also including sources for all binaries
3
4 @contact: Debian FTP Master <ftpmaster@debian.org>
5 @copyright: 2013-2014, Ansgar Burchardt <ansgar@debian.org>
6 @license: GNU General Public License version 2 or later
7 """
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 import psycopg2
26 from daklib.dak_exceptions import DBUpdateError
27 from daklib.config import Config
28
29 statements = [
30 """
31 CREATE OR REPLACE VIEW src_associations_full AS
32 SELECT
33 suite,
34 source,
35 BOOL_AND(extra_source) AS extra_source
36 FROM
37 (SELECT sa.suite AS suite, sa.source AS source, FALSE AS extra_source
38 FROM src_associations sa
39 UNION
40 SELECT ba.suite AS suite, esr.src_id AS source_id, TRUE AS extra_source
41 FROM extra_src_references esr
42 JOIN bin_associations ba ON esr.bin_id = ba.bin
43 UNION
44 SELECT ba.suite AS suite, b.source AS source, TRUE AS extra_source
45 FROM bin_associations ba
46 JOIN binaries b ON ba.bin = b.id)
47 AS tmp
48 GROUP BY suite, source
49 """,
50 """
51 COMMENT ON VIEW src_associations_full IS
52 'all source packages for a suite, including sources for all binaries and those referenced by Built-Using'
53 """,
54 ]
55
56
57
58
60 print(__doc__)
61 try:
62 cnf = Config()
63
64 c = self.db.cursor()
65
66 for stmt in statements:
67 c.execute(stmt)
68
69 c.execute("UPDATE config SET value = '102' WHERE name = 'db_revision'")
70 self.db.commit()
71
72 except psycopg2.ProgrammingError as msg:
73 self.db.rollback()
74 raise DBUpdateError('Unable to apply sick update 102, rollback issued. Error message: {0}'.format(msg))
75