X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fmake_pkg_file_mapping.py;h=38a6bec2aeb65eba5edbfb113181f68195b2cc73;hb=1c35448b880358d020e81339657e3435fdda9434;hp=1eb0f899740e5a21ef0ced357115af2aed937664;hpb=21ec05fb5866d1adf8f1a455ecdcf740f450ada2;p=dak.git diff --git a/dak/make_pkg_file_mapping.py b/dak/make_pkg_file_mapping.py index 1eb0f899..38a6bec2 100755 --- a/dak/make_pkg_file_mapping.py +++ b/dak/make_pkg_file_mapping.py @@ -1,25 +1,15 @@ #!/usr/bin/env python -import os -import pg -import sys -from daklib import database -from daklib import utils - -################################################################################ - -projectB = None #: database connection, pgobject +""" +Prints out, for every file in the pool, which source package and version it +belongs to and for binary packages additionally which arch, binary package +and binary package version it has in a standard rfc2822-like format. -################################################################################ +@contact: Debian FTP Master +@copyright: 2009 Peter Palfrader +@license: GNU General Public License version 2 or later +""" -# Usage: dak make-pkg_file_mapping -# -# Prints out, for every file in the pool, which source package and version it -# belongs to and for binary packages additionally which arch, binary package -# and binary package version it has in a standard rfc2822-like format. - -# Copyright 2009 Peter Palfrader -# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -34,6 +24,18 @@ projectB = None #: database connection, pgobject # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +################################################################################ + +# it's crypto -- think of it like magic if you like. + +################################################################################ + +import os +import sys + +from daklib.dbconn import * + ################################################################################ def build_mapping(): @@ -67,15 +69,17 @@ def build_mapping(): ORDER BY source, version, package, bin_version """ - for i in projectB.query(query_sources).getresult(): - (source, version, path) = i + session = DBConn().session() + + for row in session.execute(query_sources).fetchall(): + (source, version, path) = row print "Path: %s"%path print "Source: %s"%source print "Source-Version: %s"%version print - for i in projectB.query(query_binaries).getresult(): - (source, version, arch, path, bin, binv) = i + for row in session.execute(query_binaries).fetchall(): + (source, version, arch, path, bin, binv) = row print "Path: %s"%path print "Source: %s"%source print "Source-Version: %s"%version @@ -87,10 +91,7 @@ def build_mapping(): ################################################################################ def main(): - global projectB - - Cnf = utils.get_conf() - projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"])) + DBConn() build_mapping() #########################################################################################