build/compare-mozconfig/compare-mozconfigs-wrapper.py

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/build/compare-mozconfig/compare-mozconfigs-wrapper.py	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,63 @@
     1.4 +#!/usr/bin/python
     1.5 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.8 +
     1.9 +from __future__ import unicode_literals
    1.10 +
    1.11 +import subprocess
    1.12 +import sys
    1.13 +from os import path
    1.14 +from buildconfig import substs
    1.15 +
    1.16 +import logging
    1.17 +log = logging.getLogger(__name__)
    1.18 +
    1.19 +def determine_platform():
    1.20 +    platform_mapping = {'WINNT': {'x86_64': 'win64',
    1.21 +                                  'i686': 'win32'},
    1.22 +                        'Darwin': {'x86_64': 'macosx-universal',
    1.23 +                                   'i386':'macosx-universal'},
    1.24 +                        'Linux': {'x86_64': 'linux64',
    1.25 +                                  'i686': 'linux32'}}
    1.26 +
    1.27 +    os_type = substs['OS_TARGET']
    1.28 +    cpu_type = substs['TARGET_CPU']
    1.29 +    return platform_mapping.get(os_type, {}).get(cpu_type, None)
    1.30 +
    1.31 +def main():
    1.32 +    """ A wrapper script that calls compare-mozconfig.py
    1.33 +    based on the platform that the machine is building for"""
    1.34 +    platform = determine_platform()
    1.35 +
    1.36 +    if platform is not None:
    1.37 +        python_exe = substs['PYTHON']
    1.38 +        topsrcdir = substs['top_srcdir']
    1.39 +
    1.40 +        # construct paths and args for compare-mozconfig
    1.41 +        browser_dir = path.join(topsrcdir, 'browser')
    1.42 +        script_path = path.join(topsrcdir, 'build/compare-mozconfig/compare-mozconfigs.py')
    1.43 +        whitelist_path = path.join(browser_dir, 'config/mozconfigs/whitelist')
    1.44 +        beta_mozconfig_path = path.join(browser_dir, 'config/mozconfigs', platform, 'beta')
    1.45 +        release_mozconfig_path = path.join(browser_dir, 'config/mozconfigs', platform, 'release')
    1.46 +        nightly_mozconfig_path = path.join(browser_dir, 'config/mozconfigs', platform, 'nightly')
    1.47 +
    1.48 +        log.info("Comparing beta against nightly mozconfigs")
    1.49 +        ret_code = subprocess.call([python_exe, script_path, '--whitelist',
    1.50 +                                    whitelist_path, '--no-download',
    1.51 +                                    platform + ',' + beta_mozconfig_path +
    1.52 +                                    ',' + nightly_mozconfig_path])
    1.53 +
    1.54 +        if ret_code > 0:
    1.55 +            return ret_code
    1.56 +
    1.57 +        log.info("Comparing release against nightly mozconfigs")
    1.58 +        ret_code = subprocess.call([python_exe, script_path, '--whitelist',
    1.59 +                                    whitelist_path, '--no-download',
    1.60 +                                    platform + ',' + release_mozconfig_path +
    1.61 +                                    ',' + nightly_mozconfig_path])
    1.62 +
    1.63 +        return ret_code
    1.64 +
    1.65 +if __name__ == '__main__':
    1.66 +    sys.exit(main())

mercurial