build/appini_header.py
author Ted Mielczarek <ted@mielczarek.org>
Fri, 08 Dec 2017 13:50:17 -0500
changeset 450058 b6656f7bbc861f5879a3d61d007e599c2fbd6190
parent 439065 6074db12d685655fe5692d59471b3c32cc967dc9
child 457276 2d0766c3e7c94d7af3e40b8069aa8e3d6d4071aa
permissions -rw-r--r--
bug 1424323 - remove MOZ_AUTOMATION_UPLOAD_SYMBOLS from in-tree mozconfigs. r=rillian With all of our builds in Taskcluster now, we should never be uploading symbols from build tasks. Unfortunately Windows builds were still doing so. This patch removes MOZ_AUTOMATION_UPLOAD_SYMBOLS from all the in-tree mozconfigs and a few other places so that it should always default off (per moz-automation.mk). The rest of the uploadsymbols bits will be removed once Thunderbird fixes their automation. This patch was mostly autogenerated by running: rg --files-with-matches UPLOAD_SYMBOLS browser/config/mozconfigs/ mobile/android/config/mozconfigs/ | xargs sed -ri '/.*UPLOAD_SYMBOLS.*/d' sed -ri '/.*UPLOAD_SYMBOLS.*/d' build/unix/mozconfig.linux build/mozconfig.win-common build/macosx/local-mozconfig.common build/mozconfig.automation Then mobile/android/config/mozconfigs/common and taskcluster/scripts/builder/build-linux.sh were hand-edited. MozReview-Commit-ID: Cy8kSEodSg4

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

'''Parses a given application.ini file and outputs the corresponding
   StaticXREAppData structure as a C++ header file'''

import ConfigParser
import sys


def main(output, file):
    config = ConfigParser.RawConfigParser()
    config.read(file)
    flags = set()
    try:
        if config.getint('XRE', 'EnableProfileMigrator') == 1:
            flags.add('NS_XRE_ENABLE_PROFILE_MIGRATOR')
    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:remotingname', '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 'Crash Reporter:serverurl' not in appdata:
        appdata['Crash Reporter:serverurl'] = ''

    output.write('''#include "mozilla/XREAppData.h"
             static const mozilla::StaticXREAppData sAppData = {
                 "%(App:vendor)s",
                 "%(App:name)s",
                 "%(App:remotingname)s",
                 "%(App:version)s",
                 "%(App:buildid)s",
                 "%(App:id)s",
                 NULL, // copyright
                 %(flags)s,
                 "%(Gecko:minversion)s",
                 "%(Gecko:maxversion)s",
                 "%(Crash Reporter:serverurl)s",
                 %(App:profile)s
             };''' % appdata)


if __name__ == '__main__':
    if len(sys.argv) != 1:
        main(sys.stdout, sys.argv[1])
    else:
        print >>sys.stderr, "Usage: %s /path/to/application.ini" % sys.argv[0]