vndk-def: Simplify VNDK result

This commit adds extra_vendor_libs and removes extra_vndk_sp_indirect.
With this modification, we can tag each libraries with either vndk_ext,
extra_vendor_libs, vndk_sp_ext or vndk_sp_indirect_ext.

After tagging them precisely, we merge them into vndk_sp, vndk_sp_ext
and extra_vendor_libs before printing the simplified VNDK list.  This
will give us accurate tags when --full is specified and give concise
tags when --full is not specified.

Bug: 37867089
Test: 3 essential sets are printed when --full was not specified.
Merged-In: Ic17c5e1dd4420050217e9724f86516c21609f899
(cherry picked from commit b68f26d281)

Change-Id: I558e2a01c46d28a1bdb368a73d0b2e0cbd4cc357
This commit is contained in:
Logan Chien
2017-06-09 18:55:03 +08:00
parent 8a13cdab4c
commit 840177d510

View File

@@ -843,10 +843,16 @@ _VNDK_RESULT_FIELD_NAMES = (
'vndk_sp_indirect_unused', 'vndk_sp_indirect_private', 'vndk',
'vndk_indirect', 'fwk_only', 'fwk_only_rs', 'sp_hal', 'sp_hal_dep',
'vnd_only', 'vndk_ext', 'vndk_sp_ext', 'vndk_sp_indirect_ext',
'extra_vndk_sp_indirect')
'extra_vendor_libs')
VNDKResult = defaultnamedtuple('VNDKResult', _VNDK_RESULT_FIELD_NAMES, set())
_SIMPLE_VNDK_RESULT_FIELD_NAMES = (
'vndk_sp', 'vndk_sp_ext', 'extra_vendor_libs')
SimpleVNDKResult = defaultnamedtuple(
'SimpleVNDKResult', _SIMPLE_VNDK_RESULT_FIELD_NAMES, set())
class ELFLibDict(defaultnamedtuple('ELFLibDict', ('lib32', 'lib64'), {})):
def get_lib_dict(self, elf_class):
@@ -1543,10 +1549,10 @@ class ELFLinker(object):
sp_hal=sp_hal,
sp_hal_dep=sp_hal_dep,
# vnd_only=vnd_only,
vndk_ext=vndk_ext | extra_vendor_libs,
# vndk_sp_ext=vndk_sp_ext,
# vndk_sp_indirect_ext=vndk_sp_indirect_ext,
extra_vndk_sp_indirect=vndk_sp_ext | vndk_sp_indirect_ext)
vndk_ext=vndk_ext,
vndk_sp_ext=vndk_sp_ext,
vndk_sp_indirect_ext=vndk_sp_indirect_ext,
extra_vendor_libs=extra_vendor_libs)
def compute_vndk_cap(self, banned_libs):
# ELF files on vendor partitions are banned unconditionally. ELF files
@@ -1924,6 +1930,26 @@ class VNDKCommand(VNDKCommandBase):
print('warning: {}: NDK library should not be extended.'
.format(lib.path), file=sys.stderr)
@staticmethod
def _extract_simple_vndk_result(vndk_result):
field_name_tags = [
('vndk_sp', 'vndk_sp'),
('vndk_sp_unused', 'vndk_sp'),
('vndk_sp_indirect', 'vndk_sp'),
('vndk_sp_indirect_unused', 'vndk_sp'),
('vndk_sp_indirect_private', 'vndk_sp'),
('vndk_sp_ext', 'vndk_sp_ext'),
('vndk_sp_indirect_ext', 'vndk_sp_ext'),
('vndk_ext', 'extra_vendor_libs'),
('extra_vendor_libs', 'extra_vendor_libs'),
]
results = SimpleVNDKResult()
for field_name, tag in field_name_tags:
getattr(results, tag).update(getattr(vndk_result, field_name))
return results
def main(self, args):
generic_refs, graph = self.create_from_args(args)
@@ -1946,13 +1972,20 @@ class VNDKCommand(VNDKCommandBase):
args.action_ineligible_vndk_sp, args.action_ineligible_vndk)
# Print results.
field_names = ['extra_vndk_sp_indirect', 'vndk_ext']
if args.full:
field_names = _VNDK_RESULT_FIELD_NAMES
for field_name in field_names:
tag = field_name + ':'
for lib in sorted_lib_path_list(getattr(vndk_lib, field_name)):
result_tags = _VNDK_RESULT_FIELD_NAMES
results = vndk_lib
else:
# Simplified VNDK output with only three sets.
result_tags = _SIMPLE_VNDK_RESULT_FIELD_NAMES
results = self._extract_simple_vndk_result(vndk_lib)
for tag in result_tags:
libs = getattr(results, tag)
tag += ':'
for lib in sorted_lib_path_list(libs):
print(tag, lib)
return 0