am 63f01de8: Add post-install verification phase
* commit '63f01de81892aa4e40b517464b3d9ca7db666c9d': Add post-install verification phase
This commit is contained in:
commit
c9594afa93
|
@ -323,6 +323,10 @@ class EdifyGenerator(object):
|
||||||
"""Append text verbatim to the output script."""
|
"""Append text verbatim to the output script."""
|
||||||
self.script.append(extra)
|
self.script.append(extra)
|
||||||
|
|
||||||
|
def Unmount(self, mount_point):
|
||||||
|
self.script.append('unmount("%s");' % (mount_point,))
|
||||||
|
self.mounts.remove(mount_point);
|
||||||
|
|
||||||
def UnmountAll(self):
|
def UnmountAll(self):
|
||||||
for p in sorted(self.mounts):
|
for p in sorted(self.mounts):
|
||||||
self.script.append('unmount("%s");' % (p,))
|
self.script.append('unmount("%s");' % (p,))
|
||||||
|
|
|
@ -37,6 +37,10 @@ Usage: ota_from_target_files [flags] input_target_files output_ota_package
|
||||||
Generate an incremental OTA using the given target-files zip as
|
Generate an incremental OTA using the given target-files zip as
|
||||||
the starting build.
|
the starting build.
|
||||||
|
|
||||||
|
-v (--verify)
|
||||||
|
Remount and verify the checksums of the files written to the
|
||||||
|
system and vendor (if used) partitions. Incremental builds only.
|
||||||
|
|
||||||
-o (--oem_settings) <file>
|
-o (--oem_settings) <file>
|
||||||
Use the file to specify the expected OEM-specific properties
|
Use the file to specify the expected OEM-specific properties
|
||||||
on the OEM partition of the intended device.
|
on the OEM partition of the intended device.
|
||||||
|
@ -104,6 +108,7 @@ import sparse_img
|
||||||
OPTIONS = common.OPTIONS
|
OPTIONS = common.OPTIONS
|
||||||
OPTIONS.package_key = None
|
OPTIONS.package_key = None
|
||||||
OPTIONS.incremental_source = None
|
OPTIONS.incremental_source = None
|
||||||
|
OPTIONS.verify = False
|
||||||
OPTIONS.require_verbatim = set()
|
OPTIONS.require_verbatim = set()
|
||||||
OPTIONS.prohibit_verbatim = set(("system/build.prop",))
|
OPTIONS.prohibit_verbatim = set(("system/build.prop",))
|
||||||
OPTIONS.patch_threshold = 0.95
|
OPTIONS.patch_threshold = 0.95
|
||||||
|
@ -939,7 +944,7 @@ class FileDifference:
|
||||||
raise common.ExternalError("\"%s\" must be sent verbatim" % (fn,))
|
raise common.ExternalError("\"%s\" must be sent verbatim" % (fn,))
|
||||||
print "send", fn, "verbatim"
|
print "send", fn, "verbatim"
|
||||||
tf.AddToZip(output_zip)
|
tf.AddToZip(output_zip)
|
||||||
verbatim_targets.append((fn, tf.size))
|
verbatim_targets.append((fn, tf.size, tf.sha1))
|
||||||
if fn in target_data.keys():
|
if fn in target_data.keys():
|
||||||
AddToKnownPaths(fn, known_paths)
|
AddToKnownPaths(fn, known_paths)
|
||||||
elif tf.sha1 != sf.sha1:
|
elif tf.sha1 != sf.sha1:
|
||||||
|
@ -960,7 +965,7 @@ class FileDifference:
|
||||||
# or a patch + rename cannot take place due to the target
|
# or a patch + rename cannot take place due to the target
|
||||||
# directory not existing
|
# directory not existing
|
||||||
tf.AddToZip(output_zip)
|
tf.AddToZip(output_zip)
|
||||||
verbatim_targets.append((tf.name, tf.size))
|
verbatim_targets.append((tf.name, tf.size, tf.sha1))
|
||||||
if sf.name in renames:
|
if sf.name in renames:
|
||||||
del renames[sf.name]
|
del renames[sf.name]
|
||||||
AddToKnownPaths(tf.name, known_paths)
|
AddToKnownPaths(tf.name, known_paths)
|
||||||
|
@ -980,6 +985,13 @@ class FileDifference:
|
||||||
so_far += sf.size
|
so_far += sf.size
|
||||||
return so_far
|
return so_far
|
||||||
|
|
||||||
|
def EmitExplicitTargetVerification(self, script):
|
||||||
|
for fn, size, sha1 in self.verbatim_targets:
|
||||||
|
if (fn[-1] != "/"):
|
||||||
|
script.FileCheck("/"+fn, sha1)
|
||||||
|
for tf, _, _, _ in self.patch_list:
|
||||||
|
script.FileCheck(tf.name, tf.sha1)
|
||||||
|
|
||||||
def RemoveUnneededFiles(self, script, extras=()):
|
def RemoveUnneededFiles(self, script, extras=()):
|
||||||
script.DeleteFiles(["/"+i[0] for i in self.verbatim_targets] +
|
script.DeleteFiles(["/"+i[0] for i in self.verbatim_targets] +
|
||||||
["/"+i for i in sorted(self.source_data)
|
["/"+i for i in sorted(self.source_data)
|
||||||
|
@ -1351,7 +1363,19 @@ endif;
|
||||||
endif;
|
endif;
|
||||||
""" % bcb_dev)
|
""" % bcb_dev)
|
||||||
|
|
||||||
|
if OPTIONS.verify and system_diff:
|
||||||
|
script.Print("Remounting and verifying system partition files...")
|
||||||
|
script.Unmount("/system")
|
||||||
|
script.Mount("/system")
|
||||||
|
system_diff.EmitExplicitTargetVerification(script)
|
||||||
|
|
||||||
|
if OPTIONS.verify and vendor_diff:
|
||||||
|
script.Print("Remounting and verifying vendor partition files...")
|
||||||
|
script.Unmount("/vendor")
|
||||||
|
script.Mount("/vendor")
|
||||||
|
vendor_diff.EmitExplicitTargetVerification(script)
|
||||||
script.AddToZip(target_zip, output_zip, input_path=OPTIONS.updater_binary)
|
script.AddToZip(target_zip, output_zip, input_path=OPTIONS.updater_binary)
|
||||||
|
|
||||||
WriteMetadata(metadata, output_zip)
|
WriteMetadata(metadata, output_zip)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1387,6 +1411,8 @@ def main(argv):
|
||||||
OPTIONS.two_step = True
|
OPTIONS.two_step = True
|
||||||
elif o == "--no_signing":
|
elif o == "--no_signing":
|
||||||
OPTIONS.no_signing = True
|
OPTIONS.no_signing = True
|
||||||
|
elif o in ("--verify"):
|
||||||
|
OPTIONS.verify = True
|
||||||
elif o == "--block":
|
elif o == "--block":
|
||||||
OPTIONS.block_based = True
|
OPTIONS.block_based = True
|
||||||
elif o in ("-b", "--binary"):
|
elif o in ("-b", "--binary"):
|
||||||
|
@ -1412,6 +1438,7 @@ def main(argv):
|
||||||
"block",
|
"block",
|
||||||
"binary=",
|
"binary=",
|
||||||
"oem_settings=",
|
"oem_settings=",
|
||||||
|
"verify",
|
||||||
"no_fallback_to_full",
|
"no_fallback_to_full",
|
||||||
],
|
],
|
||||||
extra_option_handler=option_handler)
|
extra_option_handler=option_handler)
|
||||||
|
|
Loading…
Reference in New Issue