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 | 12 |
13 | 13 |
14 def main(args): | 14 def main(args): |
15 parser = optparse.OptionParser() | 15 parser = argparse.ArgumentParser() |
16 parser.add_option('--install-dir', | 16 parser.add_argument('--install-dir', |
17 help='Install Directory', | 17 help='Install Directory', |
18 dest='install_dir', | 18 dest='install_dir', |
19 default='naclmono') | 19 default='naclmono') |
20 parser.add_option('--tar-path', | 20 parser.add_argument('--tar-path', |
21 help='Tarfile path', | 21 help='Tarfile path', |
22 dest='tar_path', | 22 dest='tar_path', |
23 default='naclmono_%pepperrev%.bz2') | 23 default='naclmono_%pepperrev%.bz2') |
24 parser.add_option('--upload-path', | 24 parser.add_argument('--upload-path', |
25 help='Upload path (nativeclient-mirror/nacl/nacl_sdk/XXX)', | 25 help='Upload path (nativeclient-mirror/nacl/nacl_sdk/XXX)', |
26 dest='upload_path', | 26 dest='upload_path', |
27 default=None) | 27 default=None) |
28 parser.add_option('--pepper-revision', | 28 parser.add_argument('--pepper-revision', |
29 help='Pepper revision', | 29 help='Pepper revision', |
30 dest='pepper_revision', | 30 dest='pepper_revision', |
31 default=None) | 31 default=None) |
32 parser.add_option('--skip-upload', | 32 parser.add_argument('--skip-upload', |
33 help='Skips upload step', | 33 help='Skips upload step', |
34 action="store_true", | 34 action="store_true", |
35 dest='skip_upload') | 35 dest='skip_upload') |
36 (options, args) = parser.parse_args(args) | 36 options = parser.parse_args(args) |
37 | 37 |
38 if not options.upload_path: | 38 if not options.upload_path: |
39 buildbot_common.ErrorExit('--upload-path is required') | 39 buildbot_common.ErrorExit('--upload-path is required') |
40 if not options.pepper_revision: | 40 if not options.pepper_revision: |
41 buildbot_common.ErrorExit('--pepper-revision is required') | 41 buildbot_common.ErrorExit('--pepper-revision is required') |
42 | 42 |
43 options.tar_path = options.tar_path.replace('%pepperrev%', | 43 options.tar_path = options.tar_path.replace('%pepperrev%', |
44 options.pepper_revision) | 44 options.pepper_revision) |
45 | 45 |
46 install_folders = ['bin', 'etc', 'include', 'lib', 'lib32', 'libarm', 'share'] | 46 install_folders = ['bin', 'etc', 'include', 'lib', 'lib32', 'libarm', 'share'] |
(...skipping 10 matching lines...) Expand all Loading... |
57 if tar_file: | 57 if tar_file: |
58 tar_file.close() | 58 tar_file.close() |
59 | 59 |
60 if not options.skip_upload: | 60 if not options.skip_upload: |
61 buildbot_common.Archive(os.path.basename(options.tar_path), | 61 buildbot_common.Archive(os.path.basename(options.tar_path), |
62 'nativeclient-mirror/nacl/nacl_sdk/%s' % options.upload_path, | 62 'nativeclient-mirror/nacl/nacl_sdk/%s' % options.upload_path, |
63 cwd=os.path.dirname(os.path.abspath(options.tar_path))) | 63 cwd=os.path.dirname(os.path.abspath(options.tar_path))) |
64 | 64 |
65 if __name__ == '__main__': | 65 if __name__ == '__main__': |
66 sys.exit(main(sys.argv[1:])) | 66 sys.exit(main(sys.argv[1:])) |
OLD | NEW |