Fix a failure in signing test
Pixel moved away from sparse images, so validate_target_files is failing because it expects sparse images. Test: th Change-Id: I322ff10c2afbacfb4d78991be60c11aac92a6d4c
This commit is contained in:
parent
1e392720c2
commit
2639048c21
3 changed files with 20 additions and 11 deletions
|
@ -3953,3 +3953,10 @@ def AddCareMapForAbOta(output_file, ab_partitions, image_paths):
|
||||||
OPTIONS.replace_updated_files_list.append(care_map_path)
|
OPTIONS.replace_updated_files_list.append(care_map_path)
|
||||||
else:
|
else:
|
||||||
ZipWrite(output_file, temp_care_map, arcname=care_map_path)
|
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'
|
||||||
|
|
|
@ -251,6 +251,7 @@ import common
|
||||||
import ota_utils
|
import ota_utils
|
||||||
from ota_utils import (UNZIP_PATTERN, FinalizeMetadata, GetPackageMetadata,
|
from ota_utils import (UNZIP_PATTERN, FinalizeMetadata, GetPackageMetadata,
|
||||||
PropertyFiles, SECURITY_PATCH_LEVEL_PROP_NAME, GetZipEntryOffset)
|
PropertyFiles, SECURITY_PATCH_LEVEL_PROP_NAME, GetZipEntryOffset)
|
||||||
|
from common import IsSparseImage
|
||||||
import target_files_diff
|
import target_files_diff
|
||||||
from check_target_files_vintf import CheckVintfIfTrebleEnabled
|
from check_target_files_vintf import CheckVintfIfTrebleEnabled
|
||||||
from non_ab_ota import GenerateNonAbOtaPackage
|
from non_ab_ota import GenerateNonAbOtaPackage
|
||||||
|
@ -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):
|
def SupportsMainlineGkiUpdates(target_file):
|
||||||
"""Return True if the build supports MainlineGKIUpdates.
|
"""Return True if the build supports MainlineGKIUpdates.
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,9 @@ import logging
|
||||||
import os.path
|
import os.path
|
||||||
import re
|
import re
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
from hashlib import sha1
|
from hashlib import sha1
|
||||||
|
from common import IsSparseImage
|
||||||
|
|
||||||
import common
|
import common
|
||||||
import rangelib
|
import rangelib
|
||||||
|
@ -71,10 +73,16 @@ def ValidateFileConsistency(input_zip, input_tmp, info_dict):
|
||||||
|
|
||||||
def CheckAllFiles(which):
|
def CheckAllFiles(which):
|
||||||
logging.info('Checking %s image.', which)
|
logging.info('Checking %s image.', which)
|
||||||
# Allow having shared blocks when loading the sparse image, because allowing
|
path = os.path.join(input_tmp, "IMAGES", which + ".img")
|
||||||
# that doesn't affect the checks below (we will have all the blocks on file,
|
if not IsSparseImage(path):
|
||||||
# unless it's skipped due to the holes).
|
logging.info("%s is non-sparse image", which)
|
||||||
image = common.GetSparseImage(which, input_tmp, input_zip, True)
|
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).
|
||||||
|
image = common.GetSparseImage(which, input_tmp, input_zip, True)
|
||||||
prefix = '/' + which
|
prefix = '/' + which
|
||||||
for entry in image.file_map:
|
for entry in image.file_map:
|
||||||
# Skip entries like '__NONZERO-0'.
|
# Skip entries like '__NONZERO-0'.
|
||||||
|
|
Loading…
Reference in a new issue