Loading tools/releasetools/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -93,7 +93,9 @@ python_defaults { srcs: [ "edify_generator.py", "ota_from_target_files.py", "non_ab_ota.py", "target_files_diff.py", "ota_utils.py", ], libs: [ "releasetools_check_target_files_vintf", Loading tools/releasetools/check_target_files_vintf.py +46 −0 Original line number Diff line number Diff line Loading @@ -220,6 +220,52 @@ def CheckVintf(inp, info_dict=None): raise ValueError('{} is not a valid directory or zip file'.format(inp)) def CheckVintfIfTrebleEnabled(target_files, target_info): """Checks compatibility info of the input target files. Metadata used for compatibility verification is retrieved from target_zip. Compatibility should only be checked for devices that have enabled Treble support. Args: target_files: Path to zip file containing the source files to be included for OTA. Can also be the path to extracted directory. target_info: The BuildInfo instance that holds the target build info. """ # Will only proceed if the target has enabled the Treble support (as well as # having a /vendor partition). if not HasTrebleEnabled(target_files, target_info): return # Skip adding the compatibility package as a workaround for b/114240221. The # compatibility will always fail on devices without qualified kernels. if OPTIONS.skip_compatibility_check: return if not CheckVintf(target_files, target_info): raise RuntimeError("VINTF compatibility check failed") def HasTrebleEnabled(target_files, target_info): def HasVendorPartition(target_files): if os.path.isdir(target_files): return os.path.isdir(os.path.join(target_files, "VENDOR")) if zipfile.is_zipfile(target_files): return HasPartition(zipfile.ZipFile(target_files), "vendor") raise ValueError("Unknown target_files argument") return (HasVendorPartition(target_files) and target_info.GetBuildProp("ro.treble.enabled") == "true") def HasPartition(target_files_zip, partition): try: target_files_zip.getinfo(partition.upper() + "/") return True except KeyError: return False def main(argv): args = common.ParseOptions(argv, __doc__) Loading Loading
tools/releasetools/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -93,7 +93,9 @@ python_defaults { srcs: [ "edify_generator.py", "ota_from_target_files.py", "non_ab_ota.py", "target_files_diff.py", "ota_utils.py", ], libs: [ "releasetools_check_target_files_vintf", Loading
tools/releasetools/check_target_files_vintf.py +46 −0 Original line number Diff line number Diff line Loading @@ -220,6 +220,52 @@ def CheckVintf(inp, info_dict=None): raise ValueError('{} is not a valid directory or zip file'.format(inp)) def CheckVintfIfTrebleEnabled(target_files, target_info): """Checks compatibility info of the input target files. Metadata used for compatibility verification is retrieved from target_zip. Compatibility should only be checked for devices that have enabled Treble support. Args: target_files: Path to zip file containing the source files to be included for OTA. Can also be the path to extracted directory. target_info: The BuildInfo instance that holds the target build info. """ # Will only proceed if the target has enabled the Treble support (as well as # having a /vendor partition). if not HasTrebleEnabled(target_files, target_info): return # Skip adding the compatibility package as a workaround for b/114240221. The # compatibility will always fail on devices without qualified kernels. if OPTIONS.skip_compatibility_check: return if not CheckVintf(target_files, target_info): raise RuntimeError("VINTF compatibility check failed") def HasTrebleEnabled(target_files, target_info): def HasVendorPartition(target_files): if os.path.isdir(target_files): return os.path.isdir(os.path.join(target_files, "VENDOR")) if zipfile.is_zipfile(target_files): return HasPartition(zipfile.ZipFile(target_files), "vendor") raise ValueError("Unknown target_files argument") return (HasVendorPartition(target_files) and target_info.GetBuildProp("ro.treble.enabled") == "true") def HasPartition(target_files_zip, partition): try: target_files_zip.getinfo(partition.upper() + "/") return True except KeyError: return False def main(argv): args = common.ParseOptions(argv, __doc__) Loading