6 from daklib import database
7 from daklib import utils
9 ################################################################################
11 projectB = None #: database connection, pgobject
13 ################################################################################
15 # Usage: dak make-pkg_file_mapping
17 # Prints out, for every file in the pool, which source package and version it
18 # belongs to and for binary packages additionally which arch, binary package
19 # and binary package version it has in a standard rfc2822-like format.
21 # Copyright 2009 Peter Palfrader <peter@palfrader.org>
23 # This program is free software; you can redistribute it and/or modify
24 # it under the terms of the GNU General Public License as published by
25 # the Free Software Foundation; either version 2 of the License, or
26 # (at your option) any later version.
28 # This program is distributed in the hope that it will be useful,
29 # but WITHOUT ANY WARRANTY; without even the implied warranty of
30 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 # GNU General Public License for more details.
33 # You should have received a copy of the GNU General Public License
34 # along with this program; if not, write to the Free Software
35 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
37 ################################################################################
40 # The ORDER BY is in the queries so that compression of the output works
41 # better. It's the difference between a 9 megabyte bzip2 and a 2.5 mb
48 './pool/' || files.filename AS path
50 JOIN dsc_files ON source.id=dsc_files.source
51 JOIN files ON files.id=dsc_files.file
52 ORDER BY source, version
59 architecture.arch_string AS arch,
60 './pool/' || files.filename AS path,
62 binaries.version AS bin_version
64 JOIN binaries ON source.id=binaries.source
65 JOIN files ON binaries.file=files.id
66 JOIN architecture ON architecture.id=binaries.architecture
67 ORDER BY source, version, package, bin_version
70 for i in projectB.query(query_sources).getresult():
71 (source, version, path) = i
73 print "Source: %s"%source
74 print "Source-Version: %s"%version
77 for i in projectB.query(query_binaries).getresult():
78 (source, version, arch, path, bin, binv) = i
80 print "Source: %s"%source
81 print "Source-Version: %s"%version
82 print "Architecture: %s"%arch
83 print "Binary: %s"%bin
84 print "Binary-Version: %s"%binv
87 ################################################################################
92 Cnf = utils.get_conf()
93 projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]))
96 #########################################################################################
98 if __name__ == '__main__':
104 # vim:set shiftwidth=4: