Merge "ota_from_target_files: Add an option to not sign OTA packages"

This commit is contained in:
Ying Wang
2014-01-27 23:37:18 +00:00
committed by Gerrit Code Review

View File

@@ -88,6 +88,7 @@ OPTIONS.omit_prereq = False
OPTIONS.extra_script = None OPTIONS.extra_script = None
OPTIONS.aslr_mode = True OPTIONS.aslr_mode = True
OPTIONS.worker_threads = 3 OPTIONS.worker_threads = 3
OPTIONS.no_signing = False
def MostPopularKey(d, default): def MostPopularKey(d, default):
"""Given a dict, return the key corresponding to the largest """Given a dict, return the key corresponding to the largest
@@ -822,6 +823,8 @@ def main(argv):
OPTIONS.aslr_mode = False OPTIONS.aslr_mode = False
elif o in ("--worker_threads"): elif o in ("--worker_threads"):
OPTIONS.worker_threads = int(a) OPTIONS.worker_threads = int(a)
elif o in ("--no_signing"):
OPTIONS.no_signing = True
else: else:
return False return False
return True return True
@@ -836,6 +839,7 @@ def main(argv):
"extra_script=", "extra_script=",
"worker_threads=", "worker_threads=",
"aslr_mode=", "aslr_mode=",
"no_signing",
], ],
extra_option_handler=option_handler) extra_option_handler=option_handler)
@@ -870,9 +874,12 @@ def main(argv):
OPTIONS.device_specific = os.path.normpath(OPTIONS.device_specific) OPTIONS.device_specific = os.path.normpath(OPTIONS.device_specific)
print "using device-specific extensions in", OPTIONS.device_specific print "using device-specific extensions in", OPTIONS.device_specific
temp_zip_file = tempfile.NamedTemporaryFile() if OPTIONS.no_signing:
output_zip = zipfile.ZipFile(temp_zip_file, "w", output_zip = zipfile.ZipFile(args[1], "w", compression=zipfile.ZIP_DEFLATED)
compression=zipfile.ZIP_DEFLATED) else:
temp_zip_file = tempfile.NamedTemporaryFile()
output_zip = zipfile.ZipFile(temp_zip_file, "w",
compression=zipfile.ZIP_DEFLATED)
if OPTIONS.incremental_source is None: if OPTIONS.incremental_source is None:
WriteFullOTAPackage(input_zip, output_zip) WriteFullOTAPackage(input_zip, output_zip)
@@ -896,8 +903,9 @@ def main(argv):
output_zip.close() output_zip.close()
SignOutput(temp_zip_file.name, args[1]) if not OPTIONS.no_signing:
temp_zip_file.close() SignOutput(temp_zip_file.name, args[1])
temp_zip_file.close()
common.Cleanup() common.Cleanup()