| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 # Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 # | 3 # |
| 4 # Use of this source code is governed by a BSD-style license | 4 # Use of this source code is governed by a BSD-style license |
| 5 # that can be found in the LICENSE file in the root of the source | 5 # that can be found in the LICENSE file in the root of the source |
| 6 # tree. An additional intellectual property rights grant can be found | 6 # tree. An additional intellectual property rights grant can be found |
| 7 # in the file PATENTS. All contributing project authors may | 7 # in the file PATENTS. All contributing project authors may |
| 8 # be found in the AUTHORS file in the root of the source tree. | 8 # be found in the AUTHORS file in the root of the source tree. |
| 9 | 9 |
| 10 """MB - the Meta-Build wrapper around GYP and GN | 10 """MB - the Meta-Build wrapper around GYP and GN |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 import re | 25 import re |
| 26 import shutil | 26 import shutil |
| 27 import sys | 27 import sys |
| 28 import subprocess | 28 import subprocess |
| 29 import tempfile | 29 import tempfile |
| 30 import traceback | 30 import traceback |
| 31 import urllib2 | 31 import urllib2 |
| 32 | 32 |
| 33 from collections import OrderedDict | 33 from collections import OrderedDict |
| 34 | 34 |
| 35 CHROMIUM_SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname( | 35 SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) |
| 36 os.path.abspath(__file__)))) | 36 CHROMIUM_SRC_DIR = os.path.dirname(os.path.dirname(SCRIPT_DIR)) |
| 37 sys.path = [os.path.join(CHROMIUM_SRC_DIR, 'build')] + sys.path | 37 sys.path = [os.path.join(CHROMIUM_SRC_DIR, 'build')] + sys.path |
| 38 | 38 |
| 39 import gn_helpers | 39 import gn_helpers |
| 40 | 40 |
| 41 | 41 |
| 42 def main(args): | 42 def main(args): |
| 43 mbw = MetaBuildWrapper() | 43 mbw = MetaBuildWrapper() |
| 44 return mbw.Main(args) | 44 return mbw.Main(args) |
| 45 | 45 |
| 46 | 46 |
| 47 class MetaBuildWrapper(object): | 47 class MetaBuildWrapper(object): |
| 48 def __init__(self): | 48 def __init__(self): |
| 49 self.chromium_src_dir = CHROMIUM_SRC_DIR | 49 self.chromium_src_dir = CHROMIUM_SRC_DIR |
| 50 self.default_config = os.path.join(self.chromium_src_dir, 'tools', 'mb', | 50 self.default_config = os.path.join(SCRIPT_DIR, 'mb_config.pyl') |
| 51 'mb_config.pyl') | |
| 52 self.default_isolate_map = os.path.join(self.chromium_src_dir, 'testing', | 51 self.default_isolate_map = os.path.join(self.chromium_src_dir, 'testing', |
| 53 'buildbot', 'gn_isolate_map.pyl') | 52 'buildbot', 'gn_isolate_map.pyl') |
| 54 self.executable = sys.executable | 53 self.executable = sys.executable |
| 55 self.platform = sys.platform | 54 self.platform = sys.platform |
| 56 self.sep = os.sep | 55 self.sep = os.sep |
| 57 self.args = argparse.Namespace() | 56 self.args = argparse.Namespace() |
| 58 self.configs = {} | 57 self.configs = {} |
| 59 self.masters = {} | 58 self.masters = {} |
| 60 self.mixins = {} | 59 self.mixins = {} |
| 61 | 60 |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 if not sub_mixin in self.mixins: | 413 if not sub_mixin in self.mixins: |
| 415 errs.append('Unknown mixin "%s" referenced by mixin "%s".' % | 414 errs.append('Unknown mixin "%s" referenced by mixin "%s".' % |
| 416 (sub_mixin, mixin)) | 415 (sub_mixin, mixin)) |
| 417 referenced_mixins.add(sub_mixin) | 416 referenced_mixins.add(sub_mixin) |
| 418 | 417 |
| 419 # Check that every mixin defined is actually referenced somewhere. | 418 # Check that every mixin defined is actually referenced somewhere. |
| 420 for mixin in self.mixins: | 419 for mixin in self.mixins: |
| 421 if not mixin in referenced_mixins: | 420 if not mixin in referenced_mixins: |
| 422 errs.append('Unreferenced mixin "%s".' % mixin) | 421 errs.append('Unreferenced mixin "%s".' % mixin) |
| 423 | 422 |
| 424 # If we're checking the Chromium config, check that the 'chromium' bots | |
| 425 # which build public artifacts do not include the chrome_with_codecs mixin. | |
| 426 if self.args.config_file == self.default_config: | |
| 427 if 'chromium' in self.masters: | |
| 428 for builder in self.masters['chromium']: | |
| 429 config = self.masters['chromium'][builder] | |
| 430 def RecurseMixins(current_mixin): | |
| 431 if current_mixin == 'chrome_with_codecs': | |
| 432 errs.append('Public artifact builder "%s" can not contain the ' | |
| 433 '"chrome_with_codecs" mixin.' % builder) | |
| 434 return | |
| 435 if not 'mixins' in self.mixins[current_mixin]: | |
| 436 return | |
| 437 for mixin in self.mixins[current_mixin]['mixins']: | |
| 438 RecurseMixins(mixin) | |
| 439 | |
| 440 for mixin in self.configs[config]: | |
| 441 RecurseMixins(mixin) | |
| 442 else: | |
| 443 errs.append('Missing "chromium" master. Please update this ' | |
| 444 'proprietary codecs check with the name of the master ' | |
| 445 'responsible for public build artifacts.') | |
| 446 | |
| 447 if errs: | 423 if errs: |
| 448 raise MBErr(('mb config file %s has problems:' % self.args.config_file) + | 424 raise MBErr(('mb config file %s has problems:' % self.args.config_file) + |
| 449 '\n ' + '\n '.join(errs)) | 425 '\n ' + '\n '.join(errs)) |
| 450 | 426 |
| 451 if print_ok: | 427 if print_ok: |
| 452 self.Print('mb config file %s looks ok.' % self.args.config_file) | 428 self.Print('mb config file %s looks ok.' % self.args.config_file) |
| 453 return 0 | 429 return 0 |
| 454 | 430 |
| 455 def CmdAudit(self): | 431 def CmdAudit(self): |
| 456 """Track the progress of the GYP->GN migration on the bots.""" | 432 """Track the progress of the GYP->GN migration on the bots.""" |
| (...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1562 # Then check to see if the arg contains any metacharacters other than | 1538 # Then check to see if the arg contains any metacharacters other than |
| 1563 # double quotes; if it does, quote everything (including the double | 1539 # double quotes; if it does, quote everything (including the double |
| 1564 # quotes) for safety. | 1540 # quotes) for safety. |
| 1565 if any(a in UNSAFE_FOR_CMD for a in arg): | 1541 if any(a in UNSAFE_FOR_CMD for a in arg): |
| 1566 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) | 1542 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) |
| 1567 return arg | 1543 return arg |
| 1568 | 1544 |
| 1569 | 1545 |
| 1570 if __name__ == '__main__': | 1546 if __name__ == '__main__': |
| 1571 sys.exit(main(sys.argv[1:])) | 1547 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |