Merge "Expose GetRamdiskFormat and use in ota_utils.py"
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 4010f35..374babf 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -725,7 +725,7 @@
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 @@
# 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 @@
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 @@
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
diff --git a/tools/releasetools/ota_utils.py b/tools/releasetools/ota_utils.py
index 5d403dc..7ae221a 100644
--- a/tools/releasetools/ota_utils.py
+++ b/tools/releasetools/ota_utils.py
@@ -22,7 +22,8 @@
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 @@
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))