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

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: Change to peer paths for network_service and network_service_apptests. 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..e7b95bc518657b9ac80bc1c4db2cca50aade20a8 100755
--- a/mojo/services/upload_service.py
+++ b/mojo/services/upload_service.py
@@ -12,20 +12,28 @@ import tempfile
import time
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_service" ]
-SERVICE_BINARY_NAMES = {
- "network" : "network_service.mojo",
- "html_viewer" : "html_viewer.mojo"
+SERVICE_DIRECTORIES = {
+ "html_viewer": "html_viewer",
+ "network_service": "network"
+}
+
+# Binaries for the associated services are uploaded in lockstep with the primary
+# app (e.g. network service apptests with network service). TODO(ppi): remove
+# this once we have full apptest platform coverage in Chromium.
+ASSOCIATED_SERVICES = {
blundell 2015/02/05 12:45:50 As discussed offline, I think we should consider t
ppi 2015/02/05 12:55:36 Done.
+ "network_service" : [ "network_service_apptests" ]
}
# The network service is downloaded out-of-band rather than dynamically by the
# shell and thus can be stored zipped in the cloud. Other services are intended
# to be downloaded dynamically by the shell, which doesn't currently understand
# zipped binaries.
-SERVICES_WITH_ZIPPED_BINARIES = [ "network" ]
+SERVICES_WITH_ZIPPED_BINARIES = [
+ "network_service",
+ "network_service_apptests"
+]
if not sys.platform.startswith("linux"):
print "Only support linux for now"
@@ -56,7 +64,7 @@ def gsutil_cp(source, dest, dry_run):
def upload_mojoms(service, dry_run):
script_dir = os.path.dirname(os.path.realpath(__file__))
- service_dir = os.path.join(script_dir, service)
+ service_dir = os.path.join(script_dir, SERVICE_DIRECTORIES[service])
absolute_mojom_directory_path = os.path.join(
service_dir,
"public",
@@ -77,18 +85,26 @@ 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_services(primary_service, binary_dir, platform, dry_run):
+ services = [ primary_service ] + ASSOCIATED_SERVICES.get(primary_service, [])
+
+ for service in services:
+ dest_dir = "gs://mojo/" + service + "/" + version + "/" + platform + "/"
+ should_zip = service in SERVICES_WITH_ZIPPED_BINARIES
+ binary_name = service + ".mojo"
+ 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 +113,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,11 +140,11 @@ def main():
upload_mojoms(args.service, args.dry_run)
if args.linux_x64_binary_dir:
- upload_binary(args.service, args.linux_x64_binary_dir,
- "linux-x64", args.dry_run)
+ upload_services(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,
- "android-arm", args.dry_run)
+ upload_services(args.service, args.android_arm_binary_dir,
+ "android-arm", args.dry_run)
if not args.dry_run:
print "Uploaded artifacts for version %s" % (version, )
« 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