From 9b6d4ec01bc1b57ff04737748995ab3869ca4484 Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Thu, 28 Oct 2021 09:34:31 -0700 Subject: [PATCH] Add a compressor types option Test: th Change-Id: I1ff1bccf179bfd87ce9e08def0e5e38921d7d158 --- tools/releasetools/ota_from_target_files.py | 93 +++++++++++---------- 1 file changed, 51 insertions(+), 42 deletions(-) diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py index 17f373ebe1..1fc6878d3b 100755 --- a/tools/releasetools/ota_from_target_files.py +++ b/tools/releasetools/ota_from_target_files.py @@ -227,6 +227,9 @@ A/B OTA specific options --force_minor_version Override the update_engine minor version for delta generation. + + --compressor_types + A colon ':' separated list of compressors. Allowed values are bz2 and brotli. """ from __future__ import print_function @@ -294,6 +297,7 @@ OPTIONS.spl_downgrade = False OPTIONS.vabc_downgrade = False OPTIONS.enable_vabc_xor = True OPTIONS.force_minor_version = None +OPTIONS.compressor_types = None POSTINSTALL_CONFIG = 'META/postinstall_config.txt' DYNAMIC_PARTITION_INFO = 'META/dynamic_partitions_info.txt' @@ -1149,6 +1153,8 @@ def GenerateAbOtaPackage(target_file, output_file, source_file=None): additional_args += ["--enable_vabc_xor", "true"] if OPTIONS.force_minor_version: additional_args += ["--force_minor_version", OPTIONS.force_minor_version] + if OPTIONS.compressor_types: + additional_args += ["--compressor_types", OPTIONS.compressor_types] additional_args += ["--max_timestamp", max_timestamp] if SupportsMainlineGkiUpdates(source_file): @@ -1324,53 +1330,56 @@ def main(argv): OPTIONS.enable_vabc_xor = a.lower() != "false" elif o == "--force_minor_version": OPTIONS.force_minor_version = a + elif o == "--compressor_types": + OPTIONS.compressor_types = a else: return False return True args = common.ParseOptions(argv, __doc__, - extra_opts="b:k:i:d:e:t:2o:", - extra_long_opts=[ - "package_key=", - "incremental_from=", - "full_radio", - "full_bootloader", - "wipe_user_data", - "downgrade", - "override_timestamp", - "extra_script=", - "worker_threads=", - "two_step", - "include_secondary", - "no_signing", - "block", - "binary=", - "oem_settings=", - "oem_no_mount", - "verify", - "stash_threshold=", - "log_diff=", - "payload_signer=", - "payload_signer_args=", - "payload_signer_maximum_signature_size=", - "payload_signer_key_size=", - "extracted_input_target_files=", - "skip_postinstall", - "retrofit_dynamic_partitions", - "skip_compatibility_check", - "output_metadata_path=", - "disable_fec_computation", - "disable_verity_computation", - "force_non_ab", - "boot_variable_file=", - "partial=", - "custom_image=", - "disable_vabc", - "spl_downgrade", - "vabc_downgrade", - "enable_vabc_xor=", - "force_minor_version=", - ], extra_option_handler=option_handler) + extra_opts="b:k:i:d:e:t:2o:", + extra_long_opts=[ + "package_key=", + "incremental_from=", + "full_radio", + "full_bootloader", + "wipe_user_data", + "downgrade", + "override_timestamp", + "extra_script=", + "worker_threads=", + "two_step", + "include_secondary", + "no_signing", + "block", + "binary=", + "oem_settings=", + "oem_no_mount", + "verify", + "stash_threshold=", + "log_diff=", + "payload_signer=", + "payload_signer_args=", + "payload_signer_maximum_signature_size=", + "payload_signer_key_size=", + "extracted_input_target_files=", + "skip_postinstall", + "retrofit_dynamic_partitions", + "skip_compatibility_check", + "output_metadata_path=", + "disable_fec_computation", + "disable_verity_computation", + "force_non_ab", + "boot_variable_file=", + "partial=", + "custom_image=", + "disable_vabc", + "spl_downgrade", + "vabc_downgrade", + "enable_vabc_xor=", + "force_minor_version=", + "compressor_types=", + ], extra_option_handler=option_handler) if len(args) != 2: common.Usage(__doc__)