Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | #!/usr/bin/python |
michael@0 | 2 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 5 | |
michael@0 | 6 | from __future__ import unicode_literals |
michael@0 | 7 | |
michael@0 | 8 | import subprocess |
michael@0 | 9 | import sys |
michael@0 | 10 | from os import path |
michael@0 | 11 | from buildconfig import substs |
michael@0 | 12 | |
michael@0 | 13 | import logging |
michael@0 | 14 | log = logging.getLogger(__name__) |
michael@0 | 15 | |
michael@0 | 16 | def determine_platform(): |
michael@0 | 17 | platform_mapping = {'WINNT': {'x86_64': 'win64', |
michael@0 | 18 | 'i686': 'win32'}, |
michael@0 | 19 | 'Darwin': {'x86_64': 'macosx-universal', |
michael@0 | 20 | 'i386':'macosx-universal'}, |
michael@0 | 21 | 'Linux': {'x86_64': 'linux64', |
michael@0 | 22 | 'i686': 'linux32'}} |
michael@0 | 23 | |
michael@0 | 24 | os_type = substs['OS_TARGET'] |
michael@0 | 25 | cpu_type = substs['TARGET_CPU'] |
michael@0 | 26 | return platform_mapping.get(os_type, {}).get(cpu_type, None) |
michael@0 | 27 | |
michael@0 | 28 | def main(): |
michael@0 | 29 | """ A wrapper script that calls compare-mozconfig.py |
michael@0 | 30 | based on the platform that the machine is building for""" |
michael@0 | 31 | platform = determine_platform() |
michael@0 | 32 | |
michael@0 | 33 | if platform is not None: |
michael@0 | 34 | python_exe = substs['PYTHON'] |
michael@0 | 35 | topsrcdir = substs['top_srcdir'] |
michael@0 | 36 | |
michael@0 | 37 | # construct paths and args for compare-mozconfig |
michael@0 | 38 | browser_dir = path.join(topsrcdir, 'browser') |
michael@0 | 39 | script_path = path.join(topsrcdir, 'build/compare-mozconfig/compare-mozconfigs.py') |
michael@0 | 40 | whitelist_path = path.join(browser_dir, 'config/mozconfigs/whitelist') |
michael@0 | 41 | beta_mozconfig_path = path.join(browser_dir, 'config/mozconfigs', platform, 'beta') |
michael@0 | 42 | release_mozconfig_path = path.join(browser_dir, 'config/mozconfigs', platform, 'release') |
michael@0 | 43 | nightly_mozconfig_path = path.join(browser_dir, 'config/mozconfigs', platform, 'nightly') |
michael@0 | 44 | |
michael@0 | 45 | log.info("Comparing beta against nightly mozconfigs") |
michael@0 | 46 | ret_code = subprocess.call([python_exe, script_path, '--whitelist', |
michael@0 | 47 | whitelist_path, '--no-download', |
michael@0 | 48 | platform + ',' + beta_mozconfig_path + |
michael@0 | 49 | ',' + nightly_mozconfig_path]) |
michael@0 | 50 | |
michael@0 | 51 | if ret_code > 0: |
michael@0 | 52 | return ret_code |
michael@0 | 53 | |
michael@0 | 54 | log.info("Comparing release against nightly mozconfigs") |
michael@0 | 55 | ret_code = subprocess.call([python_exe, script_path, '--whitelist', |
michael@0 | 56 | whitelist_path, '--no-download', |
michael@0 | 57 | platform + ',' + release_mozconfig_path + |
michael@0 | 58 | ',' + nightly_mozconfig_path]) |
michael@0 | 59 | |
michael@0 | 60 | return ret_code |
michael@0 | 61 | |
michael@0 | 62 | if __name__ == '__main__': |
michael@0 | 63 | sys.exit(main()) |