Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Unified Diff: mojo/tools/upload_binaries.py

Issue 1300463002: Upload/Download dart_snapshotter (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« mojo/public/tools/BUILD.gn ('K') | « mojo/tools/mopy/paths.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/tools/upload_binaries.py
diff --git a/mojo/tools/upload_binaries.py b/mojo/tools/upload_binaries.py
index d1c25cc9890bce998983f0022311d73dd8bb7b36..954cb2befaf5db7d1eaaf31213b42f4e18cfcc75 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.
+ if config.target_os != Config.OS_LINUX:
+ 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,
+ # 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__":
« mojo/public/tools/BUILD.gn ('K') | « mojo/tools/mopy/paths.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698