X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fdbconn.py;h=7a1fcb225b21330cdea9e63173cabc399aac3cf7;hb=2b8ba2f36f49583328b699763ecc2e9702deab72;hp=a900a0e6a41564b6d7d402bada53a17c9662a628;hpb=84a18dba74a0fcaa92a007a897f8b0e3de242df6;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index a900a0e6..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) @@ -2939,5 +2932,3 @@ class DBConn(object): return session __all__.append('DBConn') - -