create_reference_dumps.py: Make it easier to create per product abi references

Bug: 80372796

Test: utils/create_reference_dumps.py -p aosp_arm -l libjpeg

Change-Id: I15bc720dc7834dd4259ee574a358032cc76b0882
This commit is contained in:
Jayant Chowdhary
2018-06-01 14:48:54 -07:00
parent e0f9f15e0d
commit 36f6f66a0e

View File

@@ -92,22 +92,18 @@ def get_ref_dump_dir_stem(args, vndk_or_ndk, product, chosen_vndk_version):
return ref_dump_dir_stem return ref_dump_dir_stem
def make_libs_for_product(libs, llndk_mode, product): def make_libs_for_product(libs, llndk_mode, product):
print('making libs for product:', product)
if libs: if libs:
print('making libs for product:', product)
make_libraries(libs, product, llndk_mode) make_libraries(libs, product, llndk_mode)
else: else:
print('making all libs for product: ', product)
make_tree(product) make_tree(product)
def find_and_remove_path(root_path, chosen_vndk_version, file_name=None): def find_and_remove_path(root_path, file_name=None):
if file_name is not None: if file_name is not None:
print('removing', file_name, 'from root', root_path) root_path = os.path.join(root_path, 'source-based', file_name)
remove_cmd_str = 'find ' + root_path + ' -name ' + file_name +\ remove_cmd_str = 'rm -rf ' + root_path
' -exec rm -rf {} \;' print('removing', root_path)
subprocess.check_call(remove_cmd_str, cwd=AOSP_DIR, shell=True) subprocess.check_call(remove_cmd_str, shell=True)
else:
remove_cmd_str = 'rm -rf ' + root_path
subprocess.check_call(remove_cmd_str, shell=True)
def remove_references_for_all_arches_and_variants(args, product, targets, def remove_references_for_all_arches_and_variants(args, product, targets,
chosen_vndk_version): chosen_vndk_version):
@@ -116,21 +112,24 @@ def remove_references_for_all_arches_and_variants(args, product, targets,
for target in targets: for target in targets:
if target.arch == '' or target.arch_variant == '': if target.arch == '' or target.arch_variant == '':
continue continue
if libs: dir_to_remove_vndk = os.path.join(
for lib in libs:
find_and_remove_path(args.ref_dump_dir, chosen_vndk_version,
lib + COMPRESSED_SOURCE_ABI_DUMP_EXT)
else:
dir_to_remove = os.path.join(
get_ref_dump_dir_stem(args, 'vndk', product, get_ref_dump_dir_stem(args, 'vndk', product,
chosen_vndk_version), chosen_vndk_version),
get_lib_arch_str(target)) get_lib_arch_str(target))
find_and_remove_path(dir_to_remove, chosen_vndk_version) dir_to_remove_ndk = os.path.join(
dir_to_remove = os.path.join(
get_ref_dump_dir_stem(args, 'ndk', product, get_ref_dump_dir_stem(args, 'ndk', product,
chosen_vndk_version), chosen_vndk_version),
get_lib_arch_str(target)) get_lib_arch_str(target))
find_and_remove_path(dir_to_remove, chosen_vndk_version)
if libs:
for lib in libs:
find_and_remove_path(dir_to_remove_vndk,
lib + COMPRESSED_SOURCE_ABI_DUMP_EXT)
find_and_remove_path(dir_to_remove_ndk,
lib + COMPRESSED_SOURCE_ABI_DUMP_EXT)
else:
find_and_remove_path(dir_to_remove_vndk)
find_and_remove_path(dir_to_remove_ndk)
def add_to_path_dict(path, dictionary, libs=[]): def add_to_path_dict(path, dictionary, libs=[]):
name, lsdump_ext = os.path.splitext(path) name, lsdump_ext = os.path.splitext(path)