Skip signing key check in some cases

Test: th
Bug: 205657204

Change-Id: I3a2fc886cfb3fe3d53619bfb8fe84aa799d80de3
This commit is contained in:
Kelvin Zhang
2021-11-09 08:42:11 -08:00
parent 96f398c06c
commit 4b588cf75a

View File

@@ -1331,49 +1331,49 @@ def main(argv):
return True return True
args = common.ParseOptions(argv, __doc__, args = common.ParseOptions(argv, __doc__,
extra_opts="b:k:i:d:e:t:2o:", extra_opts="b:k:i:d:e:t:2o:",
extra_long_opts=[ extra_long_opts=[
"package_key=", "package_key=",
"incremental_from=", "incremental_from=",
"full_radio", "full_radio",
"full_bootloader", "full_bootloader",
"wipe_user_data", "wipe_user_data",
"downgrade", "downgrade",
"override_timestamp", "override_timestamp",
"extra_script=", "extra_script=",
"worker_threads=", "worker_threads=",
"two_step", "two_step",
"include_secondary", "include_secondary",
"no_signing", "no_signing",
"block", "block",
"binary=", "binary=",
"oem_settings=", "oem_settings=",
"oem_no_mount", "oem_no_mount",
"verify", "verify",
"stash_threshold=", "stash_threshold=",
"log_diff=", "log_diff=",
"payload_signer=", "payload_signer=",
"payload_signer_args=", "payload_signer_args=",
"payload_signer_maximum_signature_size=", "payload_signer_maximum_signature_size=",
"payload_signer_key_size=", "payload_signer_key_size=",
"extracted_input_target_files=", "extracted_input_target_files=",
"skip_postinstall", "skip_postinstall",
"retrofit_dynamic_partitions", "retrofit_dynamic_partitions",
"skip_compatibility_check", "skip_compatibility_check",
"output_metadata_path=", "output_metadata_path=",
"disable_fec_computation", "disable_fec_computation",
"disable_verity_computation", "disable_verity_computation",
"force_non_ab", "force_non_ab",
"boot_variable_file=", "boot_variable_file=",
"partial=", "partial=",
"custom_image=", "custom_image=",
"disable_vabc", "disable_vabc",
"spl_downgrade", "spl_downgrade",
"vabc_downgrade", "vabc_downgrade",
"enable_vabc_xor=", "enable_vabc_xor=",
"force_minor_version=", "force_minor_version=",
"compressor_types=", "compressor_types=",
], extra_option_handler=option_handler) ], extra_option_handler=option_handler)
if len(args) != 2: if len(args) != 2:
common.Usage(__doc__) common.Usage(__doc__)
@@ -1473,13 +1473,18 @@ def main(argv):
"build/make/target/product/security/testkey") "build/make/target/product/security/testkey")
# Get signing keys # Get signing keys
OPTIONS.key_passwords = common.GetKeyPasswords([OPTIONS.package_key]) OPTIONS.key_passwords = common.GetKeyPasswords([OPTIONS.package_key])
private_key_path = OPTIONS.package_key + OPTIONS.private_key_suffix
if not os.path.exists(private_key_path): # Only check for existence of key file if using the default signer.
raise common.ExternalError( # Because the custom signer might not need the key file AT all.
"Private key {} doesn't exist. Make sure you passed the" # b/191704641
" correct key path through -k option".format( if not OPTIONS.signapk_path:
private_key_path) private_key_path = OPTIONS.package_key + OPTIONS.private_key_suffix
) if not os.path.exists(private_key_path):
raise common.ExternalError(
"Private key {} doesn't exist. Make sure you passed the"
" correct key path through -k option".format(
private_key_path)
)
if OPTIONS.source_info_dict: if OPTIONS.source_info_dict:
source_build_prop = OPTIONS.source_info_dict["build.prop"] source_build_prop = OPTIONS.source_info_dict["build.prop"]
@@ -1531,8 +1536,5 @@ if __name__ == '__main__':
try: try:
common.CloseInheritedPipes() common.CloseInheritedPipes()
main(sys.argv[1:]) main(sys.argv[1:])
except common.ExternalError:
logger.exception("\n ERROR:\n")
sys.exit(1)
finally: finally:
common.Cleanup() common.Cleanup()