From d2abbacce6a354ff538275797387570df81ef813 Mon Sep 17 00:00:00 2001 From: Mark Hymers Date: Sun, 9 Aug 2009 01:28:16 +0100 Subject: [PATCH] convert mpfm to new DB API Signed-off-by: Mark Hymers --- dak/make_pkg_file_mapping.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/dak/make_pkg_file_mapping.py b/dak/make_pkg_file_mapping.py index 60c39d3e..f990ab54 100755 --- a/dak/make_pkg_file_mapping.py +++ b/dak/make_pkg_file_mapping.py @@ -34,12 +34,8 @@ and binary package version it has in a standard rfc2822-like format. import os import pg import sys -from daklib import database -from daklib import utils -################################################################################ - -projectB = None #: database connection, pgobject +from daklib.dbconn import * ################################################################################ @@ -74,14 +70,16 @@ def build_mapping(): ORDER BY source, version, package, bin_version """ - for row in projectB.query(query_sources).getresult(): + 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 row in projectB.query(query_binaries).getresult(): + for row in session.execute(query_binaries).fetchall(): (source, version, arch, path, bin, binv) = row print "Path: %s"%path print "Source: %s"%source @@ -94,10 +92,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() ######################################################################################### -- 2.39.5