From: Tianjie Xu Date: Fri, 8 Apr 2016 03:17:48 +0000 (-0700) Subject: Monotonic flag sets incorrectly in rangelib X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=cd1e16a7616092e5a315b0a421a0c082da144145;p=android-x86%2Fbuild.git 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 --- diff --git a/tools/releasetools/rangelib.py b/tools/releasetools/rangelib.py index 31ed83a67..1638f8c94 100644 --- a/tools/releasetools/rangelib.py +++ b/tools/releasetools/rangelib.py @@ -104,7 +104,7 @@ class RangeSet(object): if last <= s: last = s+1 else: - monotonic = True + monotonic = False data.sort() self.data = tuple(self._remove_pairs(data)) self.monotonic = monotonic diff --git a/tools/releasetools/test_rangelib.py b/tools/releasetools/test_rangelib.py index 853012ea9..1c57cbc27 100644 --- a/tools/releasetools/test_rangelib.py +++ b/tools/releasetools/test_rangelib.py @@ -117,6 +117,7 @@ class RangeSetTest(unittest.TestCase): self.assertTrue(RangeSet("").monotonic) self.assertTrue(RangeSet("0-4 5-9").monotonic) self.assertFalse(RangeSet("5-9 0-4").monotonic) + self.assertFalse(RangeSet("258768-259211 196604").monotonic) self.assertTrue(RangeSet(data=[0, 10]).monotonic) self.assertTrue(RangeSet(data=[0, 10, 15, 20]).monotonic)