| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import optparse | 6 import argparse |
| 7 import os | 7 import os |
| 8 import sys | 8 import sys |
| 9 import tarfile | 9 import tarfile |
| 10 | 10 |
| 11 import buildbot_common | 11 import buildbot_common |
| 12 from build_paths import SCRIPT_DIR | 12 from build_paths import SCRIPT_DIR |
| 13 | 13 |
| 14 SDK_BUILD_DIR = SCRIPT_DIR | 14 SDK_BUILD_DIR = SCRIPT_DIR |
| 15 MONO_BUILD_DIR = os.path.join(SDK_BUILD_DIR, 'mono_build') | 15 MONO_BUILD_DIR = os.path.join(SDK_BUILD_DIR, 'mono_build') |
| 16 MONO_DIR = os.path.join(MONO_BUILD_DIR, 'nacl-mono') | 16 MONO_DIR = os.path.join(MONO_BUILD_DIR, 'nacl-mono') |
| 17 | 17 |
| 18 | 18 |
| 19 def main(args): | 19 def main(args): |
| 20 parser = optparse.OptionParser() | 20 parser = argparse.ArgumentParser() |
| 21 parser.add_option('--arch', | 21 parser.add_argument('--arch', |
| 22 help='Target architecture', | 22 help='Target architecture', |
| 23 dest='arch', | 23 dest='arch', |
| 24 default='x86-32') | 24 default='x86-32') |
| 25 parser.add_option('--sdk-revision', | 25 parser.add_argument('--sdk-revision', |
| 26 help='SDK Revision' | 26 help='SDK Revision' |
| 27 ' (default=buildbot revision)', | 27 ' (default=buildbot revision)', |
| 28 dest='sdk_revision', | 28 dest='sdk_revision', |
| 29 default=None) | 29 default=None) |
| 30 parser.add_option('--sdk-url', | 30 parser.add_argument('--sdk-url', |
| 31 help='SDK Download URL', | 31 help='SDK Download URL', |
| 32 dest='sdk_url', | 32 dest='sdk_url', |
| 33 default=None) | 33 default=None) |
| 34 parser.add_option('--install-dir', | 34 parser.add_argument('--install-dir', |
| 35 help='Install Directory', | 35 help='Install Directory', |
| 36 dest='install_dir', | 36 dest='install_dir', |
| 37 default='naclmono') | 37 default='naclmono') |
| 38 (options, args) = parser.parse_args(args[1:]) | 38 options = parser.parse_args(args) |
| 39 | 39 |
| 40 assert sys.platform.find('linux') != -1 | 40 assert sys.platform.find('linux') != -1 |
| 41 | 41 |
| 42 buildbot_revision = os.environ.get('BUILDBOT_REVISION', '') | 42 buildbot_revision = os.environ.get('BUILDBOT_REVISION', '') |
| 43 | 43 |
| 44 build_prefix = options.arch + ' ' | 44 build_prefix = options.arch + ' ' |
| 45 | 45 |
| 46 buildbot_common.BuildStep(build_prefix + 'Clean Old SDK') | 46 buildbot_common.BuildStep(build_prefix + 'Clean Old SDK') |
| 47 buildbot_common.MakeDir(MONO_BUILD_DIR) | 47 buildbot_common.MakeDir(MONO_BUILD_DIR) |
| 48 buildbot_common.RemoveDir(os.path.join(MONO_BUILD_DIR, 'pepper_*')) | 48 buildbot_common.RemoveDir(os.path.join(MONO_BUILD_DIR, 'pepper_*')) |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 # TODO(elijahtaylor,olonho): Re-enable tests on arm when they compile/run. | 133 # TODO(elijahtaylor,olonho): Re-enable tests on arm when they compile/run. |
| 134 if options.arch != 'arm': | 134 if options.arch != 'arm': |
| 135 buildbot_common.BuildStep(build_prefix + 'Test Mono') | 135 buildbot_common.BuildStep(build_prefix + 'Test Mono') |
| 136 buildbot_common.Run(['make', 'check', '-j8'], | 136 buildbot_common.Run(['make', 'check', '-j8'], |
| 137 cwd=os.path.join(SDK_BUILD_DIR, arch_to_output_folder[options.arch])) | 137 cwd=os.path.join(SDK_BUILD_DIR, arch_to_output_folder[options.arch])) |
| 138 | 138 |
| 139 return 0 | 139 return 0 |
| 140 | 140 |
| 141 | 141 |
| 142 if __name__ == '__main__': | 142 if __name__ == '__main__': |
| 143 sys.exit(main(sys.argv)) | 143 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |