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
This commit is contained in:
Håkan Kvist
2023-04-13 21:49:19 +02:00
parent 64bfc41359
commit 01e381954b

View File

@@ -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):