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

Unified Diff: mojo/services/upload_service.py

Issue 904443003: Support network service apptests in the upload_service script (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/upload_service.py
diff --git a/mojo/services/upload_service.py b/mojo/services/upload_service.py
index 5666dea142a317c61fa99e7ae153861e8402a5e6..fe56eacba756b8c0c5ec7f056d8926bd3d26d005 100755
--- a/mojo/services/upload_service.py
+++ b/mojo/services/upload_service.py
@@ -14,11 +14,11 @@ import zipfile
# A service's name is defined as the name of its subdirectory in the directory
# containing this file.
-SERVICES = [ "network", "html_viewer" ]
+SERVICES = [ "html_viewer", "network" ]
blundell 2015/02/05 10:53:56 I suggest changing this to the binary name (i.e.,
ppi 2015/02/05 12:35:06 Done.
SERVICE_BINARY_NAMES = {
- "network" : "network_service.mojo",
- "html_viewer" : "html_viewer.mojo"
+ "html_viewer" : [ "html_viewer.mojo" ],
+ "network" : [ "network_service.mojo", "network_service_apptests.mojo" ]
}
# The network service is downloaded out-of-band rather than dynamically by the
@@ -77,18 +77,23 @@ def upload_mojoms(service, dry_run):
gsutil_cp(mojom_zip_file.name, dest, dry_run)
-def upload_binary(service, binary_dir, platform, dry_run):
- binary_name = SERVICE_BINARY_NAMES[service]
- absolute_binary_path = os.path.join(root_path, binary_dir, binary_name)
- binary_dest_prefix = "gs://mojo/" + service + "/" + version + "/" + platform
+def upload_binaries(service, binary_dir, platform, dry_run):
+ should_zip = service in SERVICES_WITH_ZIPPED_BINARIES
+ dest_dir = "gs://mojo/" + service + "/" + version + "/" + platform + "/"
+ for binary_name in SERVICE_BINARY_NAMES[service]:
+ absolute_binary_path = os.path.join(root_path, binary_dir, binary_name)
+ upload_binary(absolute_binary_path, binary_name, dest_dir, should_zip,
+ dry_run)
- if service not in SERVICES_WITH_ZIPPED_BINARIES:
- binary_dest = binary_dest_prefix + "/" + binary_name
- gsutil_cp(absolute_binary_path, binary_dest, dry_run)
+def upload_binary(absolute_binary_path, binary_name, dest_dir, should_zip,
+ dry_run):
+ if not should_zip:
+ dest = dest_dir + binary_name
+ gsutil_cp(absolute_binary_path, dest, dry_run)
return
# Zip the binary before uploading it to the cloud.
- binary_dest = binary_dest_prefix + ".zip"
+ dest = dest_dir + binary_name + ".zip"
with tempfile.NamedTemporaryFile() as binary_zip_file:
with zipfile.ZipFile(binary_zip_file, 'w') as z:
with open(absolute_binary_path) as service_binary:
@@ -97,7 +102,7 @@ def upload_binary(service, binary_dir, platform, dry_run):
zipinfo.compress_type = zipfile.ZIP_DEFLATED
zipinfo.date_time = time.gmtime(os.path.getmtime(absolute_binary_path))
z.writestr(zipinfo, service_binary.read())
- gsutil_cp(binary_zip_file.name, binary_dest, dry_run)
+ gsutil_cp(binary_zip_file.name, dest, dry_run)
def main():
@@ -124,10 +129,10 @@ def main():
upload_mojoms(args.service, args.dry_run)
if args.linux_x64_binary_dir:
- upload_binary(args.service, args.linux_x64_binary_dir,
+ upload_binaries(args.service, args.linux_x64_binary_dir,
"linux-x64", args.dry_run)
if args.android_arm_binary_dir:
- upload_binary(args.service, args.android_arm_binary_dir,
+ upload_binaries(args.service, args.android_arm_binary_dir,
"android-arm", args.dry_run)
if not args.dry_run:
« 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