diff options
author | Xin Li <delphij@google.com> | 2023-12-08 13:14:39 -0800 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2023-12-08 13:14:39 -0800 |
commit | e3e2a5ab93b77e9369c5da23977a7e0fbe20a5d7 (patch) | |
tree | 32268a91b469d0ad4d4ffe8631c67692c77be8f9 | |
parent | 50635e629a8a91690bfd1434e4791a7ecca40f5e (diff) | |
parent | ab59a9388211e71075c88adcf145f516b5c4006b (diff) | |
download | vndk-e3e2a5ab93b77e9369c5da23977a7e0fbe20a5d7.tar.gz |
Merge Android 14 QPR1
Merged-In: I388a26fa5b2799656d585edd2b37b95fff3b9891
Bug: 315507370
Change-Id: Ie63617bbe345e423811f28e30dc31504d1b4c2f5
-rw-r--r-- | golden/vndk_data.py | 48 |
1 files changed, 37 insertions, 11 deletions
diff --git a/golden/vndk_data.py b/golden/vndk_data.py index 3dbcd22..bb1a8d7 100644 --- a/golden/vndk_data.py +++ b/golden/vndk_data.py @@ -137,32 +137,51 @@ def GetAbiDumpPathsFromResources(version, binder_bitness, abi_name, abi_bitness) return dump_paths -def _LoadVndkLibraryListsFile(vndk_lists, tags, vndk_lib_list_file): +def _LoadVndkLibraryListsFile(vndk_lists, tags, vndk_lib_list_file, + change_history_file=None): """Load VNDK libraries from the file to the specified tuple. Args: vndk_lists: The output tuple of lists containing library names. tags: Strings, the tags of the libraries to find. vndk_lib_list_file: The file object containing the VNDK library list. + change_history_file: The file object containing the VNDK list change + history. It adds the vndk files that are removed. """ - - lib_sets = collections.defaultdict(set) - - # Load VNDK tags from the list. - for line in vndk_lib_list_file: + def ReadTagAndFile(line): # Ignore comments. if line.startswith('#'): - continue + return None, None # Split columns. cells = line.split(': ', 1) if len(cells) < 2: - continue - tag = cells[0] - lib_name = cells[1].strip() + return None, None + return cells[0].strip(), cells[1].strip() + lib_sets = collections.defaultdict(set) + + # Load VNDK tags from the list. + for line in vndk_lib_list_file: + tag, lib_name = ReadTagAndFile(line) + if not tag: + continue lib_sets[tag].add(lib_name) + if change_history_file: + for line in change_history_file: + tag, lib_name = ReadTagAndFile(line) + if not tag: + continue + + # In the history file, tag has '+' prefix if the file is added and + # '-' prefix if removed. + # To relax the test, include the removed files to the list. + if tag[0] != '-': + continue + tag = tag[1:] + lib_sets[tag].add(lib_name) + # Compute VNDK-core-private and VNDK-SP-private. private = lib_sets.get('VNDK-private', set()) @@ -204,6 +223,9 @@ def LoadVndkLibraryListsFromResources(version, *tags): vndk_lib_list_name = version_str + ".txt" vndk_lib_list = resources.files(_RESOURCE_PACKAGE).joinpath( vndk_lib_list_name) + vndk_lib_list_history_name = version_str + "_history.txt" + vndk_lib_list_history = resources.files(_RESOURCE_PACKAGE).joinpath( + vndk_lib_list_history_name) vndk_lib_extra_list_name = "vndk-lib-extra-list-" + version_str + ".txt" vndk_lib_extra_list = resources.files(_RESOURCE_PACKAGE).joinpath( vndk_lib_extra_list_name) @@ -219,7 +241,11 @@ def LoadVndkLibraryListsFromResources(version, *tags): vndk_lists = tuple([] for x in tags) with vndk_lib_list.open("r") as f: - _LoadVndkLibraryListsFile(vndk_lists, tags, f) + if vndk_lib_list_history.is_file(): + with vndk_lib_list_history.open("r") as history: + _LoadVndkLibraryListsFile(vndk_lists, tags, f, history) + else: + _LoadVndkLibraryListsFile(vndk_lists, tags, f) with vndk_lib_extra_list.open("r") as f: _LoadVndkLibraryListsFile(vndk_lists, tags, f) return vndk_lists |