Coverage for dak/dakdb/update108.py: 100%

1 statements  

« prev     ^ index     » next       coverage.py v7.6.0, created at 2026-08-03 16:46 +0000

1""" 

2Add codename to package_list view 

3 

4@contact: Debian FTP Master <ftpmaster@debian.org> 

5@copyright: 2015, Ansgar Burchardt <ansgar@debian.org> 

6@license: GNU General Public License version 2 or later 

7""" 

8 

9# This program is free software; you can redistribute it and/or modify 

10# it under the terms of the GNU General Public License as published by 

11# the Free Software Foundation; either version 2 of the License, or 

12# (at your option) any later version. 

13 

14# This program is distributed in the hope that it will be useful, 

15# but WITHOUT ANY WARRANTY; without even the implied warranty of 

16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

17# GNU General Public License for more details. 

18 

19# You should have received a copy of the GNU General Public License 

20# along with this program; if not, write to the Free Software 

21# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 

22 

23################################################################################ 

24 

25statements = [ 

26 """DROP VIEW IF EXISTS package_list""", 

27 """ 

28CREATE OR REPLACE VIEW package_list AS 

29SELECT 

30 tmp.package, 

31 tmp.version, 

32 tmp.source, 

33 tmp.source_version, 

34 suite.suite_name AS suite, 

35 suite.codename AS codename, 

36 archive.name AS archive, 

37 component.name AS component, 

38 CASE component.name 

39 WHEN 'main' THEN suite.suite_name 

40 ELSE CONCAT(suite.suite_name, '/', component.name) 

41 END AS display_suite, 

42 tmp.architecture_is_source, 

43 tmp.architecture, 

44 tmp.type 

45FROM 

46 (SELECT 

47 s.source AS package, 

48 s.version AS version, 

49 s.source AS source, 

50 s.version AS source_version, 

51 sa.suite AS suite_id, 

52 TRUE AS architecture_is_source, 

53 'source' AS architecture, 

54 'dsc' AS type, 

55 sc.component_id 

56 FROM source s 

57 JOIN src_associations sa ON s.id = sa.source 

58 JOIN source_component sc ON s.id = sc.source_id AND sa.suite = sc.suite_id 

59 UNION 

60 SELECT 

61 b.package AS package, 

62 b.version AS version, 

63 s.source AS source, 

64 s.version AS source_version, 

65 ba.suite AS suite_id, 

66 FALSE AS architecture_is_source, 

67 a.arch_string AS architecture, 

68 b.type AS type, 

69 bc.component_id 

70 FROM binaries b 

71 JOIN source s ON b.source = s.id 

72 JOIN architecture a ON b.architecture = a.id 

73 JOIN bin_associations ba ON b.id = ba.bin 

74 JOIN binary_component bc ON b.id = bc.binary_id AND ba.suite = bc.suite_id) AS tmp 

75 JOIN suite ON tmp.suite_id = suite.id 

76 JOIN archive ON suite.archive_id = archive.id 

77 JOIN component ON tmp.component_id = component.id 

78""", 

79]