am 7cd99bad: Allow info_dict from target_files to specify mount options

* commit '7cd99bad210455dc57702b7cbf674a588a5eb028':
  Allow info_dict from target_files to specify mount options
This commit is contained in:
Michael Runge 2014-10-23 21:57:10 +00:00 committed by Android Git Automerger
commit 10ba565431
2 changed files with 27 additions and 11 deletions

View File

@ -164,14 +164,25 @@ class EdifyGenerator(object):
self.script.append(('apply_patch_space(%d) || abort("Not enough free space '
'on /system to apply patches.");') % (amount,))
def Mount(self, mount_point):
"""Mount the partition with the given mount_point."""
def Mount(self, mount_point, mount_options_by_format=""):
"""Mount the partition with the given mount_point.
mount_options_by_format:
[fs_type=option[,option]...[|fs_type=option[,option]...]...]
where option is optname[=optvalue]
E.g. ext4=barrier=1,nodelalloc,errors=panic|f2fs=errors=recover
"""
fstab = self.info.get("fstab", None)
if fstab:
p = fstab[mount_point]
self.script.append('mount("%s", "%s", "%s", "%s");' %
mount_dict = {}
if mount_options_by_format is not None:
for option in mount_options_by_format.split("|"):
if "=" in option:
key, value = option.split("=", 1)
mount_dict[key] = value
self.script.append('mount("%s", "%s", "%s", "%s", "%s");' %
(p.fs_type, common.PARTITION_TYPES[p.fs_type],
p.device, p.mount_point))
p.device, p.mount_point, mount_dict.get(p.fs_type, "")))
self.mounts.add(p.mount_point)
def UnpackPackageDir(self, src, dst):

View File

@ -462,11 +462,12 @@ def WriteFullOTAPackage(input_zip, output_zip):
script = edify_generator.EdifyGenerator(3, OPTIONS.info_dict)
oem_props = OPTIONS.info_dict.get("oem_fingerprint_properties")
recovery_mount_options = OPTIONS.info_dict.get("recovery_mount_options")
oem_dict = None
if oem_props is not None and len(oem_props) > 0:
if OPTIONS.oem_source is None:
raise common.ExternalError("OEM source required for this build")
script.Mount("/oem")
script.Mount("/oem", recovery_mount_options)
oem_dict = common.LoadDictionaryFromLines(open(OPTIONS.oem_source).readlines())
metadata = {"post-build": CalculateFingerprint(
@ -548,6 +549,8 @@ else if get_stage("%(bcb_dev)s", "stage") == "3/3" then
if "selinux_fc" in OPTIONS.info_dict:
WritePolicyConfig(OPTIONS.info_dict["selinux_fc"], output_zip)
recovery_mount_options = OPTIONS.info_dict.get("recovery_mount_options")
system_items = ItemSet("system", "META/filesystem_config.txt")
script.ShowProgress(system_progress, 0)
if block_based:
@ -561,7 +564,7 @@ else if get_stage("%(bcb_dev)s", "stage") == "3/3" then
system_diff.WriteScript(script, output_zip)
else:
script.FormatPartition("/system")
script.Mount("/system")
script.Mount("/system", recovery_mount_options)
if not has_recovery_patch:
script.UnpackPackageDir("recovery", "/system")
script.UnpackPackageDir("system", "/system")
@ -594,7 +597,7 @@ else if get_stage("%(bcb_dev)s", "stage") == "3/3" then
vendor_diff.WriteScript(script, output_zip)
else:
script.FormatPartition("/vendor")
script.Mount("/vendor")
script.Mount("/vendor", recovery_mount_options)
script.UnpackPackageDir("vendor", "/vendor")
symlinks = CopyPartitionFiles(vendor_items, input_zip, output_zip)
@ -745,11 +748,12 @@ def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_zip):
vendor_diff = None
oem_props = OPTIONS.target_info_dict.get("oem_fingerprint_properties")
recovery_mount_options = OPTIONS.target_info_dict.get("recovery_mount_options")
oem_dict = None
if oem_props is not None and len(oem_props) > 0:
if OPTIONS.oem_source is None:
raise common.ExternalError("OEM source required for this build")
script.Mount("/oem")
script.Mount("/oem", recovery_mount_options)
oem_dict = common.LoadDictionaryFromLines(open(OPTIONS.oem_source).readlines())
AppendAssertions(script, OPTIONS.target_info_dict, oem_dict)
@ -1035,11 +1039,12 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
OPTIONS.target_info_dict)
oem_props = OPTIONS.info_dict.get("oem_fingerprint_properties")
recovery_mount_options = OPTIONS.info_dict.get("recovery_mount_options")
oem_dict = None
if oem_props is not None and len(oem_props) > 0:
if OPTIONS.oem_source is None:
raise common.ExternalError("OEM source required for this build")
script.Mount("/oem")
script.Mount("/oem", recovery_mount_options)
oem_dict = common.LoadDictionaryFromLines(open(OPTIONS.oem_source).readlines())
metadata = {"pre-device": GetOemProperty("ro.product.device", oem_props, oem_dict,
@ -1059,10 +1064,10 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
info_dict=OPTIONS.info_dict)
system_diff = FileDifference("system", source_zip, target_zip, output_zip)
script.Mount("/system")
script.Mount("/system", recovery_mount_options)
if HasVendorPartition(target_zip):
vendor_diff = FileDifference("vendor", source_zip, target_zip, output_zip)
script.Mount("/vendor")
script.Mount("/vendor", recovery_mount_options)
else:
vendor_diff = None