OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 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 """Tool to roll Chromium into Mojo. See: | 6 """Tool to roll Chromium into Mojo. See: |
7 https://github.com/domokit/mojo/wiki/Rolling-code-between-chromium-and-mojo#chro mium---mojo-updates | 7 https://github.com/domokit/mojo/wiki/Rolling-code-between-chromium-and-mojo#chro mium---mojo-updates |
8 """ | 8 """ |
9 | 9 |
10 import argparse | 10 import argparse |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 if verbose: | 147 if verbose: |
148 print "zipping %s" % shell_path | 148 print "zipping %s" % shell_path |
149 z.writestr(zipinfo, shell_binary.read()) | 149 z.writestr(zipinfo, shell_binary.read()) |
150 upload(config, zip_file.name, dest, dry_run, gzip=False) | 150 upload(config, zip_file.name, dest, dry_run, gzip=False) |
151 | 151 |
152 # Update the LATEST file to contain the version of the new binary. | 152 # Update the LATEST file to contain the version of the new binary. |
153 latest_file = "gs://mojo/shell/%s/LATEST" % target(config) | 153 latest_file = "gs://mojo/shell/%s/LATEST" % target(config) |
154 write_file_to_gs(version, latest_file, config, dry_run) | 154 write_file_to_gs(version, latest_file, config, dry_run) |
155 | 155 |
156 | 156 |
157 def upload_dart_snapshotter(config, dry_run, verbose): | |
158 # Only built for Linux and Mac. | |
159 if not config.target_os in [Config.OS_LINUX, Config.OS_MAC]: | |
160 return | |
161 | |
162 paths = Paths(config) | |
163 zipfile_name = target(config) | |
164 version = Version().version | |
165 | |
166 # Upload the binary. | |
167 # TODO(blundell): Change this to be in the same structure as the LATEST files, | |
jamesr
2015/08/17 22:10:16
is colin going to do something about this TODO? wh
zra
2015/08/17 22:51:27
Copied from above. I'm not sure what this is for,
| |
168 # e.g., gs://mojo/dart_snapshotter/linux-x64/<version>/dart_snapshotter.zip. | |
169 dest = "gs://mojo/dart_snapshotter/" + version + "/" + zipfile_name + ".zip" | |
170 with tempfile.NamedTemporaryFile() as zip_file: | |
171 with zipfile.ZipFile(zip_file, 'w') as z: | |
172 dart_snapshotter_path = paths.target_dart_snapshotter_path | |
173 with open(dart_snapshotter_path) as dart_snapshotter_binary: | |
174 dart_snapshotter_filename = os.path.basename(dart_snapshotter_path) | |
175 zipinfo = zipfile.ZipInfo(dart_snapshotter_filename) | |
176 zipinfo.external_attr = 0777 << 16L | |
177 compress_type = zipfile.ZIP_DEFLATED | |
178 zipinfo.compress_type = compress_type | |
179 zipinfo.date_time = time.gmtime(os.path.getmtime(dart_snapshotter_path)) | |
180 if verbose: | |
181 print "zipping %s" % dart_snapshotter_path | |
182 z.writestr(zipinfo, dart_snapshotter_binary.read()) | |
183 upload(config, zip_file.name, dest, dry_run, gzip=False) | |
184 | |
185 # Update the LATEST file to contain the version of the new binary. | |
186 latest_file = "gs://mojo/dart_snapshotter/%s/LATEST" % target(config) | |
187 write_file_to_gs(version, latest_file, config, dry_run) | |
188 | |
189 | |
157 def upload_app(app_binary_path, config, dry_run): | 190 def upload_app(app_binary_path, config, dry_run): |
158 app_binary_name = os.path.basename(app_binary_path) | 191 app_binary_name = os.path.basename(app_binary_path) |
159 version = Version().version | 192 version = Version().version |
160 gsutil_app_location = ("gs://mojo/services/%s/%s/%s" % | 193 gsutil_app_location = ("gs://mojo/services/%s/%s/%s" % |
161 (target(config), version, app_binary_name)) | 194 (target(config), version, app_binary_name)) |
162 | 195 |
163 # Upload the new binary. | 196 # Upload the new binary. |
164 upload(config, app_binary_path, gsutil_app_location, dry_run) | 197 upload(config, app_binary_path, gsutil_app_location, dry_run) |
165 | 198 |
166 | 199 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 for app in apps_to_upload: | 254 for app in apps_to_upload: |
222 upload_app(app, config, args.dry_run) | 255 upload_app(app, config, args.dry_run) |
223 | 256 |
224 files_to_upload = find_architecture_independent_files(build_directory) | 257 files_to_upload = find_architecture_independent_files(build_directory) |
225 for file_to_upload in files_to_upload: | 258 for file_to_upload in files_to_upload: |
226 upload_file(file_to_upload, config, args.dry_run) | 259 upload_file(file_to_upload, config, args.dry_run) |
227 | 260 |
228 upload_symbols(config, build_directory, | 261 upload_symbols(config, build_directory, |
229 args.symbols_upload_url, args.dry_run) | 262 args.symbols_upload_url, args.dry_run) |
230 | 263 |
264 upload_dart_snapshotter(config, args.dry_run, args.verbose) | |
265 | |
231 return 0 | 266 return 0 |
232 | 267 |
233 if __name__ == "__main__": | 268 if __name__ == "__main__": |
234 sys.exit(main()) | 269 sys.exit(main()) |
OLD | NEW |