diff --git a/vndk/tools/header-checker/utils/create_reference_dumps.py b/vndk/tools/header-checker/utils/create_reference_dumps.py index 5db48c5d2..5c0768ced 100755 --- a/vndk/tools/header-checker/utils/create_reference_dumps.py +++ b/vndk/tools/header-checker/utils/create_reference_dumps.py @@ -56,13 +56,9 @@ def find_and_remove_path(root_path, file_name=None): shutil.rmtree(root_path) -def remove_references_for_all_arches_and_variants(ref_dump_dir, - chosen_vndk_version, - binder_bitness, targets, - libs): +def remove_references_for_all_arches(ref_dump_dir, chosen_vndk_version, + binder_bitness, targets, libs): for target in targets: - if target.arch == '' or target.arch_variant == '': - continue for category in ('ndk', 'platform', 'vndk'): dir_to_remove = get_ref_dump_dir_stem( ref_dump_dir, category, chosen_vndk_version, binder_bitness, @@ -107,12 +103,9 @@ def create_source_abi_reference_dumps(args, chosen_vndk_version, binder_bitness, lsdump_paths, targets): num_libs_copied = 0 for target in targets: - if target.arch == '' or target.arch_variant == '': - continue - - print('Creating dumps for target_arch:', target.arch, 'and variant ', - target.arch_variant) assert target.primary_arch != '' + print(f'Creating dumps for arch: {target.arch}, ' + f'primary arch: {target.primary_arch}') num_libs_copied += find_and_copy_lib_lsdumps( args.ref_dump_dir, chosen_vndk_version, binder_bitness, target, @@ -140,11 +133,12 @@ def create_source_abi_reference_dumps_for_all_products(args): chosen_vndk_version = choose_vndk_version( args.version, platform_vndk_version, board_vndk_version) - targets = [Target(True, product), Target(False, product)] + targets = [t for t in (Target(True, product), Target(False, product)) + if t.arch] # Remove reference ABI dumps specified in `args.libs` (or remove all of # them if none of them are specified) so that we may build these # libraries successfully. - remove_references_for_all_arches_and_variants( + remove_references_for_all_arches( args.ref_dump_dir, chosen_vndk_version, binder_bitness, targets, args.libs) diff --git a/vndk/tools/header-checker/utils/utils.py b/vndk/tools/header-checker/utils/utils.py index e0fd5cf42..5f956bf96 100644 --- a/vndk/tools/header-checker/utils/utils.py +++ b/vndk/tools/header-checker/utils/utils.py @@ -53,8 +53,16 @@ class Target(object): self.cpu_variant = build_vars[3] def get_arch_str(self): - """Return a string that represents the architecture and the - architecture variant. + """Return a string that represents the architecture and the primary + architecture. + """ + if not self.arch or self.arch == self.primary_arch: + return self.primary_arch + return self.arch + '_' + self.primary_arch + + def get_arch_cpu_str(self): + """Return a string that represents the architecture, the architecture + variant, and the CPU variant. If TARGET_ARCH == TARGET_ARCH_VARIANT, soong makes targetArchVariant empty. This is the case for aosp_x86_64. @@ -64,17 +72,12 @@ class Target(object): else: arch_variant = '_' + self.arch_variant - return self.arch + arch_variant - - def get_arch_cpu_str(self): - """Return a string that represents the architecture, the architecture - variant, and the CPU variant.""" if not self.cpu_variant or self.cpu_variant == 'generic': cpu_variant = '' else: cpu_variant = '_' + self.cpu_variant - return self.get_arch_str() + cpu_variant + return self.arch + arch_variant + cpu_variant def _validate_dump_content(dump_path):