Merge "Expose GetRamdiskFormat and use in ota_utils.py" am: 98050a4e97
Original change: https://android-review.googlesource.com/c/platform/build/+/2084045 Change-Id: Idef4053429bbabd96047a2e0624b77d4a3d80f70 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -725,7 +725,7 @@ class RamdiskFormat(object):
|
||||
GZ = 2
|
||||
|
||||
|
||||
def _GetRamdiskFormat(info_dict):
|
||||
def GetRamdiskFormat(info_dict):
|
||||
if info_dict.get('lz4_ramdisks') == 'true':
|
||||
ramdisk_format = RamdiskFormat.LZ4
|
||||
else:
|
||||
@@ -834,7 +834,7 @@ def LoadInfoDict(input_file, repacking=False):
|
||||
|
||||
# Load recovery fstab if applicable.
|
||||
d["fstab"] = _FindAndLoadRecoveryFstab(d, input_file, read_helper)
|
||||
ramdisk_format = _GetRamdiskFormat(d)
|
||||
ramdisk_format = GetRamdiskFormat(d)
|
||||
|
||||
# Tries to load the build props for all partitions with care_map, including
|
||||
# system and vendor.
|
||||
@@ -1579,7 +1579,7 @@ def _BuildBootableImage(image_name, sourcedir, fs_config_file, info_dict=None,
|
||||
img = tempfile.NamedTemporaryFile()
|
||||
|
||||
if has_ramdisk:
|
||||
ramdisk_format = _GetRamdiskFormat(info_dict)
|
||||
ramdisk_format = GetRamdiskFormat(info_dict)
|
||||
ramdisk_img = _MakeRamdisk(sourcedir, fs_config_file,
|
||||
ramdisk_format=ramdisk_format)
|
||||
|
||||
@@ -1860,7 +1860,7 @@ def _BuildVendorBootImage(sourcedir, partition_name, info_dict=None):
|
||||
|
||||
img = tempfile.NamedTemporaryFile()
|
||||
|
||||
ramdisk_format = _GetRamdiskFormat(info_dict)
|
||||
ramdisk_format = GetRamdiskFormat(info_dict)
|
||||
ramdisk_img = _MakeRamdisk(sourcedir, ramdisk_format=ramdisk_format)
|
||||
|
||||
# use MKBOOTIMG from environ, or "mkbootimg" if empty or not set
|
||||
|
@@ -22,7 +22,8 @@ import zipfile
|
||||
import ota_metadata_pb2
|
||||
from common import (ZipDelete, ZipClose, OPTIONS, MakeTempFile,
|
||||
ZipWriteStr, BuildInfo, LoadDictionaryFromFile,
|
||||
SignFile, PARTITIONS_WITH_BUILD_PROP, PartitionBuildProps)
|
||||
SignFile, PARTITIONS_WITH_BUILD_PROP, PartitionBuildProps,
|
||||
GetRamdiskFormat)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -371,15 +372,18 @@ def ComputeRuntimeBuildInfos(default_build_info, boot_variable_values):
|
||||
for partition in PARTITIONS_WITH_BUILD_PROP:
|
||||
partition_prop_key = "{}.build.prop".format(partition)
|
||||
input_file = info_dict[partition_prop_key].input_file
|
||||
ramdisk = GetRamdiskFormat(info_dict)
|
||||
if isinstance(input_file, zipfile.ZipFile):
|
||||
with zipfile.ZipFile(input_file.filename, allowZip64=True) as input_zip:
|
||||
info_dict[partition_prop_key] = \
|
||||
PartitionBuildProps.FromInputFile(input_zip, partition,
|
||||
placeholder_values)
|
||||
placeholder_values,
|
||||
ramdisk)
|
||||
else:
|
||||
info_dict[partition_prop_key] = \
|
||||
PartitionBuildProps.FromInputFile(input_file, partition,
|
||||
placeholder_values)
|
||||
placeholder_values,
|
||||
ramdisk)
|
||||
info_dict["build.prop"] = info_dict["system.build.prop"]
|
||||
build_info_set.add(BuildInfo(info_dict, default_build_info.oem_dicts))
|
||||
|
||||
|
Reference in New Issue
Block a user