1
2
3 """
4 Prints out, for every file in the pool, which source package and version it
5 belongs to and for binary packages additionally which arch, binary package
6 and binary package version it has in a standard rfc2822-like format.
7
8 @contact: Debian FTP Master <ftpmaster@debian.org>
9 @copyright: 2009 Peter Palfrader <peter@palfrader.org>
10 @license: GNU General Public License version 2 or later
11 """
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 import sys
35
36 from daklib.dbconn import *
37
38
39
40
42
43
44
45
46 query_sources = """
47 SELECT
48 source.source,
49 source.version,
50 './pool/' || component.name || '/' || files.filename AS path
51 FROM source
52 JOIN dsc_files ON source.id=dsc_files.source
53 JOIN files ON files.id=dsc_files.file
54 JOIN files_archive_map ON files.id = files_archive_map.file_id
55 JOIN component ON files_archive_map.component_id = component.id
56 JOIN files_archive_map fam_dsc ON fam_dsc.file_id=source.file AND fam_dsc.component_id=component.id AND fam_dsc.archive_id=files_archive_map.archive_id
57 WHERE files_archive_map.archive_id = :archive_id
58 ORDER BY source, version, component.id, files.filename
59 """
60
61 query_binaries = """
62 SELECT
63 source.source,
64 source.version,
65 architecture.arch_string AS arch,
66 './pool/' || component.name || '/' || files.filename AS path,
67 binaries.package,
68 binaries.version AS bin_version
69 FROM source
70 JOIN binaries ON source.id=binaries.source
71 JOIN files ON binaries.file=files.id
72 JOIN files_archive_map ON files.id = files_archive_map.file_id
73 JOIN component ON files_archive_map.component_id = component.id
74 JOIN architecture ON architecture.id=binaries.architecture
75 WHERE files_archive_map.archive_id = :archive_id
76 ORDER BY source, version, package, bin_version
77 """
78
79 for row in session.execute(query_sources, {'archive_id': archive.archive_id}).fetchall():
80 (source, version, path) = row
81 print("Path: %s" % path)
82 print("Source: %s" % source)
83 print("Source-Version: %s" % version)
84 print()
85
86 for row in session.execute(query_binaries, {'archive_id': archive.archive_id}).fetchall():
87 (source, version, arch, path, bin, binv) = row
88 print("Path: %s" % path)
89 print("Source: %s" % source)
90 print("Source-Version: %s" % version)
91 print("Architecture: %s" % arch)
92 print("Binary: %s" % bin)
93 print("Binary-Version: %s" % binv)
94 print()
95
96
97
98
100 print("usage: dak make-pkg-file-mapping <archive>")
101 sys.exit(status)
102
103
104
105
107 if len(sys.argv) != 2:
108 usage(1)
109 elif sys.argv[1] in ('-h', '--help'):
110 usage(0)
111
112 archive_name = sys.argv[1]
113
114 session = DBConn().session()
115 archive = session.query(Archive).filter_by(archive_name=archive_name).one()
116 build_mapping(archive, session)
117
118
119
120
121 if __name__ == '__main__':
122 main()
123
124
125
126
127
128