diff options
author | Dan Albert <danalbert@google.com> | 2015-03-13 20:31:40 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-03-13 20:31:41 +0000 |
commit | cb9ace32d4cdfd84d6da98f70fd4041350abcf2c (patch) | |
tree | e84d09feaad63c1dc989db8bd587eae0f263793e | |
parent | 105b94cc44dc3cec6df22ac6e80da8dcb3ffd031 (diff) | |
parent | 910b005f183d95640df57e270989ad93e6a55769 (diff) | |
download | build-cb9ace32d4cdfd84d6da98f70fd4041350abcf2c.zip build-cb9ace32d4cdfd84d6da98f70fd4041350abcf2c.tar.gz build-cb9ace32d4cdfd84d6da98f70fd4041350abcf2c.tar.bz2 |
Merge "Do not use block_verify on target-files where feature is missing."
-rw-r--r-- | tools/releasetools/common.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index 14975d5..4241b2b 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -1030,14 +1030,14 @@ class BlockDifference: self.partition = partition self.check_first_block = check_first_block - version = 1 + self.version = 1 if OPTIONS.info_dict: - version = max( + self.version = max( int(i) for i in OPTIONS.info_dict.get("blockimgdiff_versions", "1").split(",")) b = blockimgdiff.BlockImageDiff(tgt, src, threads=OPTIONS.worker_threads, - version=version) + version=self.version) tmpdir = tempfile.mkdtemp() OPTIONS.tempfiles.append(tmpdir) self.path = os.path.join(tmpdir, partition) @@ -1060,10 +1060,15 @@ class BlockDifference: if not self.src: script.Print("Image %s will be patched unconditionally." % (partition,)) else: - script.AppendExtra(('if block_image_verify("%s", ' - 'package_extract_file("%s.transfer.list"), ' - '"%s.new.dat", "%s.patch.dat") then') % - (self.device, partition, partition, partition)) + if self.version >= 3: + script.AppendExtra(('if block_image_verify("%s", ' + 'package_extract_file("%s.transfer.list"), ' + '"%s.new.dat", "%s.patch.dat") then') % + (self.device, partition, partition, partition)) + else: + script.AppendExtra('if range_sha1("%s", "%s") == "%s" then' % + (self.device, self.src.care_map.to_string_raw(), + self.src.TotalSha1())) script.Print("Verified %s image..." % (partition,)) script.AppendExtra('else'); |