OSDN Git Service

releasetools: Make BBOTA incremental generation repeatable.
authorTao Bao <tbao@google.com>
Mon, 24 Oct 2016 23:49:08 +0000 (16:49 -0700)
committerTao Bao <tbao@google.com>
Sun, 6 Nov 2016 07:37:29 +0000 (00:37 -0700)
commitb4cd33fac954882cf39f2c0d5a393d114d412ce9
tree46308d87563becb292066a28f25acb5ec261d6f7
parent61be03b456e28df4c2347e4b51fa9616f086e236
releasetools: Make BBOTA incremental generation repeatable.

set() doesn't keep elements according to the order of insertion. So
Transfers managed with set() in intermediate steps may not appear in the
same order across runs. This leads to slightly different output packages
when generating the same incremental OTA.

This CL fixes the issue by replacing set() with OrderedDict() in
blockimgdiff.GenerateDigraph() and blockimgdiff.FindVertexSequence().

It also adds a testcase that ensures blockimgdiff.GenerateDigraph()
preserves the insertion order for Transfer.goes_after set.

Bug: 32220816
Test: ota_from_target_files.py gives identical package when running
multiple times.

Change-Id: I56d551e5ca926993ab46896e33c80e0ce42e506a
(cherry picked from commit 334822842353669df47cec08500d4497b4b353ea)
tools/releasetools/blockimgdiff.py
tools/releasetools/test_blockimgdiff.py [new file with mode: 0644]