Deprecate flattened apexes

Flattened apexes are deprecated. mege_dexopt does not need to care about
flattened apexes.

Bug: 278826656
Test: m otapackage
Change-Id: I527eed64c5f1a7466e2c48d73360f47f6cfa0911
This commit is contained in:
Jooyung Han
2023-06-27 13:01:56 +09:00
parent 24c928cda8
commit 2ac1f2fabc

View File

@@ -72,7 +72,6 @@ def MergeDexopt(temp_dir, output_target_files_dir):
# <contents of vendor dexpreopt_config.zip>
# system -> output/SYSTEM
# vendor -> output/VENDOR
# apex -> output/SYSTEM/apex (only for flattened APEX builds)
# apex/ (extracted updatable APEX)
# <apex 1>/
# ...
@@ -114,19 +113,11 @@ def MergeDexopt(temp_dir, output_target_files_dir):
os.path.join(output_target_files_dir, 'VENDOR'),
os.path.join(temp_dir, 'vendor'))
# The directory structure for flatteded APEXes is:
#
# SYSTEM
# apex
# <APEX name, e.g., com.android.wifi>
# apex_manifest.pb
# apex_pubkey
# etc/
# javalib/
# lib/
# lib64/
# priv-app/
#
# Extract APEX.
logging.info('extracting APEX')
apex_extract_root_dir = os.path.join(temp_dir, 'apex')
os.makedirs(apex_extract_root_dir)
# The directory structure for updatable APEXes is:
#
# SYSTEM
@@ -136,46 +127,33 @@ def MergeDexopt(temp_dir, output_target_files_dir):
# com.android.art.apex
# ...
apex_root = os.path.join(output_target_files_dir, 'SYSTEM', 'apex')
for apex in (glob.glob(os.path.join(apex_root, '*.apex')) +
glob.glob(os.path.join(apex_root, '*.capex'))):
logging.info(' apex: %s', apex)
# deapexer is in the same directory as the merge_target_files binary extracted
# from otatools.zip.
apex_json_info = subprocess.check_output(['deapexer', 'info', apex])
logging.info(' info: %s', apex_json_info)
apex_info = json.loads(apex_json_info)
apex_name = apex_info['name']
logging.info(' name: %s', apex_name)
# Check for flattended versus updatable APEX.
if OPTIONS.framework_misc_info.get('target_flatten_apex') == 'false':
# Extract APEX.
logging.info('extracting APEX')
apex_extract_dir = os.path.join(apex_extract_root_dir, apex_name)
os.makedirs(apex_extract_dir)
apex_extract_root_dir = os.path.join(temp_dir, 'apex')
os.makedirs(apex_extract_root_dir)
for apex in (glob.glob(os.path.join(apex_root, '*.apex')) +
glob.glob(os.path.join(apex_root, '*.capex'))):
logging.info(' apex: %s', apex)
# deapexer is in the same directory as the merge_target_files binary extracted
# from otatools.zip.
apex_json_info = subprocess.check_output(['deapexer', 'info', apex])
logging.info(' info: %s', apex_json_info)
apex_info = json.loads(apex_json_info)
apex_name = apex_info['name']
logging.info(' name: %s', apex_name)
apex_extract_dir = os.path.join(apex_extract_root_dir, apex_name)
os.makedirs(apex_extract_dir)
# deapexer uses debugfs_static, which is part of otatools.zip.
command = [
'deapexer',
'--debugfs_path',
'debugfs_static',
'--fsckerofs_path',
'fsck.erofs',
'extract',
apex,
apex_extract_dir,
]
logging.info(' running %s', command)
subprocess.check_call(command)
else:
# Flattened APEXes don't need to be extracted since they have the necessary
# directory structure.
os.symlink(os.path.join(apex_root), os.path.join(temp_dir, 'apex'))
# deapexer uses debugfs_static/fsck.erofs from otatools.zip.
command = [
'deapexer',
'--debugfs_path',
'debugfs_static',
'--fsckerofs_path',
'fsck.erofs',
'extract',
apex,
apex_extract_dir,
]
logging.info(' running %s', command)
subprocess.check_call(command)
# Modify system config to point to the tools that have been extracted.
# Absolute or .. paths are not allowed by the dexpreopt_gen tool in