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