Merge "Deprecate VNDK v27"
This commit is contained in:
@@ -256,8 +256,9 @@ def get_args():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
'vndk_version',
|
||||
type=int,
|
||||
help='VNDK snapshot version to check, e.g. "27".')
|
||||
type=utils.vndk_version_int,
|
||||
help='VNDK snapshot version to check, e.g. "{}".'.format(
|
||||
utils.MINIMUM_VNDK_VERSION))
|
||||
parser.add_argument('-b', '--branch', help='Branch to pull manifest from.')
|
||||
parser.add_argument('--build', help='Build number to pull manifest from.')
|
||||
parser.add_argument(
|
||||
|
||||
@@ -72,7 +72,7 @@ class GenBuildFile(object):
|
||||
Args:
|
||||
install_dir: string, absolute path to the prebuilts/vndk/v{version}
|
||||
directory where the build files will be generated.
|
||||
vndk_version: int, VNDK snapshot version (e.g., 27, 28)
|
||||
vndk_version: int, VNDK snapshot version (e.g. 30)
|
||||
"""
|
||||
self._install_dir = install_dir
|
||||
self._vndk_version = vndk_version
|
||||
@@ -191,9 +191,7 @@ class GenBuildFile(object):
|
||||
pass
|
||||
|
||||
variant_subpath = arch
|
||||
# For O-MR1 snapshot (v27), 32-bit binder prebuilts are not
|
||||
# isolated in separate 'binder32' subdirectory.
|
||||
if is_binder32 and self._vndk_version >= 28:
|
||||
if is_binder32:
|
||||
variant_subpath = os.path.join(arch, utils.BINDER32)
|
||||
variant_path = os.path.join(self._install_dir, variant_subpath)
|
||||
bpfile_path = os.path.join(variant_path, 'Android.bp')
|
||||
@@ -226,16 +224,6 @@ class GenBuildFile(object):
|
||||
|
||||
logging.info('Successfully generated {}'.format(bpfile_path))
|
||||
|
||||
if self._vndk_version == 27:
|
||||
# For O-MR1 snapshot (v27), 32-bit binder prebuilts are not
|
||||
# isolated in separate 'binder32' subdirectory.
|
||||
for arch in self._snapshot_archs:
|
||||
if arch in ('arm', 'x86'):
|
||||
gen_for_variant(arch, is_binder32=True)
|
||||
else:
|
||||
gen_for_variant(arch)
|
||||
return
|
||||
|
||||
for arch in self._snapshot_archs:
|
||||
if os.path.isdir(
|
||||
os.path.join(self._install_dir, arch, utils.BINDER32)):
|
||||
@@ -481,9 +469,7 @@ class GenBuildFile(object):
|
||||
return arch_props
|
||||
|
||||
src_root = os.path.join(self._install_dir, arch)
|
||||
# For O-MR1 snapshot (v27), 32-bit binder prebuilts are not
|
||||
# isolated in separate 'binder32' subdirectory.
|
||||
if is_binder32 and self._vndk_version >= 28:
|
||||
if is_binder32:
|
||||
src_root = os.path.join(src_root, utils.BINDER32)
|
||||
|
||||
src_paths = utils.find(src_root, [prebuilt])
|
||||
@@ -542,8 +528,9 @@ def get_args():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
'vndk_version',
|
||||
type=int,
|
||||
help='VNDK snapshot version to install, e.g. "27".')
|
||||
type=utils.vndk_version_int,
|
||||
help='VNDK snapshot version to install, e.g. "{}".'.format(
|
||||
utils.MINIMUM_VNDK_VERSION))
|
||||
parser.add_argument(
|
||||
'-v',
|
||||
'--verbose',
|
||||
|
||||
@@ -116,40 +116,19 @@ def gather_notice_files(install_dir):
|
||||
|
||||
|
||||
def post_processe_files_if_needed(vndk_version):
|
||||
"""For O-MR1, replaces unversioned VNDK directories with versioned ones.
|
||||
Also, renames ld.config.txt, llndk.libraries.txt and vndksp.libraries.txt
|
||||
"""Renames vndkcore.libraries.txt and vndksp.libraries.txt
|
||||
files to have version suffix.
|
||||
|
||||
Unversioned VNDK directories: /system/${LIB}/vndk[-sp]
|
||||
Versioned VNDK directories: /system/${LIB}/vndk[-sp]-27
|
||||
|
||||
Args:
|
||||
vndk_version: int, version of VNDK snapshot
|
||||
"""
|
||||
def add_version_suffix(file_name):
|
||||
logging.info('Rename {} to have version suffix'.format(vndk_version))
|
||||
logging.info('Rename {} to have version suffix'.format(file_name))
|
||||
target_files = glob.glob(
|
||||
os.path.join(utils.CONFIG_DIR_PATH_PATTERN, file_name))
|
||||
for target_file in target_files:
|
||||
name, ext = os.path.splitext(target_file)
|
||||
os.rename(target_file, name + '.' + str(vndk_version) + ext)
|
||||
if vndk_version == 27:
|
||||
logging.info('Revising ld.config.txt for O-MR1...')
|
||||
re_pattern = '(system\/\${LIB}\/vndk(?:-sp)?)([:/]|$)'
|
||||
VNDK_INSTALL_DIR_RE = re.compile(re_pattern, flags=re.MULTILINE)
|
||||
ld_config_txt_paths = glob.glob(
|
||||
os.path.join(utils.CONFIG_DIR_PATH_PATTERN, 'ld.config*'))
|
||||
for ld_config_file in ld_config_txt_paths:
|
||||
with open(ld_config_file, 'r') as file:
|
||||
revised = VNDK_INSTALL_DIR_RE.sub(r'\1-27\2', file.read())
|
||||
with open(ld_config_file, 'w') as file:
|
||||
file.write(revised)
|
||||
|
||||
files_to_add_version_suffix = ('ld.config.txt',
|
||||
'llndk.libraries.txt',
|
||||
'vndksp.libraries.txt')
|
||||
for file_to_rename in files_to_add_version_suffix:
|
||||
add_version_suffix(file_to_rename)
|
||||
|
||||
files_to_enforce_version_suffix = ('vndkcore.libraries.txt',
|
||||
'vndkprivate.libraries.txt')
|
||||
@@ -191,8 +170,9 @@ def get_args():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
'vndk_version',
|
||||
type=int,
|
||||
help='VNDK snapshot version to install, e.g. "27".')
|
||||
type=utils.vndk_version_int,
|
||||
help='VNDK snapshot version to install, e.g. "{}".'.format(
|
||||
utils.MINIMUM_VNDK_VERSION))
|
||||
parser.add_argument('-b', '--branch', help='Branch to pull build from.')
|
||||
parser.add_argument('--build', help='Build number to pull.')
|
||||
parser.add_argument(
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#
|
||||
"""Utility functions for VNDK snapshot."""
|
||||
|
||||
import argparse
|
||||
import glob
|
||||
import logging
|
||||
import os
|
||||
@@ -35,6 +36,7 @@ MODULE_PATHS_FILE_NAME = 'module_paths.txt'
|
||||
NOTICE_FILES_DIR_NAME = 'NOTICE_FILES'
|
||||
NOTICE_FILES_DIR_PATH = os.path.join(COMMON_DIR_PATH, NOTICE_FILES_DIR_NAME)
|
||||
BINDER32 = 'binder32'
|
||||
MINIMUM_VNDK_VERSION = 28
|
||||
|
||||
|
||||
def set_logging_config(verbose_level):
|
||||
@@ -57,6 +59,19 @@ def check_output(cmd):
|
||||
return output
|
||||
|
||||
|
||||
def vndk_version_int(vndk_version):
|
||||
"""Used for a type keyword argument in the argparse.
|
||||
It checks if vndk version is in the supported versions.
|
||||
"""
|
||||
version_int = int(vndk_version)
|
||||
if version_int < MINIMUM_VNDK_VERSION:
|
||||
raise argparse.ArgumentTypeError(
|
||||
'The VNDK version {input} is not supported. '
|
||||
'It must be no smaller than {min_vndk}.'.format(
|
||||
input=version_int, min_vndk=MINIMUM_VNDK_VERSION))
|
||||
return version_int
|
||||
|
||||
|
||||
def get_android_build_top():
|
||||
ANDROID_BUILD_TOP = os.getenv('ANDROID_BUILD_TOP')
|
||||
if not ANDROID_BUILD_TOP:
|
||||
|
||||
Reference in New Issue
Block a user