History log of /build/make/tools/releasetools/rangelib.py
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
fe97dbd4ce8b0371f93d1a322fd863a463304b79 07-Feb-2018 Tao Bao <tbao@google.com> releasetools: RangeSet.monotonic is not an optional attribute.

'monotonic' has been non-optional since [1] (L-MR1). Fix the comment in
RangeSet.parse(), as well as the use in blockimgdiff.py.

[1] commit 8b72aefb5a8ed4da28c6f83854e8babf53b9cb53.

Test: Generate an incremental BBOTA package.
Change-Id: I7f95231683473b4f0f07f9c83fccc0e36a1340cb
/build/make/tools/releasetools/rangelib.py
c765cca38bd357097dd2b7d3713a49bcd62a6858 01-Feb-2018 Tao Bao <tbao@google.com> releasetools: Detect incomplete block ranges.

This CL detects incomplete block ranges (e.g. due to the holes in
mke2fs created images). Such block ranges will be tagged, so we won't
attempt to imgdiff those files. Note that the change to blockimgdiff.py,
which uses the tag info, will come in a separate CL.

An 'extra' attribute is added to RangeSet class, which defaults to an
empty dict. An 'incomplete' tag will be added into the dict by the
caller of the class. Not adding this tag as an immediate attribute,
because it is not a property regarding the ranges being represented, but
rather some storage space for the caller.

This CL also refactors GetSparseImage and RoundUpTo4K into common.py, so
the same code can be called from both of ota_from_target_files.py and
validate_target_files.py. Not able to add unittests for
GetSparseImage(), as SparseImage requires data in specific format.

Bug: 68016761
Test: Run validate_target_files.py on target-files.zip. It skips
validating files with missing holes as before.
Test: Run ota_from_target_files.py on angler target-files.zip. It gives
identical packages w/ and w/o the CL.
Test: pylint on changed files. There're warnings with common.py, but
unrelated to this change.
Change-Id: I126ccfea13c0d5ebcc8c1b4ff1a4f9200e97423a
/build/make/tools/releasetools/rangelib.py
c0dcbd0017ac73799e69bcc14a12f414406b5d50 02-Nov-2017 Tao Bao <tbao@google.com> releasetools: Fix the doctest for rangelib.py.

$ python rangelib.py
**********************************************************************
File "rangelib.py", line 323, in __main__.RangeSet.next_item
Failed example:
list(rangelib.RangeSet("10-19 3 5 7").next_item())
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.7/doctest.py", line 1315, in __run
compileflags, 1) in test.globs
File "<doctest __main__.RangeSet.next_item[2]>", line 1, in <module>
list(rangelib.RangeSet("10-19 3 5 7").next_item())
NameError: name 'rangelib' is not defined
**********************************************************************
1 items had failures:
1 of 3 in __main__.RangeSet.next_item
***Test Failed*** 1 failures.

Test: python rangelib.py
Change-Id: I6c791ff4453f40d90b34f97b881460da9878fe64
/build/make/tools/releasetools/rangelib.py
08c8583aea0c53a7cee840d627371314654895e8 20-Sep-2016 Tao Bao <tbao@google.com> Analyze unchanged blocks in odex files.

In BBOTA, we generate patches based on _all_ the blocks of a pair of
input files (src and tgt). For security incremental OTAs, one common
pattern is that only a few blocks are changed in odex files (e.g.
headers). We don't really need to stash/patch the unchanged blocks.

This CL analyzes the unchanged blocks in odex files and computes the
diff for the changed blocks only. It reduces the OTA install time by
about 25% to 40% in our experiments, by paying an increase of 5% to 30%
OTA generation time cost.

Bug: 31570716
Test: Generate an incremental and apply on device.

Change-Id: If842c1afeff6894a3d27eb60b7e8f65a179b7977
/build/make/tools/releasetools/rangelib.py
cd1e16a7616092e5a315b0a421a0c082da144145 08-Apr-2016 Tianjie Xu <xunchang@google.com> Monotonic flag sets incorrectly in rangelib

After applying update_target_files_incr_ext4.sh, some files may end up
occupying unsorted block fragments. In one example, an apk file has the
block range [258768-259211,196604]. The monotonic flag in rangelib sets
incorrectly for this example and leads to a bad input file for imgdiff.
After fixing the flag, bsdiff is called instead of imgdiff and the
incremental OTA package generates successfully.

Bug:28053885
Change-Id: Ib841bf449ff6a29314fc4a1b8fba941a6dc532ac
/build/make/tools/releasetools/rangelib.py
8179d68458f6761da18e6829a91a1c2cbabb8e49 24-Mar-2016 Tao Bao <tbao@google.com> rangelib.py: Add parse_raw() method.

parse_raw() parses a string generated by RangeSet.to_string_raw().

