From ed66c1fb7d5e19efb968e877331e880231d0a807 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Thu, 21 Nov 2024 11:44:59 +0700 Subject: [PATCH] fix(tools): fix adding tar.gz archive to tools.json if tar.xz is present --- tools/idf_tools.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/idf_tools.py b/tools/idf_tools.py index 5ae9f4cae2..b818f5a799 100755 --- a/tools/idf_tools.py +++ b/tools/idf_tools.py @@ -2839,7 +2839,12 @@ def action_add_version(args: Any) -> None: checksum_info: ChecksumFileParser = (ChecksumFileParser(filename_prefix, args.checksum_file) if args.checksum_file else ChecksumCalculator(args.artifact_file)) # type: ignore + updated_tools = [] for file_size, file_sha256, file_name in checksum_info: + xz_file = file_name.replace('.tar.gz', '.tar.xz') + if xz_file in updated_tools: + # .tar.xz archives are preferable, but .tar.gz is needed, for example, when using PlatformIO + continue # Guess which platform this file is for try: found_platform = Platforms.get_by_filename(file_name) @@ -2852,6 +2857,7 @@ def action_add_version(args: Any) -> None: info(f' SHA256: {file_sha256}') info(f' URL: {url}') version_obj.add_download(found_platform, url, file_size, file_sha256) + updated_tools.append(file_name) json_str = dump_tools_json(tools_info) if not args.output: args.output = os.path.join(g.idf_path, TOOLS_FILE_NEW) # type: ignore