Bug 911154 - Better handle missing variables in application.ini when creating the corresponding header. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Sat, 31 Aug 2013 10:20:37 +0900
changeset 153136 c59d6e7fdee5310c270e82ecde0ed62fb8de1e80
parent 153135 7973c4b7cfd0678a8cd1b61c631bb65d725b943a
child 153137 587ec77a2373eb139f94141d76b6229f602ae5e4
push idunknown
push userunknown
push dateunknown
reviewersgps
bugs911154
milestone26.0a1
Bug 911154 - Better handle missing variables in application.ini when creating the corresponding header. r=gps
build/appini_header.py
--- a/build/appini_header.py
+++ b/build/appini_header.py
@@ -22,16 +22,26 @@ def main(file):
     except: pass
     try:
         if config.getint('Crash Reporter', 'Enabled') == 1:
             flags.add('NS_XRE_ENABLE_CRASH_REPORTER')
     except: pass
     appdata = dict(("%s:%s" % (s, o), config.get(s, o)) for s in config.sections() for o in config.options(s))
     appdata['flags'] = ' | '.join(flags) if flags else '0'
     appdata['App:profile'] = '"%s"' % appdata['App:profile'] if 'App:profile' in appdata else 'NULL'
+    expected = ('App:vendor', 'App:name', 'App:version', 'App:buildid',
+                'App:id', 'Gecko:minversion', 'Gecko:maxversion')
+    missing = [var for var in expected if var not in appdata]
+    if missing:
+        print >>sys.stderr, \
+            "Missing values in %s: %s" % (file, ', '.join(missing))
+        sys.exit(1)
+
+    if not 'Crash Reporter:serverurl' in appdata:
+        appdata['Crash Reporter:serverurl'] = ''
 
     print '''#include "nsXREAppData.h"
              static const nsXREAppData sAppData = {
                  sizeof(nsXREAppData),
                  NULL, // directory
                  "%(App:vendor)s",
                  "%(App:name)s",
                  "%(App:version)s",