Merge "Use fstab in the source build"
This commit is contained in:
@@ -20,11 +20,15 @@ class EdifyGenerator(object):
|
|||||||
"""Class to generate scripts in the 'edify' recovery script language
|
"""Class to generate scripts in the 'edify' recovery script language
|
||||||
used from donut onwards."""
|
used from donut onwards."""
|
||||||
|
|
||||||
def __init__(self, version, info):
|
def __init__(self, version, info, fstab=None):
|
||||||
self.script = []
|
self.script = []
|
||||||
self.mounts = set()
|
self.mounts = set()
|
||||||
self.version = version
|
self.version = version
|
||||||
self.info = info
|
self.info = info
|
||||||
|
if fstab is None:
|
||||||
|
self.fstab = self.info.get("fstab", None)
|
||||||
|
else:
|
||||||
|
self.fstab = fstab
|
||||||
|
|
||||||
def MakeTemporary(self):
|
def MakeTemporary(self):
|
||||||
"""Make a temporary script object whose commands can latter be
|
"""Make a temporary script object whose commands can latter be
|
||||||
@@ -168,7 +172,7 @@ class EdifyGenerator(object):
|
|||||||
where option is optname[=optvalue]
|
where option is optname[=optvalue]
|
||||||
E.g. ext4=barrier=1,nodelalloc,errors=panic|f2fs=errors=recover
|
E.g. ext4=barrier=1,nodelalloc,errors=panic|f2fs=errors=recover
|
||||||
"""
|
"""
|
||||||
fstab = self.info.get("fstab", None)
|
fstab = self.fstab
|
||||||
if fstab:
|
if fstab:
|
||||||
p = fstab[mount_point]
|
p = fstab[mount_point]
|
||||||
mount_dict = {}
|
mount_dict = {}
|
||||||
@@ -202,7 +206,7 @@ class EdifyGenerator(object):
|
|||||||
self.script.append('ui_print("%s");' % (message,))
|
self.script.append('ui_print("%s");' % (message,))
|
||||||
|
|
||||||
def TunePartition(self, partition, *options):
|
def TunePartition(self, partition, *options):
|
||||||
fstab = self.info.get("fstab", None)
|
fstab = self.fstab
|
||||||
if fstab:
|
if fstab:
|
||||||
p = fstab[partition]
|
p = fstab[partition]
|
||||||
if p.fs_type not in ("ext2", "ext3", "ext4"):
|
if p.fs_type not in ("ext2", "ext3", "ext4"):
|
||||||
@@ -216,7 +220,7 @@ class EdifyGenerator(object):
|
|||||||
"""Format the given partition, specified by its mount point (eg,
|
"""Format the given partition, specified by its mount point (eg,
|
||||||
"/system")."""
|
"/system")."""
|
||||||
|
|
||||||
fstab = self.info.get("fstab", None)
|
fstab = self.fstab
|
||||||
if fstab:
|
if fstab:
|
||||||
p = fstab[partition]
|
p = fstab[partition]
|
||||||
self.script.append('format("%s", "%s", "%s", "%s", "%s");' %
|
self.script.append('format("%s", "%s", "%s", "%s", "%s");' %
|
||||||
@@ -226,7 +230,7 @@ class EdifyGenerator(object):
|
|||||||
def WipeBlockDevice(self, partition):
|
def WipeBlockDevice(self, partition):
|
||||||
if partition not in ("/system", "/vendor"):
|
if partition not in ("/system", "/vendor"):
|
||||||
raise ValueError(("WipeBlockDevice doesn't work on %s\n") % (partition,))
|
raise ValueError(("WipeBlockDevice doesn't work on %s\n") % (partition,))
|
||||||
fstab = self.info.get("fstab", None)
|
fstab = self.fstab
|
||||||
size = self.info.get(partition.lstrip("/") + "_size", None)
|
size = self.info.get(partition.lstrip("/") + "_size", None)
|
||||||
device = fstab[partition].device
|
device = fstab[partition].device
|
||||||
|
|
||||||
@@ -271,7 +275,7 @@ class EdifyGenerator(object):
|
|||||||
"""Write the given package file into the partition for the given
|
"""Write the given package file into the partition for the given
|
||||||
mount point."""
|
mount point."""
|
||||||
|
|
||||||
fstab = self.info["fstab"]
|
fstab = self.fstab
|
||||||
if fstab:
|
if fstab:
|
||||||
p = fstab[mount_point]
|
p = fstab[mount_point]
|
||||||
partition_type = common.PARTITION_TYPES[p.fs_type]
|
partition_type = common.PARTITION_TYPES[p.fs_type]
|
||||||
|
@@ -486,8 +486,9 @@ def GetImage(which, tmpdir, info_dict):
|
|||||||
|
|
||||||
def WriteFullOTAPackage(input_zip, output_zip):
|
def WriteFullOTAPackage(input_zip, output_zip):
|
||||||
# TODO: how to determine this? We don't know what version it will
|
# TODO: how to determine this? We don't know what version it will
|
||||||
# be installed on top of. For now, we expect the API just won't
|
# be installed on top of. For now, we expect the API just won't
|
||||||
# change very often.
|
# change very often. Similarly for fstab, it might have changed
|
||||||
|
# in the target build.
|
||||||
script = edify_generator.EdifyGenerator(3, OPTIONS.info_dict)
|
script = edify_generator.EdifyGenerator(3, OPTIONS.info_dict)
|
||||||
|
|
||||||
oem_props = OPTIONS.info_dict.get("oem_fingerprint_properties")
|
oem_props = OPTIONS.info_dict.get("oem_fingerprint_properties")
|
||||||
@@ -727,8 +728,9 @@ def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_zip):
|
|||||||
if source_version == 0:
|
if source_version == 0:
|
||||||
print ("WARNING: generating edify script for a source that "
|
print ("WARNING: generating edify script for a source that "
|
||||||
"can't install it.")
|
"can't install it.")
|
||||||
script = edify_generator.EdifyGenerator(source_version,
|
script = edify_generator.EdifyGenerator(
|
||||||
OPTIONS.target_info_dict)
|
source_version, OPTIONS.target_info_dict,
|
||||||
|
fstab=OPTIONS.source_info_dict["fstab"])
|
||||||
|
|
||||||
metadata = {
|
metadata = {
|
||||||
"pre-device": GetBuildProp("ro.product.device",
|
"pre-device": GetBuildProp("ro.product.device",
|
||||||
@@ -794,7 +796,7 @@ def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_zip):
|
|||||||
vendor_diff = None
|
vendor_diff = None
|
||||||
|
|
||||||
oem_props = OPTIONS.target_info_dict.get("oem_fingerprint_properties")
|
oem_props = OPTIONS.target_info_dict.get("oem_fingerprint_properties")
|
||||||
recovery_mount_options = OPTIONS.target_info_dict.get(
|
recovery_mount_options = OPTIONS.source_info_dict.get(
|
||||||
"recovery_mount_options")
|
"recovery_mount_options")
|
||||||
oem_dict = None
|
oem_dict = None
|
||||||
if oem_props is not None and len(oem_props) > 0:
|
if oem_props is not None and len(oem_props) > 0:
|
||||||
@@ -1115,11 +1117,13 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
|
|||||||
if source_version == 0:
|
if source_version == 0:
|
||||||
print ("WARNING: generating edify script for a source that "
|
print ("WARNING: generating edify script for a source that "
|
||||||
"can't install it.")
|
"can't install it.")
|
||||||
script = edify_generator.EdifyGenerator(source_version,
|
script = edify_generator.EdifyGenerator(
|
||||||
OPTIONS.target_info_dict)
|
source_version, OPTIONS.target_info_dict,
|
||||||
|
fstab=OPTIONS.source_info_dict["fstab"])
|
||||||
|
|
||||||
oem_props = OPTIONS.info_dict.get("oem_fingerprint_properties")
|
oem_props = OPTIONS.info_dict.get("oem_fingerprint_properties")
|
||||||
recovery_mount_options = OPTIONS.info_dict.get("recovery_mount_options")
|
recovery_mount_options = OPTIONS.source_info_dict.get(
|
||||||
|
"recovery_mount_options")
|
||||||
oem_dict = None
|
oem_dict = None
|
||||||
if oem_props is not None and len(oem_props) > 0:
|
if oem_props is not None and len(oem_props) > 0:
|
||||||
if OPTIONS.oem_source is None:
|
if OPTIONS.oem_source is None:
|
||||||
|
Reference in New Issue
Block a user