Index: mojo/tools/upload_binaries.py |
diff --git a/mojo/tools/upload_binaries.py b/mojo/tools/upload_binaries.py |
index d1c25cc9890bce998983f0022311d73dd8bb7b36..77fc426cab5c43ab0cf6812c5c54c06b6569025c 100755 |
--- a/mojo/tools/upload_binaries.py |
+++ b/mojo/tools/upload_binaries.py |
@@ -154,6 +154,39 @@ def upload_shell(config, dry_run, verbose): |
write_file_to_gs(version, latest_file, config, dry_run) |
+def upload_dart_snapshotter(config, dry_run, verbose): |
+ # Only built for Linux and Mac. |
+ if not config.target_os in [Config.OS_LINUX, Config.OS_MAC]: |
+ return |
+ |
+ paths = Paths(config) |
+ zipfile_name = target(config) |
+ version = Version().version |
+ |
+ # Upload the binary. |
+ # 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,
|
+ # e.g., gs://mojo/dart_snapshotter/linux-x64/<version>/dart_snapshotter.zip. |
+ dest = "gs://mojo/dart_snapshotter/" + version + "/" + zipfile_name + ".zip" |
+ with tempfile.NamedTemporaryFile() as zip_file: |
+ with zipfile.ZipFile(zip_file, 'w') as z: |
+ dart_snapshotter_path = paths.target_dart_snapshotter_path |
+ with open(dart_snapshotter_path) as dart_snapshotter_binary: |
+ dart_snapshotter_filename = os.path.basename(dart_snapshotter_path) |
+ zipinfo = zipfile.ZipInfo(dart_snapshotter_filename) |
+ zipinfo.external_attr = 0777 << 16L |
+ compress_type = zipfile.ZIP_DEFLATED |
+ zipinfo.compress_type = compress_type |
+ zipinfo.date_time = time.gmtime(os.path.getmtime(dart_snapshotter_path)) |
+ if verbose: |
+ print "zipping %s" % dart_snapshotter_path |
+ z.writestr(zipinfo, dart_snapshotter_binary.read()) |
+ upload(config, zip_file.name, dest, dry_run, gzip=False) |
+ |
+ # Update the LATEST file to contain the version of the new binary. |
+ latest_file = "gs://mojo/dart_snapshotter/%s/LATEST" % target(config) |
+ write_file_to_gs(version, latest_file, config, dry_run) |
+ |
+ |
def upload_app(app_binary_path, config, dry_run): |
app_binary_name = os.path.basename(app_binary_path) |
version = Version().version |
@@ -228,6 +261,8 @@ def main(): |
upload_symbols(config, build_directory, |
args.symbols_upload_url, args.dry_run) |
+ upload_dart_snapshotter(config, args.dry_run, args.verbose) |
+ |
return 0 |
if __name__ == "__main__": |