releasetools: Explicitly pass the SHA-1 of source boot image to PatchCheck.
Although the SHA-1 of the source boot image has been encoded in the
filename, the updater code currently doesn't extract that and would fail
to find a matching backup from /cache. This could lead to corrupt
install, if it's interrupted while patching the boot image.
Bug: 80630342
Test: Generate an non-A/B incremental package. Verify the script.
Change-Id: Ie2b1a90836c3ccb4758e1a2d9b69a88de94ae0c7
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index 968fd77..a8c821f 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -1517,10 +1517,16 @@
common.ZipWriteStr(output_zip, "patch/boot.img.p", d)
+ # TODO(b/110106408): Remove after properly handling the SHA-1 embedded in
+ # the filename argument in updater code. Prior to that, explicitly list
+ # the SHA-1 of the source image, in case the updater tries to find a
+ # matching backup from /cache. Similarly for the call to
+ # script.ApplyPatch() below.
script.PatchCheck("%s:%s:%d:%s:%d:%s" %
(boot_type, boot_device,
source_boot.size, source_boot.sha1,
- target_boot.size, target_boot.sha1))
+ target_boot.size, target_boot.sha1),
+ source_boot.sha1)
size.append(target_boot.size)
if size: