update_payload: use argparse
optparse is deprecated (or going to be). Change paycheck.py and
blockdiff.py to use argparse instead. Both of these files are being used
manually and it would be a good time to fix these before major changes
in update_payload.
paycheck.sh -h:
usage: paycheck.py [-h] [-c] [-D] [-r FILE] [-t {full,delta}] [-z NUM] [-u]
[-d] [-k FILE] [-m FILE] [-p NUM] [-P NUM] [-x]
[--bspatch-path FILE] [--puffpatch-path FILE]
[--dst_kern FILE] [--dst_root FILE] [--src_kern FILE]
[--src_root FILE] [-b BLOCK] [-B BLOCK] [-s NUM]
PAYLOAD
Applies a Chrome OS update PAYLOAD to src_kern and src_root emitting dst_kern and dst_root, respectively. src_kern and src_root are only needed for delta payloads. When no partitions are provided, verifies the payload integrity.
positional arguments:
PAYLOAD the payload file
optional arguments:
-h, --help show this help message and exit
Checking payload integrity:
-c, --check force payload integrity check (e.g. before applying)
-D, --describe Print a friendly description of the payload.
-r FILE, --report FILE
dump payload report (`-' for stdout)
-t {full,delta}, --type {full,delta}
assert the payload type
-z NUM, --block-size NUM
assert a non-default (4096) payload block size
-u, --allow-unhashed allow unhashed operations
-d , --disabled_tests
space separated list of tests to disable. allowed
options include: dst-pseudo-extents, move-same-src-
dst-block, payload-sig
-k FILE, --key FILE override standard key used for signature validation
-m FILE, --meta-sig FILE
verify metadata against its signature
-p NUM, --root-part-size NUM
override rootfs partition size auto-inference
-P NUM, --kern-part-size NUM
override kernel partition size auto-inference
Applying payload:
-x, --extract-bsdiff use temp input/output files with BSDIFF operations
(not in-place)
--bspatch-path FILE use the specified bspatch binary
--puffpatch-path FILE
use the specified puffpatch binary
--dst_kern FILE destination kernel partition file
--dst_root FILE destination root partition file
--src_kern FILE source kernel partition file
--src_root FILE source root partition file
Block tracing:
-b BLOCK, --root-block BLOCK
trace the origin for a rootfs block
-B BLOCK, --kern-block BLOCK
trace the origin for a kernel block
-s NUM, --skip NUM skip first NUM occurrences of traced block
Note: a payload may verify correctly but fail to apply, and vice versa; this is by design and can be thought of as static vs dynamic correctness. A payload that both verifies and applies correctly should be safe for use by the Chrome OS Update Engine. Use --check to verify a payload prior to applying it.
BUG=chromium:796338
TEST=unitests
TEST=test_paycheck.sh
TEST=blockdiff.py
Change-Id: I794b5f61e6ba6f92939947c97c432f9fea0b6b3c
Reviewed-on: https://chromium-review.googlesource.com/834876
Commit-Ready: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Sen Jiang <senj@chromium.org>
3 files changed