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 """Script that reads omahaproxy and gsutil to determine a version of the | 6 """Script that reads omahaproxy and gsutil to determine a version of the |
7 sdk_tools bundle to use. | 7 sdk_tools bundle to use. |
8 | 8 |
9 Please note the differences between this script and update_nacl_manifest.py: | 9 Please note the differences between this script and update_nacl_manifest.py: |
10 | 10 |
11 update_sdktools.py is run by a SDK-team developer to assist in updating to a | 11 update_sdktools.py is run by a SDK-team developer to assist in updating to a |
12 new sdk_tools bundle. A file on the developer's hard drive is modified, and | 12 new sdk_tools bundle. A file on the developer's hard drive is modified, and |
13 must be checked in for the new sdk_tools bundle to be used. | 13 must be checked in for the new sdk_tools bundle to be used. |
14 | 14 |
15 update_nacl_manifest.py is customarily run by a cron job, and does not check in | 15 update_nacl_manifest.py is customarily run by a cron job, and does not check in |
16 any changes. Instead it modifies the manifest file in cloud storage.""" | 16 any changes. Instead it modifies the manifest file in cloud storage.""" |
17 | 17 |
18 | 18 |
| 19 import argparse |
19 import collections | 20 import collections |
20 import difflib | 21 import difflib |
21 import json | 22 import json |
22 import optparse | |
23 import re | 23 import re |
24 import sys | 24 import sys |
25 import urllib2 | 25 import urllib2 |
26 | 26 |
27 from manifest_util import DownloadAndComputeHash, DictToJSON | 27 from manifest_util import DownloadAndComputeHash, DictToJSON |
28 from update_nacl_manifest import RealDelegate | 28 from update_nacl_manifest import RealDelegate |
29 | 29 |
30 | 30 |
31 SDK_TOOLS_DESCRIPTION_FORMAT = 'Native Client SDK Tools, revision %d' | 31 SDK_TOOLS_DESCRIPTION_FORMAT = 'Native Client SDK Tools, revision %d' |
32 BUCKET_PATH = 'nativeclient-mirror/nacl/nacl_sdk/' | 32 BUCKET_PATH = 'nativeclient-mirror/nacl/nacl_sdk/' |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 print 'diff %s' % filename | 101 print 'diff %s' % filename |
102 print diff_string | 102 print diff_string |
103 print | 103 print |
104 | 104 |
105 with open(filename, 'w') as stream: | 105 with open(filename, 'w') as stream: |
106 stream.write(new_manifest_string) | 106 stream.write(new_manifest_string) |
107 | 107 |
108 | 108 |
109 def main(args): | 109 def main(args): |
110 parser = optparse.OptionParser(description=__doc__) | 110 parser = argparse.ArgumentParser(description=__doc__) |
111 parser.add_option('-r', '--revision', | 111 parser.add_argument('-r', '--revision', |
112 help='set revision manually, rather than using the latest version') | 112 help='set revision manually, rather than using the latest version') |
113 options, args = parser.parse_args(args) | 113 options = parser.parse_args(args) |
114 if len(args) != 0: | |
115 parser.error('Unexpected args: %s' % ', '.join(args)) | |
116 | 114 |
117 # TODO(binji): http://crbug.com/169047. Rename RealDelegate to something else. | 115 # TODO(binji): http://crbug.com/169047. Rename RealDelegate to something else. |
118 delegate = RealDelegate() | 116 delegate = RealDelegate() |
119 if not options.revision: | 117 if not options.revision: |
120 revision, _ = FindMostRecentSdkTools(delegate) | 118 revision, _ = FindMostRecentSdkTools(delegate) |
121 else: | 119 else: |
122 revision = int(options.revision) | 120 revision = int(options.revision) |
123 | 121 |
124 UpdateManifestFileToRevision('json/naclsdk_manifest0.json', revision) | 122 UpdateManifestFileToRevision('json/naclsdk_manifest0.json', revision) |
125 UpdateManifestFileToRevision('json/naclsdk_manifest2.json', revision) | 123 UpdateManifestFileToRevision('json/naclsdk_manifest2.json', revision) |
126 return 0 | 124 return 0 |
127 | 125 |
128 | 126 |
129 if __name__ == '__main__': | 127 if __name__ == '__main__': |
130 sys.exit(main(sys.argv[1:])) | 128 sys.exit(main(sys.argv[1:])) |
OLD | NEW |