releasetools: Disable using imgdiff for squashfs.

We use imgdiff to handle files in zip format (e.g. jar/zip/apk) for
higher compression ratio.

For system/vendor in squashfs, a) all files are compressed in LZ4
format; b) we use 4096-byte block size in their sparse images, but the
files in squashfs may not be laid out as 4K-aligned. So the blocks for
a given file as listed in block map may not form a valid zip file, which
may fail the patch generation with imgdiff.

Disable using imgdiff for squashfs images, and use bsdiff instead.

Bug: 22322817
Change-Id: Ie76aa4cece5c9d38cb1d1a34c505a4a8f37512d3
This commit is contained in:
Tao Bao
2016-06-11 12:19:23 -07:00
parent d06f07eef4
commit 293fd135c7
3 changed files with 19 additions and 6 deletions

View File

@@ -1341,11 +1341,12 @@ def ComputeDifferences(diffs):
class BlockDifference(object):
def __init__(self, partition, tgt, src=None, check_first_block=False,
version=None):
version=None, disable_imgdiff=False):
self.tgt = tgt
self.src = src
self.partition = partition
self.check_first_block = check_first_block
self.disable_imgdiff = disable_imgdiff
if version is None:
version = 1
@@ -1356,7 +1357,8 @@ class BlockDifference(object):
self.version = version
b = blockimgdiff.BlockImageDiff(tgt, src, threads=OPTIONS.worker_threads,
version=self.version)
version=self.version,
disable_imgdiff=self.disable_imgdiff)
tmpdir = tempfile.mkdtemp()
OPTIONS.tempfiles.append(tmpdir)
self.path = os.path.join(tmpdir, partition)