[releng] [smoketesting] Fix tar not always working



commit e10b2ff9f6685852519fc517b57236932b996359
Author: Vincent Untz <vuntz gnome org>
Date:   Wed Jul 29 04:52:49 2009 +0200

    [smoketesting] Fix tar not always working
    
    This resulted in integrity check failures, and modulesets with not
    enough information since the hash could be missing.
    
    Solution was found on
    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=532570

 tools/smoketesting/convert-to-tarballs.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/tools/smoketesting/convert-to-tarballs.py b/tools/smoketesting/convert-to-tarballs.py
index 06a52a5..92fd75f 100755
--- a/tools/smoketesting/convert-to-tarballs.py
+++ b/tools/smoketesting/convert-to-tarballs.py
@@ -52,6 +52,7 @@ import optparse
 import os
 import os.path
 from posixpath import join as posixjoin # Handy for URLs
+import signal
 import subprocess
 from ftplib import FTP
 from xml.dom import minidom, Node
@@ -388,6 +389,10 @@ class TarballLocator:
         return biggest
 
     def _get_tarball_stats(self, location, filename):
+        def default_sigpipe():
+            "restore default signal handler (http://bugs.python.org/issue1652)"
+            signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+
         MAX_TRIES = 10
         newfile = os.path.join(self.tarballdir, filename)
         hashfile = newfile + '.' + self.hash_algo + 'sum'
@@ -426,7 +431,7 @@ class TarballLocator:
                 time.sleep(1)
                 cmd = ['tar', flags, newfile]
                 devnull = file('/dev/null', 'wb')
-                retcode = subprocess.call(cmd, stdout=devnull)
+                retcode = subprocess.call(cmd, stdout=devnull, preexec_fn=default_sigpipe)
                 devnull.close()
                 if retcode:
                     sys.stderr.write('Integrity check for ' + filename + ' failed!\n')



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]