Merge "vndk-snapshot: add version suffix for v27 files"
diff --git a/vndk/snapshot/gen_buildfiles.py b/vndk/snapshot/gen_buildfiles.py
index 9a8d4de..f504f55 100644
--- a/vndk/snapshot/gen_buildfiles.py
+++ b/vndk/snapshot/gen_buildfiles.py
@@ -129,11 +129,10 @@
self._vndk_version))
etc_buildrules = []
for prebuilt in self.ETC_MODULES:
- # Starting from P (VNDK version >= 28), ld.config.VER.txt is not
- # installed as a prebuilt but is built and installed from the
- # source tree at the time the VNDK snapshot is installed to the
- # system.img.
- if prebuilt == 'ld.config.txt' and self._vndk_version >= 28:
+ # ld.config.VER.txt is not installed as a prebuilt but is built and
+ # installed from thesource tree at the time the VNDK snapshot is
+ # installed to the system.img.
+ if prebuilt == 'ld.config.txt':
continue
etc_buildrules.append(self._gen_etc_prebuilt(prebuilt))
diff --git a/vndk/snapshot/update.py b/vndk/snapshot/update.py
index d15cf04..2a8441e 100644
--- a/vndk/snapshot/update.py
+++ b/vndk/snapshot/update.py
@@ -115,8 +115,10 @@
shutil.rmtree(notices_dir_per_arch)
-def revise_ld_config_txt_if_needed(vndk_version):
+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
+ files to have version suffix.
Unversioned VNDK directories: /system/${LIB}/vndk[-sp]
Versioned VNDK directories: /system/${LIB}/vndk[-sp]-27
@@ -124,6 +126,13 @@
Args:
vndk_version: int, version of VNDK snapshot
"""
+ def add_version_suffix(file_name):
+ logging.info('Rename {} to have version suffix'.format(vndk_version))
+ 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)?)([:/]|$)'
@@ -136,6 +145,12 @@
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)
+
def update_buildfiles(buildfile_generator):
logging.info('Generating root Android.bp file...')
@@ -248,7 +263,7 @@
install_snapshot(args.branch, args.build, local, install_dir,
temp_artifact_dir)
gather_notice_files(install_dir)
- revise_ld_config_txt_if_needed(vndk_version)
+ post_processe_files_if_needed(vndk_version)
buildfile_generator = GenBuildFile(install_dir, vndk_version)
update_buildfiles(buildfile_generator)