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