Bug 1147217 - Improve l10n repack error message when locale doesn't contain necessary files. r=mshal, a=NPOTB
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 25 Mar 2015 08:56:44 +0900
changeset 258309 5c4cacd09c9c
parent 258308 5b6180fc4286
child 258310 f208b7bb88ae
push id4641
push userryanvm@gmail.com
push date2015-04-07 01:58 +0000
treeherdermozilla-beta@5c4cacd09c9c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal, NPOTB
bugs1147217
milestone38.0
Bug 1147217 - Improve l10n repack error message when locale doesn't contain necessary files. r=mshal, a=NPOTB
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