bug 385792 - compress pdb files in symbol store. r=bsmedberg
authorTed Mielczarek <ted.mielczarek@gmail.com>
Fri, 23 Jan 2009 07:40:27 -0500
changeset 24124 db2cabebef39431ca696b96b39a43c8342be7874
parent 24123 28d2865963fcc5ea51a39a252cfcbdd097cdefa5
child 24125 79dc3d98b6a2a9ffd6f9c547b7a1a91f87900fd8
push idunknown
push userunknown
push dateunknown
reviewersbsmedberg
bugs385792
milestone1.9.2a1pre
bug 385792 - compress pdb files in symbol store. r=bsmedberg
toolkit/crashreporter/tools/symbolstore.py
--- a/toolkit/crashreporter/tools/symbolstore.py
+++ b/toolkit/crashreporter/tools/symbolstore.py
@@ -53,16 +53,17 @@
 #                    cpu architecture in <archs> (only on OS X)
 #     -s <srcdir>  : Use <srcdir> as the top source directory to
 #                    generate relative filenames.
 
 import sys
 import os
 import re
 import shutil
+from subprocess import call, STDOUT
 from optparse import OptionParser
 
 # Utility classes
 
 class VCSFileInfo:
     """ A base class for version-controlled file information. Ensures that the
         following attributes are generated only once (successfully):
 
@@ -585,21 +586,29 @@ class Dumper_Win32(Dumper):
         # Cache the corrected version to avoid future filesystem hits.
         self.fixedFilenameCaseCache[file] = result
         return result
 
     def CopyDebug(self, file, debug_file, guid):
         rel_path = os.path.join(debug_file,
                                 guid,
                                 debug_file).replace("\\", "/")
-        print rel_path
         full_path = os.path.normpath(os.path.join(self.symbol_path,
                                                   rel_path))
         shutil.copyfile(file, full_path)
-        pass
+        # try compressing it
+        compressed_file = os.path.splitext(full_path)[0] + ".pd_"
+        # ignore makecab's output
+        success = call(["makecab.exe", full_path, compressed_file],
+                       stdout=open("NUL:","w"), stderr=STDOUT)
+        if success == 0 and os.path.exists(compressed_file):
+            os.unlink(full_path)
+            print os.path.splitext(rel_path)[0] + ".pd_"
+        else:
+            print rel_path
         
     def SourceServerIndexing(self, debug_file, guid, sourceFileStream, vcs_root):
         # Creates a .pdb.stream file in the mozilla\objdir to be used for source indexing
         cwd = os.getcwd()
         streamFilename = debug_file + ".stream"
         stream_output_path = os.path.join(cwd, streamFilename)
         # Call SourceIndex to create the .stream file
         result = SourceIndex(sourceFileStream, stream_output_path, vcs_root)