>>> RangeSet.parse_raw(RangeSet("0-9").to_string_raw())
<RangeSet("0-9")>

Change-Id: Ia74daa30476d5e9ad73c368f4ecc64c755b734a5
/build/make/tools/releasetools/rangelib.py
e8f756137c39fc3292014f2eab5f84c6e5135797 27-Aug-2015 Tao Bao <tbao@google.com> rangelib.py: Fix the bug in monotonic check.

RangeSet("2-10").monotonic gives a wrong result of "False". Fix the bug
and add more tests into test_rangelib.py.

Change-Id: I04780571b45ecafd34040f405756b9745a9e21a5
/build/make/tools/releasetools/rangelib.py
9a5caf2c30e5dcb19823dff328de1cfb140a2799 26-Aug-2015 Tao Bao <tbao@google.com> Split large files for BBOTA v3.

For BBOTA v3, we need to stash source blocks to support resumable
feature. However, with the growth of file size and the shrink of the
cache size, source blocks that represent a file are too large to be
stashed as a whole. CL in [1] solves the issue by replacing the diff
command with a "new" command. However, it may increase the generated
package size substantially (e.g. from ~100MB to ~400MB).

With this CL, if a file spans too many blocks, we split it into smaller
pieces by generating multiple commands. For the same case above, it
reduces the package size to ~150MB.

One potential downside is that after splitting, files like .jar,
.apk and .zip can no longer use imgdiff. We may lose the potential
benefit of using imgdiff for patch size reduction.

[1] commit 82c47981bd0602a1c7b50dfabf9a6a2412993bae

Bug: 22430577
Change-Id: I5684fab0ac41c8d94fe18f52a34cef77e06f741c
/build/make/tools/releasetools/rangelib.py
e9b619108dbe0c358ba6c14e27c92a623a7c1059 10-Jul-2015 Tao Bao <tbao@google.com> Zero out blocks that may be touched by dm-verity.

dm-verity may touch some blocks that are not in the care_map due to
block device read-ahead. It will fail if such blocks contain
non-zeroes. As a workaround, we mark them as extended blocks and
zero out explicitly to avoid dm-verity failures.

Bug: 20881595
Change-Id: Id097138bfd065c84eac088b3ad49758010b2927b
(cherry picked from commit 2fd2c9bfd6c9beeaeccb4632b785227fe56c6006)
/build/make/tools/releasetools/rangelib.py
8b72aefb5a8ed4da28c6f83854e8babf53b9cb53 24-Mar-2015 Dan Albert <danalbert@google.com> Make releasetools pylint clean.

This caught a few bugs/syntax errors (a few character classes were not
escaped properly in regex patterns, some indentation was illegal,
etc).

Change-Id: I50637607524e68c4fb9cad7167f58a46b8d26b2c
/build/make/tools/releasetools/rangelib.py
846cb3a9e628cb00088bf65a153c0fedc10f2621 09-Sep-2014 Doug Zongker <dougz@google.com> add unit tests for rangelib

Change-Id: I3b77e849007259e697da56bd493ae5b553b901d1
/build/make/tools/releasetools/rangelib.py
623381880a32a2912f95949a6c406038ac4e7064 08-Sep-2014 Doug Zongker <dougz@google.com> generate version 2 blockimgdiff files

Generate version 2 of the block_image_update transfer list format.
This improves patch size by a different strategy for dealing with
out-of-order transfers. If transfer A must be done before transfer B
due to B overwriting A's source but we want to do B before A, we
resolve the conflict by:

- before B is executed, we save ("stash") the overlapping region (ie
the blocks B will overwrite that A wants to read)

- when A is executed, it will read those parts of source data from
the stash rather than from the image.

This reverses the ordering constraint; with these additions now B
*must* go before A. The implementation of the stash is left up to the
code that executes the transfer list to apply the patch; it could hold
stashed data in RAM or on a scratch disk such as /cache, if available.

The code retains the ability to build a version 1 block image patch;
it's needed for processing older target-files.

Change-Id: Ia9aa0bd45d5dc3ef7c5835e483b1b2ead10135fe
/build/make/tools/releasetools/rangelib.py
424296a4e811f57ada27be68d60aeb5fcb1bb45b 02-Sep-2014 Doug Zongker <dougz@google.com> add missing AOSP copyright notices

Change-Id: Idc812db30b259a55702f8728197f957f2d24d978
/build/make/tools/releasetools/rangelib.py
fc44a515d46e6f4d5eaa0d32659b1cf3b9492305 26-Aug-2014 Doug Zongker <dougz@google.com> new block OTA system tools

Replace the xdelta/xz-based block OTA generation with a new system
based on the existing bsdiff/imgdiff tools.

Bug: 16984795
Change-Id: Ia9732516ffdfc12be86260b2cc4b1dd2d210e886
/build/make/tools/releasetools/rangelib.py