From 74955f88834b26061e799b5f7cab6dc349290de8 Mon Sep 17 00:00:00 2001 From: Daniel Zheng Date: Thu, 3 Aug 2023 15:46:13 -0700 Subject: [PATCH] Adding option to configure compression level Adding option to ota_from_target_files to configure compression level. This option can be configured via the --vabc_compression_param flag. e.g. --vabc_compression_param=gz,9 specifies gz compression algorithm using level 9 compression Test: ota_from_target_files Change-Id: Ifc851faccbb3fba466d45c9695aaab322a362081 --- tools/releasetools/ota_from_target_files.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py index 28943fc52f..71dbde626f 100755 --- a/tools/releasetools/ota_from_target_files.py +++ b/tools/releasetools/ota_from_target_files.py @@ -247,7 +247,9 @@ A/B OTA specific options older SPL. --vabc_compression_param - Compression algorithm to be used for VABC. Available options: gz, lz4, zstd, brotli, none + Compression algorithm to be used for VABC. Available options: gz, lz4, zstd, brotli, none. + Compression level can be specified by appending ",$LEVEL" to option. + e.g. --vabc_compression_param=gz,9 specifies level 9 compression with gz algorithm --security_patch_level Override the security patch level in target files @@ -1210,7 +1212,13 @@ def main(argv): assert a.lower() in ["true", "false"] OPTIONS.enable_lz4diff = a.lower() != "false" elif o == "--vabc_compression_param": + words = a.split(",") + assert len(words) >= 1 and len(words) <= 2 OPTIONS.vabc_compression_param = a.lower() + if len(words) == 2: + if not words[1].isdigit(): + raise ValueError("Cannot parse value %r for option $COMPRESSION_LEVEL - only " + "integers are allowed." % words[1]) elif o == "--security_patch_level": OPTIONS.security_patch_level = a elif o in ("--max_threads"):