Loading tools/releasetools/common.py +7 −0 Original line number Diff line number Diff line Loading @@ -3953,3 +3953,10 @@ def AddCareMapForAbOta(output_file, ab_partitions, image_paths): OPTIONS.replace_updated_files_list.append(care_map_path) else: ZipWrite(output_file, temp_care_map, arcname=care_map_path) def IsSparseImage(filepath): with open(filepath, 'rb') as fp: # Magic for android sparse image format # https://source.android.com/devices/bootloader/images return fp.read(4) == b'\x3A\xFF\x26\xED' tools/releasetools/ota_from_target_files.py +1 −7 Original line number Diff line number Diff line Loading @@ -251,6 +251,7 @@ import common import ota_utils from ota_utils import (UNZIP_PATTERN, FinalizeMetadata, GetPackageMetadata, PropertyFiles, SECURITY_PATCH_LEVEL_PROP_NAME, GetZipEntryOffset) from common import IsSparseImage import target_files_diff from check_target_files_vintf import CheckVintfIfTrebleEnabled from non_ab_ota import GenerateNonAbOtaPackage Loading Loading @@ -1021,13 +1022,6 @@ def GeneratePartitionTimestampFlagsDowngrade( ] def IsSparseImage(filepath): with open(filepath, 'rb') as fp: # Magic for android sparse image format # https://source.android.com/devices/bootloader/images return fp.read(4) == b'\x3A\xFF\x26\xED' def SupportsMainlineGkiUpdates(target_file): """Return True if the build supports MainlineGKIUpdates. Loading tools/releasetools/validate_target_files.py +12 −4 Original line number Diff line number Diff line Loading @@ -36,7 +36,9 @@ import logging import os.path import re import zipfile from hashlib import sha1 from common import IsSparseImage import common import rangelib Loading Loading @@ -71,6 +73,12 @@ def ValidateFileConsistency(input_zip, input_tmp, info_dict): def CheckAllFiles(which): logging.info('Checking %s image.', which) path = os.path.join(input_tmp, "IMAGES", which + ".img") if not IsSparseImage(path): logging.info("%s is non-sparse image", which) image = common.GetNonSparseImage(which, input_tmp) else: logging.info("%s is sparse image", which) # Allow having shared blocks when loading the sparse image, because allowing # that doesn't affect the checks below (we will have all the blocks on file, # unless it's skipped due to the holes). Loading Loading
tools/releasetools/common.py +7 −0 Original line number Diff line number Diff line Loading @@ -3953,3 +3953,10 @@ def AddCareMapForAbOta(output_file, ab_partitions, image_paths): OPTIONS.replace_updated_files_list.append(care_map_path) else: ZipWrite(output_file, temp_care_map, arcname=care_map_path) def IsSparseImage(filepath): with open(filepath, 'rb') as fp: # Magic for android sparse image format # https://source.android.com/devices/bootloader/images return fp.read(4) == b'\x3A\xFF\x26\xED'
tools/releasetools/ota_from_target_files.py +1 −7 Original line number Diff line number Diff line Loading @@ -251,6 +251,7 @@ import common import ota_utils from ota_utils import (UNZIP_PATTERN, FinalizeMetadata, GetPackageMetadata, PropertyFiles, SECURITY_PATCH_LEVEL_PROP_NAME, GetZipEntryOffset) from common import IsSparseImage import target_files_diff from check_target_files_vintf import CheckVintfIfTrebleEnabled from non_ab_ota import GenerateNonAbOtaPackage Loading Loading @@ -1021,13 +1022,6 @@ def GeneratePartitionTimestampFlagsDowngrade( ] def IsSparseImage(filepath): with open(filepath, 'rb') as fp: # Magic for android sparse image format # https://source.android.com/devices/bootloader/images return fp.read(4) == b'\x3A\xFF\x26\xED' def SupportsMainlineGkiUpdates(target_file): """Return True if the build supports MainlineGKIUpdates. Loading
tools/releasetools/validate_target_files.py +12 −4 Original line number Diff line number Diff line Loading @@ -36,7 +36,9 @@ import logging import os.path import re import zipfile from hashlib import sha1 from common import IsSparseImage import common import rangelib Loading Loading @@ -71,6 +73,12 @@ def ValidateFileConsistency(input_zip, input_tmp, info_dict): def CheckAllFiles(which): logging.info('Checking %s image.', which) path = os.path.join(input_tmp, "IMAGES", which + ".img") if not IsSparseImage(path): logging.info("%s is non-sparse image", which) image = common.GetNonSparseImage(which, input_tmp) else: logging.info("%s is sparse image", which) # Allow having shared blocks when loading the sparse image, because allowing # that doesn't affect the checks below (we will have all the blocks on file, # unless it's skipped due to the holes). Loading