X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fcontents.py;h=a5950524e274fef14f049f28426ac76da9725528;hb=c8dddd950800e46332cd82ed8ad8706a88597886;hp=7e9aaf2e1689c0ece950db4d420ab1d22ce80dcb;hpb=679f792474b393494a0560f029952079281f1ef0;p=dak.git diff --git a/daklib/contents.py b/daklib/contents.py index 7e9aaf2e..a5950524 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): ''' @@ -306,7 +307,7 @@ def source_helper(suite_id, component_id): session = DBConn().session() suite = Suite.get(suite_id, session) component = Component.get(component_id, session) - log_message = [suite.suite_name, component.component_name] + log_message = [suite.suite_name, 'source', component.component_name] contents_writer = SourceContentsWriter(suite, component) contents_writer.write_file() return log_message @@ -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 @@ -436,12 +442,9 @@ 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() + 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): '''