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 """Build script to generate a new sdk_tools bundle. | 6 """Build script to generate a new sdk_tools bundle. |
7 | 7 |
8 This script packages the files necessary to generate the SDK updater -- the | 8 This script packages the files necessary to generate the SDK updater -- the |
9 tool users run to download new bundles, update existing bundles, etc. | 9 tool users run to download new bundles, update existing bundles, etc. |
10 """ | 10 """ |
11 | 11 |
| 12 import argparse |
12 import buildbot_common | 13 import buildbot_common |
13 import build_version | 14 import build_version |
14 import glob | 15 import glob |
15 import optparse | |
16 import os | 16 import os |
17 import sys | 17 import sys |
18 | 18 |
19 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | 19 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
20 SDK_SRC_DIR = os.path.dirname(SCRIPT_DIR) | 20 SDK_SRC_DIR = os.path.dirname(SCRIPT_DIR) |
21 SDK_DIR = os.path.dirname(SDK_SRC_DIR) | 21 SDK_DIR = os.path.dirname(SDK_SRC_DIR) |
22 SRC_DIR = os.path.dirname(SDK_DIR) | 22 SRC_DIR = os.path.dirname(SDK_DIR) |
23 NACL_DIR = os.path.join(SRC_DIR, 'native_client') | 23 NACL_DIR = os.path.join(SRC_DIR, 'native_client') |
24 CYGTAR = os.path.join(NACL_DIR, 'build', 'cygtar.py') | 24 CYGTAR = os.path.join(NACL_DIR, 'build', 'cygtar.py') |
25 | 25 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 tarname = os.path.join(out_dir, 'sdk_tools.tgz') | 167 tarname = os.path.join(out_dir, 'sdk_tools.tgz') |
168 files_to_tar = [os.path.relpath(out_file, sdktoolsdir) | 168 files_to_tar = [os.path.relpath(out_file, sdktoolsdir) |
169 for out_file in out_files if out_file.startswith(sdktoolsdir)] | 169 for out_file in out_files if out_file.startswith(sdktoolsdir)] |
170 buildbot_common.RemoveFile(tarname) | 170 buildbot_common.RemoveFile(tarname) |
171 buildbot_common.Run([sys.executable, CYGTAR, '-C', | 171 buildbot_common.Run([sys.executable, CYGTAR, '-C', |
172 os.path.join(out_dir, sdktoolsdir), '-czf', tarname] + files_to_tar) | 172 os.path.join(out_dir, sdktoolsdir), '-czf', tarname] + files_to_tar) |
173 sys.stdout.write('\n') | 173 sys.stdout.write('\n') |
174 | 174 |
175 | 175 |
176 def main(args): | 176 def main(args): |
177 parser = optparse.OptionParser() | 177 parser = argparse.ArgumentParser(description=__doc__) |
178 parser.add_option('-o', '--out', help='output directory', | 178 parser.add_argument('-o', '--out', help='output directory', |
179 dest='out_dir', default=os.path.join(SRC_DIR, 'out')) | 179 dest='out_dir', default=os.path.join(SRC_DIR, 'out')) |
180 parser.add_option('-r', '--revision', help='revision number of this updater', | 180 parser.add_argument('-r', '--revision', dest='revision', default=None, |
181 dest='revision', default=None) | 181 help='revision number of this updater') |
182 parser.add_option('-v', '--verbose', help='verbose output') | 182 parser.add_argument('-v', '--verbose', help='verbose output') |
183 options, args = parser.parse_args(args) | 183 options = parser.parse_args(args) |
184 | 184 |
185 buildbot_common.verbose = options.verbose | 185 buildbot_common.verbose = options.verbose |
186 | 186 |
187 if options.revision: | 187 if options.revision: |
188 options.revision = int(options.revision) | 188 options.revision = int(options.revision) |
189 BuildUpdater(options.out_dir, options.revision) | 189 BuildUpdater(options.out_dir, options.revision) |
190 | 190 |
191 | 191 |
192 if __name__ == '__main__': | 192 if __name__ == '__main__': |
193 sys.exit(main(sys.argv[1:])) | 193 sys.exit(main(sys.argv[1:])) |
OLD | NEW |