pass blobs to applypatch in incremental OTAs
applypatch now takes patches as blob-valued arguments instead of just filenames, eliminating the need to unpack all patches to /tmp before starting to apply them. Revert the last change I made where sha1_check(read_file(...)) was substituted for apply_patch_check(...). apply_patch_check() knows to check /cache/saved.file if the original source file is missing or has a bad checksum, which is important if the device loses power or otherwise restarts during patching. Change-Id: Ia5b761474b0f809a5a5eed29455b1b145145699e
This commit is contained in:
@@ -111,6 +111,14 @@ class EdifyGenerator(object):
|
||||
self.script.append("set_progress(%f);" % (frac,))
|
||||
|
||||
def PatchCheck(self, filename, *sha1):
|
||||
"""Check that the given file (or MTD reference) has one of the
|
||||
given *sha1 hashes, checking the version saved in cache if the
|
||||
file does not match."""
|
||||
self.script.append('assert(apply_patch_check("%s"' % (filename,) +
|
||||
"".join([', "%s"' % (i,) for i in sha1]) +
|
||||
'));')
|
||||
|
||||
def FileCheck(self, filename, *sha1):
|
||||
"""Check that the given file (or MTD reference) has one of the
|
||||
given *sha1 hashes."""
|
||||
self.script.append('assert(sha1_check(read_file("%s")' % (filename,) +
|
||||
@@ -164,7 +172,7 @@ class EdifyGenerator(object):
|
||||
cmd = ['apply_patch("%s",\0"%s",\0%s,\0%d'
|
||||
% (srcfile, tgtfile, tgtsha1, tgtsize)]
|
||||
for i in range(0, len(patchpairs), 2):
|
||||
cmd.append(',\0"%s:%s"' % patchpairs[i:i+2])
|
||||
cmd.append(',\0%s, package_extract_file("%s")' % patchpairs[i:i+2])
|
||||
cmd.append(');')
|
||||
cmd = "".join(cmd)
|
||||
self.script.append(self._WordWrap(cmd))
|
||||
|
Reference in New Issue
Block a user