Bug 833882 - Correctly handle non chrome directories when doing l10n-repack. r=gps
☠☠ backed out by 169e0492b03b ☠ ☠
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 23 Jan 2013 23:49:23 +0100
changeset 119622 4c8d59b07d1676d070367e1216e524944ea8dc54
parent 119621 0b1325001df47d23238b550903d1abcac453560c
child 119623 b0dcc10f47687cc6deca6a3149d256231b8f8b99
push id24213
push usermh@glandium.org
push dateWed, 23 Jan 2013 22:49:41 +0000
treeherdermozilla-central@b0dcc10f4768 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs833882
milestone21.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 833882 - Correctly handle non chrome directories when doing l10n-repack. r=gps
toolkit/mozapps/installer/l10n-repack.py
--- a/toolkit/mozapps/installer/l10n-repack.py
+++ b/toolkit/mozapps/installer/l10n-repack.py
@@ -104,43 +104,42 @@ def repack(source, l10n):
 
     # For chrome and non chrome files or directories, store what langpack path
     # corresponds to a package path.
     paths = dict((e.path,
                   l10n_paths[mozpack.path.basedir(e.path, bases)][e.name])
                  for e in entries if isinstance(e, ManifestEntryWithRelPath))
 
     for path in NON_CHROME:
-        for p, f in l10n_finder.find(path):
+        left = set(p for p, f in finder.find(path))
+        right = set(p for p, f in l10n_finder.find(path))
+        for p in right:
             paths[p] = p
+        for p in left - right:
+            paths[p] = None
 
     # Create a new package, with non localized bits coming from the original
     # package, and localized bits coming from the langpack.
     packager = SimplePackager(formatter)
     for p, f in finder:
         if is_manifest(p):
             # Remove localized manifest entries.
             for e in [e for e in f if e.localized]:
                 f.remove(e)
-        base = mozpack.path.basedir(p, paths.keys())
-        if base:
-            # If the path is one that needs a locale replacement, use the
-            # corresponding file from the langpack.
-            subpath = mozpack.path.relpath(p, base)
-            path = mozpack.path.normpath(mozpack.path.join(paths[base],
-                                                           subpath))
-            files = [f for p, f in l10n_finder.find(path)]
-            if len(files) == 0 and base in NON_CHROME:
-                path = path.replace(locale, l10n_locale)
+        if p in paths:
+            path = paths[p]
+            if path:
+                # If the path is one that needs a locale replacement, use the
+                # corresponding file from the langpack.
                 files = [f for p, f in l10n_finder.find(path)]
-            if len(files) == 0:
-                if not base in NON_CHROME:
-                    errors.error("Missing file: %s" % os.path.join(l10n, path))
-            else:
-                packager.add(path, files[0])
+                if not len(files):
+                    if base not in NON_CHROME:
+                        errors.error("Missing file: %s" % os.path.join(l10n, path))
+                else:
+                    packager.add(path, files[0])
         else:
             packager.add(p, f)
 
     # Add localized manifest entries from the langpack.
     l10n_manifests = []
     for base in set(e.base for e in l10n_entries):
         m = ManifestFile(base)
         for e in l10n_entries: