Merge "Speed up non-AB ota_from_target_files in the build system" am: 47ba4239c8 am: 02e29c5b48

am: 62fb821faf

Change-Id: Idb3a0c991efe712865db7343861212a74ea56b0a
This commit is contained in:
Dan Willemsen 2017-03-22 02:26:50 +00:00 committed by android-build-merger
commit ea8f68ed6c
2 changed files with 21 additions and 8 deletions

View file

@ -2273,6 +2273,7 @@ $(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \ $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
./build/tools/releasetools/ota_from_target_files -v \ ./build/tools/releasetools/ota_from_target_files -v \
--block \ --block \
--extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \
-p $(HOST_OUT) \ -p $(HOST_OUT) \
-k $(KEY_CERT_PAIR) \ -k $(KEY_CERT_PAIR) \
$(if $(OEM_OTA_CONFIG), -o $(OEM_OTA_CONFIG)) \ $(if $(OEM_OTA_CONFIG), -o $(OEM_OTA_CONFIG)) \

View file

@ -1235,6 +1235,8 @@ def main(argv):
OPTIONS.payload_signer = a OPTIONS.payload_signer = a
elif o == "--payload_signer_args": elif o == "--payload_signer_args":
OPTIONS.payload_signer_args = shlex.split(a) OPTIONS.payload_signer_args = shlex.split(a)
elif o == "--extracted_input_target_files":
OPTIONS.extracted_input = a
else: else:
return False return False
return True return True
@ -1265,6 +1267,7 @@ def main(argv):
"log_diff=", "log_diff=",
"payload_signer=", "payload_signer=",
"payload_signer_args=", "payload_signer_args=",
"extracted_input_target_files=",
], extra_option_handler=option_handler) ], extra_option_handler=option_handler)
if len(args) != 2: if len(args) != 2:
@ -1287,9 +1290,12 @@ def main(argv):
# Load the dict file from the zip directly to have a peek at the OTA type. # Load the dict file from the zip directly to have a peek at the OTA type.
# For packages using A/B update, unzipping is not needed. # For packages using A/B update, unzipping is not needed.
input_zip = zipfile.ZipFile(args[0], "r") if OPTIONS.extracted_input is not None:
OPTIONS.info_dict = common.LoadInfoDict(input_zip) OPTIONS.info_dict = common.LoadInfoDict(OPTIONS.extracted_input, OPTIONS.extracted_input)
common.ZipClose(input_zip) else:
input_zip = zipfile.ZipFile(args[0], "r")
OPTIONS.info_dict = common.LoadInfoDict(input_zip)
common.ZipClose(input_zip)
ab_update = OPTIONS.info_dict.get("ab_update") == "true" ab_update = OPTIONS.info_dict.get("ab_update") == "true"
@ -1319,12 +1325,18 @@ def main(argv):
if OPTIONS.extra_script is not None: if OPTIONS.extra_script is not None:
OPTIONS.extra_script = open(OPTIONS.extra_script).read() OPTIONS.extra_script = open(OPTIONS.extra_script).read()
print("unzipping target target-files...") if OPTIONS.extracted_input is not None:
OPTIONS.input_tmp, input_zip = common.UnzipTemp( OPTIONS.input_tmp = OPTIONS.extracted_input
args[0], UNZIP_PATTERN) OPTIONS.target_tmp = OPTIONS.input_tmp
OPTIONS.info_dict = common.LoadInfoDict(OPTIONS.input_tmp, OPTIONS.input_tmp)
input_zip = zipfile.ZipFile(args[0], "r")
else:
print("unzipping target target-files...")
OPTIONS.input_tmp, input_zip = common.UnzipTemp(
args[0], UNZIP_PATTERN)
OPTIONS.target_tmp = OPTIONS.input_tmp OPTIONS.target_tmp = OPTIONS.input_tmp
OPTIONS.info_dict = common.LoadInfoDict(input_zip, OPTIONS.target_tmp) OPTIONS.info_dict = common.LoadInfoDict(input_zip, OPTIONS.target_tmp)
if OPTIONS.verbose: if OPTIONS.verbose:
print("--- target info ---") print("--- target info ---")