michael@0: #!/usr/bin/python michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: from __future__ import unicode_literals michael@0: michael@0: import subprocess michael@0: import sys michael@0: from os import path michael@0: from buildconfig import substs michael@0: michael@0: import logging michael@0: log = logging.getLogger(__name__) michael@0: michael@0: def determine_platform(): michael@0: platform_mapping = {'WINNT': {'x86_64': 'win64', michael@0: 'i686': 'win32'}, michael@0: 'Darwin': {'x86_64': 'macosx-universal', michael@0: 'i386':'macosx-universal'}, michael@0: 'Linux': {'x86_64': 'linux64', michael@0: 'i686': 'linux32'}} michael@0: michael@0: os_type = substs['OS_TARGET'] michael@0: cpu_type = substs['TARGET_CPU'] michael@0: return platform_mapping.get(os_type, {}).get(cpu_type, None) michael@0: michael@0: def main(): michael@0: """ A wrapper script that calls compare-mozconfig.py michael@0: based on the platform that the machine is building for""" michael@0: platform = determine_platform() michael@0: michael@0: if platform is not None: michael@0: python_exe = substs['PYTHON'] michael@0: topsrcdir = substs['top_srcdir'] michael@0: michael@0: # construct paths and args for compare-mozconfig michael@0: browser_dir = path.join(topsrcdir, 'browser') michael@0: script_path = path.join(topsrcdir, 'build/compare-mozconfig/compare-mozconfigs.py') michael@0: whitelist_path = path.join(browser_dir, 'config/mozconfigs/whitelist') michael@0: beta_mozconfig_path = path.join(browser_dir, 'config/mozconfigs', platform, 'beta') michael@0: release_mozconfig_path = path.join(browser_dir, 'config/mozconfigs', platform, 'release') michael@0: nightly_mozconfig_path = path.join(browser_dir, 'config/mozconfigs', platform, 'nightly') michael@0: michael@0: log.info("Comparing beta against nightly mozconfigs") michael@0: ret_code = subprocess.call([python_exe, script_path, '--whitelist', michael@0: whitelist_path, '--no-download', michael@0: platform + ',' + beta_mozconfig_path + michael@0: ',' + nightly_mozconfig_path]) michael@0: michael@0: if ret_code > 0: michael@0: return ret_code michael@0: michael@0: log.info("Comparing release against nightly mozconfigs") michael@0: ret_code = subprocess.call([python_exe, script_path, '--whitelist', michael@0: whitelist_path, '--no-download', michael@0: platform + ',' + release_mozconfig_path + michael@0: ',' + nightly_mozconfig_path]) michael@0: michael@0: return ret_code michael@0: michael@0: if __name__ == '__main__': michael@0: sys.exit(main())