Bug 1275998 - L10n repacks should use the same compression settings for omni.ja as en-US r=glandium
authorChris AtLee <catlee@mozilla.com>
Fri, 27 May 2016 08:37:09 -0400
changeset 300984 2c039c5822c2dffa2ce160ecb6805ea4328f2e13
parent 300983 b764ee0f465e45476a80af3e434b5a0861cb2a36
child 300985 6a724267cef4428680006137e07bcb4bbac82c81
push id19599
push usercbook@mozilla.com
push dateWed, 08 Jun 2016 10:16:21 +0000
treeherderfx-team@81f4cc3f6f4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1275998
milestone50.0a1
Bug 1275998 - L10n repacks should use the same compression settings for omni.ja as en-US r=glandium MozReview-Commit-ID: DwuERh5MjX7
python/mozbuild/mozpack/packager/l10n.py
python/mozbuild/mozpack/packager/unpack.py
--- a/python/mozbuild/mozpack/packager/l10n.py
+++ b/python/mozbuild/mozpack/packager/l10n.py
@@ -232,18 +232,21 @@ def repack(source, l10n, extra_l10n={}, 
         }
         for base, path in extra_l10n.iteritems():
             finders[base] = UnpackFinder(path)
         l10n_finder = ComposedFinder(finders)
     copier = FileCopier()
     if app_finder.kind == 'flat':
         formatter = FlatFormatter(copier)
     elif app_finder.kind == 'jar':
-        formatter = JarFormatter(copier, optimize=app_finder.optimizedjars)
+        formatter = JarFormatter(copier,
+                                 optimize=app_finder.optimizedjars,
+                                 compress=app_finder.compressed)
     elif app_finder.kind == 'omni':
         formatter = OmniJarFormatter(copier, app_finder.omnijar,
                                      optimize=app_finder.optimizedjars,
+                                     compress=app_finder.compressed,
                                      non_resources=non_resources)
 
     with errors.accumulate():
         _repack(app_finder, l10n_finder, copier, formatter, non_chrome)
     copier.copy(source, skip_if_older=False)
     generate_precomplete(source)
--- a/python/mozbuild/mozpack/packager/unpack.py
+++ b/python/mozbuild/mozpack/packager/unpack.py
@@ -40,16 +40,17 @@ class UnpackFinder(FileFinder):
     '''
     def __init__(self, *args, **kargs):
         FileFinder.__init__(self, *args, **kargs)
         self.files = FileRegistry()
         self.kind = 'flat'
         self.omnijar = None
         self.jarlogs = {}
         self.optimizedjars = False
+        self.compressed = True
 
         jars = set()
 
         for p, f in FileFinder.find(self, '*'):
             # Skip the precomplete file, which is generated at packaging time.
             if p == 'precomplete':
                 continue
             base = mozpath.dirname(p)
@@ -131,16 +132,18 @@ class UnpackFinder(FileFinder):
     def _open_jar(self, path, file):
         '''
         Return a JarReader for the given BaseFile instance, keeping a log of
         the preloaded entries it has.
         '''
         jar = JarReader(fileobj=file.open())
         if jar.is_optimized:
             self.optimizedjars = True
+        if not any(f.compressed for f in jar):
+            self.compressed = False
         if jar.last_preloaded:
             jarlog = jar.entries.keys()
             self.jarlogs[path] = jarlog[:jarlog.index(jar.last_preloaded) + 1]
         return jar
 
     def find(self, path):
         for p in self.files.match(path):
             yield p, self.files[p]