X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fdbconn.py;h=5028b7cdd3015818eea5fe866325e71bd5587205;hb=2a068f576aeaa132f49573bbf1fa337a250481d6;hp=551515279e027a2c6743ce5e0ed959633be028ce;hpb=6d8a488ead5007c85e56c0e1055e4faf05206515;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 55151527..5028b7cd 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -39,6 +39,7 @@ import re import psycopg2 import traceback import commands +import signal try: # python >= 2.6 @@ -487,6 +488,11 @@ __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, \ @@ -525,7 +531,8 @@ class DBBinary(ORMObject): package does not contain any regular file. ''' fullpath = self.poolfile.fullpath - dpkg = Popen(['dpkg-deb', '--fsys-tarfile', fullpath], stdout = PIPE) + dpkg = Popen(['dpkg-deb', '--fsys-tarfile', fullpath], stdout = PIPE, + preexec_fn = subprocess_setup) tar = TarFile.open(fileobj = dpkg.stdout, mode = 'r|') for member in tar.getmembers(): if not member.isdir(): @@ -2674,6 +2681,8 @@ def add_dsc_to_db(u, filename, session=None): session.add(df) # Add the src_uploaders to the DB + session.flush() + session.refresh(source) source.uploaders = [source.maintainer] if u.pkg.dsc.has_key("uploaders"): for up in u.pkg.dsc["uploaders"].replace(">, ", ">\t").split("\t"):