OSDN Git Service

releasetools: Add support for --override_timestamp.
authorTao Bao <tbao@google.com>
Tue, 28 Feb 2017 19:48:48 +0000 (11:48 -0800)
committerTao Bao <tbao@google.com>
Tue, 28 Feb 2017 21:01:13 +0000 (13:01 -0800)
commit3e6161a3b33da5a46c80c79e2d815168923e83c3
treedef3b9717621fd4cc3c8567194f48bbad052795f
parent042d5a846fb387d04822ddd1e18ca5c0d29223c2
releasetools: Add support for --override_timestamp.

We use the timestamps in builds to determine a downgrade, which might
not be always the truth. For examples, two builds cut from different
branches may carry timestamps in a reverse order. An incremental package
won't be able to be pushed nor applied, based on the timestamp
comparison.

We used to handle such a case with manual work, by setting the
post-timestamp to (pre-timestamp + 1) in the package metadata. This CL
automates the process by adding a new flag --override_timestamp.

Note that it doesn't change anything in the installed image, but only
affects the assertions for pushing / installing the package.

With the change in this CL:
 - If it's a downgrade without any extra flag, fail the package
   generation (we only print warnings prior to this CL);
 - If it's a downgrade with --downgrade flag, generate a downgrade
   package with forced data wipe (same as before);
 - If it's a downgrade with --override_timestamp, generate a normal
   incremental with hacked timestamp (pre-timestamp + 1) (new in this CL
   to avoid the manual change);
 - If it's not a downgrade but with any of the above two flags specified,
   fail the package generation.

Bug: 33744169
Test: Generate an incremental from builds with reversed timestamps.
Change-Id: I8b187d32708b4a7c3e20f8c6adb8f9527b73b965
tools/releasetools/ota_from_target_files.py