From 01e381954ba45da2b69dcddf5c2fb475e789cc98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kan=20Kvist?= Date: Thu, 13 Apr 2023 21:49:19 +0200 Subject: [PATCH] Order entries in apex_info.pb Adding the entries in apex_info.pb in sorted order makes it easier to compare ota packages generated between the same source and target on different computers/environments, ideally the generated ota zips should be identical. os.listdir() was used to find the apex files which should be included in apex_info.pb. listdir() does not guarantee any order, solution is to sort the result to ensure consistent order. Bug: 278095305 Test: Manual. Confirm that apex_info.pb is generated sorted protoc --decode_raw < apex_info.pb Change-Id: I2851d207f828a6ac31e63e20c9025965ac4b0eba --- tools/releasetools/apex_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/releasetools/apex_utils.py b/tools/releasetools/apex_utils.py index 40f7c92deb..d52370194d 100644 --- a/tools/releasetools/apex_utils.py +++ b/tools/releasetools/apex_utils.py @@ -626,7 +626,7 @@ def GetApexInfoFromTargetFiles(input_file, partition, compressed_only=True): if os.path.isfile(deapexer_path): deapexer = deapexer_path - for apex_filename in os.listdir(target_dir): + for apex_filename in sorted(os.listdir(target_dir)): apex_filepath = os.path.join(target_dir, apex_filename) if not os.path.isfile(apex_filepath) or \ not zipfile.is_zipfile(apex_filepath):