X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fcontents.py;h=449fb88e126fdc13038c1fd512edf0631bfff060;hb=714b2bd26b5a5ba4c205de7d4fe51408edf3c14a;hp=0fa52df2823e1950a0262c26e81ff8a41d52b197;hpb=e49bd9ecb3469061ff51971dc562745c6adf6f5a;p=dak.git diff --git a/daklib/contents.py b/daklib/contents.py index 0fa52df2..449fb88e 100755 --- a/daklib/contents.py +++ b/daklib/contents.py @@ -34,6 +34,7 @@ from subprocess import Popen, PIPE, check_call from tempfile import mkdtemp import os.path +import signal class BinaryContentsWriter(object): ''' @@ -284,7 +285,7 @@ def binary_helper(suite_id, arch_id, overridetype_id, component_id = None): This function is called in a new subprocess and multiprocessing wants a top level function. ''' - session = DBConn().session() + session = DBConn().session(work_mem = 1000) suite = Suite.get(suite_id, session) architecture = Architecture.get(arch_id, session) overridetype = OverrideType.get(overridetype_id, session) @@ -303,7 +304,7 @@ def source_helper(suite_id, component_id): This function is called in a new subprocess and multiprocessing wants a top level function. ''' - session = DBConn().session() + session = DBConn().session(work_mem = 1000) suite = Suite.get(suite_id, session) component = Component.get(component_id, session) log_message = [suite.suite_name, 'source', component.component_name] @@ -426,6 +427,11 @@ def binary_scan_helper(binary_id): scanner.scan() +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 UnpackedSource(object): ''' UnpackedSource extracts a source package into a temporary location and @@ -435,13 +441,11 @@ class UnpackedSource(object): ''' The dscfilename is a name of a DSC file that will be extracted. ''' - self.root_directory = os.path.join(mkdtemp(), 'root') - command = ('dpkg-source', '--no-copy', '--no-check', '-x', dscfilename, - self.root_directory) - # dpkg-source does not have a --quiet option - devnull = open(os.devnull, 'w') - check_call(command, stdout = devnull, stderr = devnull) - devnull.close() + temp_directory = mkdtemp(dir = Config()['Dir::TempPath']) + self.root_directory = os.path.join(temp_directory, 'root') + command = ('dpkg-source', '--no-copy', '--no-check', '-q', '-x', + dscfilename, self.root_directory) + check_call(command, preexec_fn = subprocess_setup) def get_root_directory(self): '''