Bug 1147217 - Improve l10n repack error message when locale doesn't contain necessary files. r=mshal
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 25 Mar 2015 08:56:44 +0900
changeset 266369 b23c836ff69ad985f52c42ce62dc7c870b2ad78c
parent 266368 28e7e3d470f1ad002bafc32526c1673508730104
child 266370 76d1fba1297a15590fc7e1b46eb8efec919a2afd
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal
bugs1147217
milestone39.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 1147217 - Improve l10n repack error message when locale doesn't contain necessary files. r=mshal
python/mozbuild/mozpack/packager/l10n.py
--- a/python/mozbuild/mozpack/packager/l10n.py
+++ b/python/mozbuild/mozpack/packager/l10n.py
@@ -73,20 +73,30 @@ def _repack(app_finder, l10n_finder, cop
     for e in l10n.entries:
         if isinstance(e, ManifestChrome):
             base = mozpack.path.basedir(e.path, app.bases)
             l10n_paths.setdefault(base, {})
             l10n_paths[base][e.name] = e.path
 
     # 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, app.bases)][e.name])
-                 for e in app.entries
-                 if isinstance(e, ManifestEntryWithRelPath))
+    paths = {}
+    for e in app.entries:
+        if isinstance(e, ManifestEntryWithRelPath):
+            base = mozpack.path.basedir(e.path, app.bases)
+            if base not in l10n_paths:
+                errors.fatal("Locale doesn't contain %s/" % base)
+                # Allow errors to accumulate
+                continue
+            if e.name not in l10n_paths[base]:
+                errors.fatal("Locale doesn't have a manifest entry for '%s'" %
+                    e.name)
+                # Allow errors to accumulate
+                continue
+            paths[e.path] = l10n_paths[base][e.name]
 
     for pattern in non_chrome:
         for base in app.bases:
             path = mozpack.path.join(base, pattern)
             left = set(p for p, f in app_finder.find(path))
             right = set(p for p, f in l10n_finder.find(path))
             for p in right:
                 paths[p] = p