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 dest = "gs://mojo/dart_snapshotter/" + version + "/" + zipfile_name + ".zip" |
| 167 with tempfile.NamedTemporaryFile() as zip_file: |
| 168 with zipfile.ZipFile(zip_file, 'w') as z: |
| 169 dart_snapshotter_path = paths.target_dart_snapshotter_path |
| 170 with open(dart_snapshotter_path) as dart_snapshotter_binary: |
| 171 dart_snapshotter_filename = os.path.basename(dart_snapshotter_path) |
| 172 zipinfo = zipfile.ZipInfo(dart_snapshotter_filename) |
| 173 zipinfo.external_attr = 0777 << 16L |
| 174 compress_type = zipfile.ZIP_DEFLATED |
| 175 zipinfo.compress_type = compress_type |
| 176 zipinfo.date_time = time.gmtime(os.path.getmtime(dart_snapshotter_path)) |
| 177 if verbose: |
| 178 print "zipping %s" % dart_snapshotter_path |
| 179 z.writestr(zipinfo, dart_snapshotter_binary.read()) |
| 180 upload(config, zip_file.name, dest, dry_run, gzip=False) |
| 181 |
| 182 # Update the LATEST file to contain the version of the new binary. |
| 183 latest_file = "gs://mojo/dart_snapshotter/%s/LATEST" % target(config) |
| 184 write_file_to_gs(version, latest_file, config, dry_run) |
| 185 |
| 186 |
157 def upload_app(app_binary_path, config, dry_run): | 187 def upload_app(app_binary_path, config, dry_run): |
158 app_binary_name = os.path.basename(app_binary_path) | 188 app_binary_name = os.path.basename(app_binary_path) |
159 version = Version().version | 189 version = Version().version |
160 gsutil_app_location = ("gs://mojo/services/%s/%s/%s" % | 190 gsutil_app_location = ("gs://mojo/services/%s/%s/%s" % |
161 (target(config), version, app_binary_name)) | 191 (target(config), version, app_binary_name)) |
162 | 192 |
163 # Upload the new binary. | 193 # Upload the new binary. |
164 upload(config, app_binary_path, gsutil_app_location, dry_run) | 194 upload(config, app_binary_path, gsutil_app_location, dry_run) |
165 | 195 |
166 | 196 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 for app in apps_to_upload: | 251 for app in apps_to_upload: |
222 upload_app(app, config, args.dry_run) | 252 upload_app(app, config, args.dry_run) |
223 | 253 |
224 files_to_upload = find_architecture_independent_files(build_directory) | 254 files_to_upload = find_architecture_independent_files(build_directory) |
225 for file_to_upload in files_to_upload: | 255 for file_to_upload in files_to_upload: |
226 upload_file(file_to_upload, config, args.dry_run) | 256 upload_file(file_to_upload, config, args.dry_run) |
227 | 257 |
228 upload_symbols(config, build_directory, | 258 upload_symbols(config, build_directory, |
229 args.symbols_upload_url, args.dry_run) | 259 args.symbols_upload_url, args.dry_run) |
230 | 260 |
| 261 upload_dart_snapshotter(config, args.dry_run, args.verbose) |
| 262 |
231 return 0 | 263 return 0 |
232 | 264 |
233 if __name__ == "__main__": | 265 if __name__ == "__main__": |
234 sys.exit(main()) | 266 sys.exit(main()) |
OLD | NEW |