aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-12-01 00:49:02 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2022-12-01 00:49:02 +0000
commit6c70046ced9b027fe88dc41db2b5235e92073d01 (patch)
tree2e003c29b6b3fcad0df999934b774ef7bf482e76
parent32ce9ce6fc9227765be1e05980b4909399484f2d (diff)
parent3e071b7d8c5e6980092a5d0f53f0bbd3cb9fa9cc (diff)
downloadbuild-6c70046ced9b027fe88dc41db2b5235e92073d01.tar.gz
Merge "Merge "Refactor: remove --apex-info-file arg to checkvintf" am: a4dc4a3ac7" into main-16k
-rw-r--r--core/Makefile3
-rwxr-xr-xtools/releasetools/check_target_files_vintf.py44
2 files changed, 23 insertions, 24 deletions
diff --git a/core/Makefile b/core/Makefile
index 955b3601f6..8bd6796a26 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -4566,7 +4566,7 @@ APEX_INFO_FILE := $(APEX_OUT)/apex-info-list.xml
$(APEX_INFO_FILE): $(HOST_OUT_EXECUTABLES)/dump_apex_info $(apex_vintf_files)
@echo "Creating apex-info-file in $(PRODUCT_OUT) "
- $< --root_dir $(PRODUCT_OUT) --out_file $@
+ $< --root_dir $(PRODUCT_OUT)
apex_vintf_files :=
@@ -4768,7 +4768,6 @@ check_vintf_compatible_args += \
ifdef PRODUCT_SHIPPING_API_LEVEL
check_vintf_compatible_args += --property ro.product.first_api_level=$(PRODUCT_SHIPPING_API_LEVEL)
endif # PRODUCT_SHIPPING_API_LEVEL
-check_vintf_compatible_args += --apex-info-file $(APEX_INFO_FILE)
$(check_vintf_compatible_log): PRIVATE_CHECK_VINTF_ARGS := $(check_vintf_compatible_args)
$(check_vintf_compatible_log): PRIVATE_CHECK_VINTF_DEPS := $(check_vintf_compatible_deps)
diff --git a/tools/releasetools/check_target_files_vintf.py b/tools/releasetools/check_target_files_vintf.py
index b32b85c103..a254cabb7b 100755
--- a/tools/releasetools/check_target_files_vintf.py
+++ b/tools/releasetools/check_target_files_vintf.py
@@ -129,8 +129,8 @@ def CheckVintfFromExtractedTargetFiles(input_tmp, info_dict=None):
dirmap = GetDirmap(input_tmp)
- apex_root, apex_info_file = PrepareApexDirectory(input_tmp)
- dirmap['/apex'] = apex_root
+ # Simulate apexd from target-files.
+ dirmap['/apex'] = PrepareApexDirectory(input_tmp)
args_for_skus = GetArgsForSkus(info_dict)
shipping_api_level_args = GetArgsForShippingApiLevel(info_dict)
@@ -140,7 +140,6 @@ def CheckVintfFromExtractedTargetFiles(input_tmp, info_dict=None):
'checkvintf',
'--check-compat',
]
- common_command += ['--apex-info-file', apex_info_file]
for device_path, real_path in sorted(dirmap.items()):
common_command += ['--dirmap', '{}:{}'.format(device_path, real_path)]
@@ -206,27 +205,29 @@ def GetVintfApexUnzipPatterns():
return patterns
def PrepareApexDirectory(inp):
- """ Prepare the APEX data.
+ """ Prepare /apex directory before running checkvintf
Apex binaries do not support dirmaps, in order to use these binaries we
need to move the APEXes from the extracted target file archives to the
expected device locations.
- The APEXes will also be extracted under the APEX/ directory
- matching what would be on the target.
+ This simulates how apexd activates APEXes.
+ 1. create {inp}/APEX which is treated as a "/" on device.
+ 2. copy apexes from target-files to {root}/{partition}/apex.
+ 3. mount apexes under {root}/{partition}/apex at {root}/apex.
+ 4. generate info files with dump_apex_info.
- Create the following structure under the input inp directory:
- APEX/apex # Extracted APEXes
- APEX/system/apex/ # System APEXes
- APEX/vendor/apex/ # Vendor APEXes
+ We'll get the following layout
+ {inp}/APEX/apex # Activated APEXes + some info files
+ {inp}/APEX/system/apex # System APEXes
+ {inp}/APEX/vendor/apex # Vendor APEXes
...
Args:
inp: path to the directory that contains the extracted target files archive.
Returns:
- extracted apex directory
- apex-info-list.xml file
+ directory representing /apex on device
"""
deapexer = 'deapexer'
@@ -273,15 +274,19 @@ def PrepareApexDirectory(inp):
root_dir_name = 'APEX'
root_dir = os.path.join(inp, root_dir_name)
extracted_root = os.path.join(root_dir, 'apex')
- apex_info_file = os.path.join(extracted_root, 'apex-info-list.xml')
- # Always create APEX directory for dirmap
+ # Always create /apex directory for dirmap
os.makedirs(extracted_root)
create_info_file = False
# Loop through search path looking for and processing apex/ directories.
for device_path, target_files_rel_paths in DIR_SEARCH_PATHS.items():
+ # checkvintf only needs vendor apexes. skip other partitions for efficiency
+ if device_path not in ['/vendor', '/odm']:
+ continue
+ # First, copy VENDOR/apex/foo.apex to APEX/vendor/apex/foo.apex
+ # Then, extract the contents to APEX/apex/foo/
for target_files_rel_path in target_files_rel_paths:
inp_partition = os.path.join(inp, target_files_rel_path,"apex")
if os.path.exists(inp_partition):
@@ -292,16 +297,11 @@ def PrepareApexDirectory(inp):
create_info_file = True
if create_info_file:
- ### Create apex-info-list.xml
- dump_cmd = ['dump_apex_info',
- '--root_dir', root_dir,
- '--out_file', apex_info_file]
+ ### Dump apex info files
+ dump_cmd = ['dump_apex_info', '--root_dir', root_dir]
common.RunAndCheckOutput(dump_cmd)
- if not os.path.exists(apex_info_file):
- raise RuntimeError('Failed to create apex info file %s', apex_info_file)
- logger.info('Created %s', apex_info_file)
- return extracted_root, apex_info_file
+ return extracted_root
def CheckVintfFromTargetFiles(inp, info_dict=None):
"""