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

Side by Side Diff: mojo/services/upload_service.py

Issue 956593003: Publish location files for Mojo binaries uploaded from Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 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 import argparse 6 import argparse
7 import imp 7 import imp
8 import os 8 import os
9 import subprocess 9 import subprocess
10 import sys 10 import sys
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 gsutil_cp(mojom_zip_file.name, dest, dry_run) 67 gsutil_cp(mojom_zip_file.name, dest, dry_run)
68 68
69 69
70 def upload_binary(service, binary_dir, platform, dry_run): 70 def upload_binary(service, binary_dir, platform, dry_run):
71 dest_dir = "gs://mojo/" + service + "/" + version + "/" + platform + "/" 71 dest_dir = "gs://mojo/" + service + "/" + version + "/" + platform + "/"
72 should_zip = service in SERVICES_WITH_ZIPPED_BINARIES 72 should_zip = service in SERVICES_WITH_ZIPPED_BINARIES
73 binary_name = service + ".mojo" 73 binary_name = service + ".mojo"
74 absolute_binary_path = os.path.join(root_path, binary_dir, binary_name) 74 absolute_binary_path = os.path.join(root_path, binary_dir, binary_name)
75 75
76 if not should_zip: 76 if not should_zip:
77 # Upload the binary.
77 dest = dest_dir + binary_name 78 dest = dest_dir + binary_name
78 gsutil_cp(absolute_binary_path, dest, dry_run) 79 gsutil_cp(absolute_binary_path, dest, dry_run)
80
81 # Update the pointer to the service's location to point to the
82 # newly-uploaded binary.
83 service_location = dest.replace("gs://", "https://storage.googleapis.com/")
84 location_file = ("gs://mojo/services/" + platform + "/" + service +
85 "_location")
jamesr 2015/02/24 22:07:19 what information are we uploading here that isn't
blundell 2015/02/25 13:07:31 gs://mojo/services/<platform>/<service>_location i
86 with tempfile.NamedTemporaryFile() as tmp:
87 tmp.write(service_location)
88 tmp.flush()
89 gsutil_cp(tmp.name, location_file, dry_run)
79 return 90 return
80 91
81 # Zip the binary before uploading it to the cloud. 92 # Zip the binary before uploading it to the cloud.
82 dest = dest_dir + binary_name + ".zip" 93 dest = dest_dir + binary_name + ".zip"
83 with tempfile.NamedTemporaryFile() as binary_zip_file: 94 with tempfile.NamedTemporaryFile() as binary_zip_file:
84 with zipfile.ZipFile(binary_zip_file, 'w') as z: 95 with zipfile.ZipFile(binary_zip_file, 'w') as z:
85 with open(absolute_binary_path) as service_binary: 96 with open(absolute_binary_path) as service_binary:
86 zipinfo = zipfile.ZipInfo(binary_name) 97 zipinfo = zipfile.ZipInfo(binary_name)
87 zipinfo.external_attr = 0o777 << 16 98 zipinfo.external_attr = 0o777 << 16
88 zipinfo.compress_type = zipfile.ZIP_DEFLATED 99 zipinfo.compress_type = zipfile.ZIP_DEFLATED
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 "android-arm", args.dry_run) 139 "android-arm", args.dry_run)
129 140
130 if not args.dry_run: 141 if not args.dry_run:
131 print "Uploaded artifacts for version %s" % (version, ) 142 print "Uploaded artifacts for version %s" % (version, )
132 else: 143 else:
133 print "No artifacts uploaded (dry run)" 144 print "No artifacts uploaded (dry run)"
134 return 0 145 return 0
135 146
136 if __name__ == '__main__': 147 if __name__ == '__main__':
137 sys.exit(main()) 148 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698