summaryrefslogtreecommitdiffstats
path: root/tools/releasetools/common.py
diff options
context:
space:
mode:
authorSami Tolvanen <samitolvanen@google.com>2015-04-24 11:54:01 +0100
committerSami Tolvanen <samitolvanen@google.com>2015-04-24 10:56:59 +0000
commite09d096ed6015a4e3d24591ce588ecf8fd66b494 (patch)
tree65e7e1ef060bf35a82a094357ab1f11157263e39 /tools/releasetools/common.py
parent529943c7234a20de4eeb489df9f1c896a09b345f (diff)
downloadbuild-e09d096ed6015a4e3d24591ce588ecf8fd66b494.zip
build-e09d096ed6015a4e3d24591ce588ecf8fd66b494.tar.gz
build-e09d096ed6015a4e3d24591ce588ecf8fd66b494.tar.bz2
Check partition hash before resorting to block_image_verify
It's not necessary to call block_image_verify for the most common case where we attempt an update for the first time and the target partition has expected contents. It is sufficient to confirm that the target partition is intact. Computing a hash is much faster than simulating the update, which means this change should make the update speed for v3 much closer to v2 for the common case. If the update was interrupted, this is going to make resuming somewhat slower, of course. Hopefully this should be rather rare. Bug: 20309033 Change-Id: I04792f3681bf2cd5d9a4e1c41eb883c7f26c6f58
Diffstat (limited to 'tools/releasetools/common.py')
-rw-r--r--tools/releasetools/common.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 6a5d22f..a8b0035 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -1140,10 +1140,13 @@ class BlockDifference(object):
script.Print("Image %s will be patched unconditionally." % (partition,))
else:
if self.version >= 3:
- script.AppendExtra(('if block_image_verify("%s", '
+ script.AppendExtra(('if (range_sha1("%s", "%s") == "%s" || '
+ 'block_image_verify("%s", '
'package_extract_file("%s.transfer.list"), '
- '"%s.new.dat", "%s.patch.dat") then') %
- (self.device, partition, partition, partition))
+ '"%s.new.dat", "%s.patch.dat")) then') % (
+ self.device, self.src.care_map.to_string_raw(),
+ self.src.TotalSha1(),
+ self.device, partition, partition, partition))
else:
script.AppendExtra('if range_sha1("%s", "%s") == "%s" then' % (
self.device, self.src.care_map.to_string_raw(),