X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fdbconn.py;h=7a1fcb225b21330cdea9e63173cabc399aac3cf7;hb=024ac0fc80ccdafc5e0c90e67dd4d3446af625fb;hp=22d20a577707e5efed603727ef4356313a24aeb4;hpb=36f2e4eed512ab916efac0dc2ecb6dc0d503397b;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 22d20a57..7a1fcb22 100644 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -34,13 +34,13 @@ ################################################################################ import apt_pkg +import daklib.daksubprocess import os from os.path import normpath import re import psycopg2 +import subprocess import traceback -import commands -import signal try: # python >= 2.6 @@ -52,7 +52,6 @@ except: from datetime import datetime, timedelta from errno import ENOENT from tempfile import mkstemp, mkdtemp -from subprocess import Popen, PIPE from tarfile import TarFile from inspect import getargspec @@ -498,11 +497,6 @@ __all__.append('BinContents') ################################################################################ -def subprocess_setup(): - # Python installs a SIGPIPE handler by default. This is usually not what - # non-Python subprocesses expect. - signal.signal(signal.SIGPIPE, signal.SIG_DFL) - class DBBinary(ORMObject): def __init__(self, package = None, source = None, version = None, \ maintainer = None, architecture = None, poolfile = None, \ @@ -539,8 +533,8 @@ class DBBinary(ORMObject): package does not contain any regular file. ''' fullpath = self.poolfile.fullpath - dpkg = Popen(['dpkg-deb', '--fsys-tarfile', fullpath], stdout = PIPE, - preexec_fn = subprocess_setup) + dpkg_cmd = ('dpkg-deb', '--fsys-tarfile', fullpath) + dpkg = daklib.daksubprocess.Popen(dpkg_cmd, stdout=subprocess.PIPE) tar = TarFile.open(fileobj = dpkg.stdout, mode = 'r|') for member in tar.getmembers(): if not member.isdir(): @@ -578,7 +572,6 @@ class DBBinary(ORMObject): @rtype: dict @return: fields of the control section as a dictionary. ''' - import apt_pkg stanza = self.read_control() return apt_pkg.TagSection(stanza) @@ -2667,8 +2660,7 @@ class DBConn(object): mapper(Component, self.tbl_component, properties = dict(component_id = self.tbl_component.c.id, - component_name = self.tbl_component.c.name, - suites = relation(Suite, secondary=self.tbl_component_suite)), + component_name = self.tbl_component.c.name), extension = validator) mapper(DBConfig, self.tbl_config, @@ -2817,7 +2809,7 @@ class DBConn(object): acls = relation(ACL, secondary=self.tbl_suite_acl_map, collection_class=set), components = relation(Component, secondary=self.tbl_component_suite, order_by=self.tbl_component.c.ordering, - backref=backref('suite'))), + backref=backref('suites'))), extension = validator) mapper(Uid, self.tbl_uid, @@ -2940,5 +2932,3 @@ class DBConn(object): return session __all__.append('DBConn') - -