Bug 1307301 - Don't attempt to compress compressed files when packing the symbols archive. r=ted
authorChris Manchester <cmanchester@mozilla.com>
Thu, 27 Apr 2017 22:51:19 -0700
changeset 358974 8f6ff09a8a82785d77f7c1f3d6f6686f0a50fe82
parent 358973 fdd37b2a2451cbd91a193de9bacc8ee647a55d68
child 358975 c3141d3077e4db86eca22a16ee579b1dc2993417
push id90420
push usercbook@mozilla.com
push dateThu, 18 May 2017 13:00:03 +0000
treeherdermozilla-inbound@da3f45e77632 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1307301
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1307301 - Don't attempt to compress compressed files when packing the symbols archive. r=ted MozReview-Commit-ID: 542dZflb00G
Makefile.in
python/mozbuild/mozbuild/action/symbols_archive.py
--- a/Makefile.in
+++ b/Makefile.in
@@ -263,17 +263,18 @@ prepsymbolsarchive: recurse_syms
 endif
 
 .PHONY: symbolsfullarchive
 symbolsfullarchive: prepsymbolsarchive
 	$(RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
 	$(call py_action,symbols_archive,$(abspath '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip') \
                                      $(abspath $(DIST)/crashreporter-symbols) \
                                      --exclude '*test*' \
-                                     --exclude '*Test*')
+                                     --exclude '*Test*' \
+                                     --compress '**/*.sym')
 
 .PHONY: symbolsarchive
 symbolsarchive: prepsymbolsarchive
 	$(RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip'
 	$(call py_action,symbols_archive,$(abspath '$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip') \
                                      $(abspath $(DIST)/crashreporter-symbols) \
                                      --include '**/*.sym')
 
--- a/python/mozbuild/mozbuild/action/symbols_archive.py
+++ b/python/mozbuild/mozbuild/action/symbols_archive.py
@@ -5,35 +5,40 @@
 from __future__ import absolute_import, print_function, unicode_literals
 
 import argparse
 import sys
 import os
 
 from mozpack.files import FileFinder
 from mozpack.mozjar import JarWriter
+import mozpack.path as mozpath
 
-def make_archive(archive_name, base, exclude, include):
+def make_archive(archive_name, base, exclude, include, compress):
     finder = FileFinder(base, ignore=exclude)
     if not include:
         include = ['*']
-
+    if not compress:
+        compress = ['**/*.sym']
     archive_basename = os.path.basename(archive_name)
     with open(archive_name, 'wb') as fh:
         with JarWriter(fileobj=fh, optimize=False, compress_level=5) as writer:
             for pat in include:
                 for p, f in finder.find(pat):
                     print('  Adding to "%s":\n\t"%s"' % (archive_basename, p))
-                    writer.add(p.encode('utf-8'), f.read(), mode=f.mode, skip_duplicates=True)
+                    should_compress = any(mozpath.match(p, pat) for pat in compress)
+                    writer.add(p.encode('utf-8'), f.read(), mode=f.mode,
+                               compress=should_compress, skip_duplicates=True)
 
 def main(argv):
     parser = argparse.ArgumentParser(description='Produce a symbols archive')
     parser.add_argument('archive', help='Which archive to generate')
     parser.add_argument('base', help='Base directory to package')
     parser.add_argument('--exclude', default=[], action='append', help='File patterns to exclude')
     parser.add_argument('--include', default=[], action='append', help='File patterns to include')
+    parser.add_argument('--compress', default=[], action='append', help='File patterns to compress')
 
     args = parser.parse_args(argv)
 
-    make_archive(args.archive, args.base, args.exclude, args.include)
+    make_archive(args.archive, args.base, args.exclude, args.include, args.compress)
 
 if __name__ == '__main__':
     main(sys.argv[1:])