Relanding 'update_payload: Add XZ compression support'
This patch adds support for checking a payload that has REPLACE_XZ
operations. REPLACE_XZ was added in minor version 3.
BUG=chromium:758792
TEST=unittests pass; paycheck.py with a xz generated payload pass;
CQ-DEPEND=CL:823234
Change-Id: I6ec8068e233f2d595fda93a985923d85c59f150e
Reviewed-on: https://chromium-review.googlesource.com/872124
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Sen Jiang <senj@chromium.org>
diff --git a/scripts/update_payload/checker.py b/scripts/update_payload/checker.py
index e4cb845..8e04f1e 100644
--- a/scripts/update_payload/checker.py
+++ b/scripts/update_payload/checker.py
@@ -322,6 +322,10 @@
self.new_rootfs_fs_size = 0
self.new_kernel_fs_size = 0
self.minor_version = None
+ # TODO(*): When fixing crbug.com/794404, the major version should be
+ # correclty handled in update_payload scripts. So stop forcing
+ # major_verions=1 here and set it to the correct value.
+ self.major_version = 1
@staticmethod
def _CheckElem(msg, name, report, is_mandatory, is_submsg, convert=str,
@@ -701,7 +705,7 @@
return total_num_blocks
def _CheckReplaceOperation(self, op, data_length, total_dst_blocks, op_name):
- """Specific checks for REPLACE/REPLACE_BZ operations.
+ """Specific checks for REPLACE/REPLACE_BZ/REPLACE_XZ operations.
Args:
op: The operation object from the manifest.
@@ -996,6 +1000,9 @@
# Type-specific checks.
if op.type in (common.OpType.REPLACE, common.OpType.REPLACE_BZ):
self._CheckReplaceOperation(op, data_length, total_dst_blocks, op_name)
+ elif op.type == common.OpType.REPLACE_XZ and (self.minor_version >= 3 or
+ self.major_version >= 2):
+ self._CheckReplaceOperation(op, data_length, total_dst_blocks, op_name)
elif op.type == common.OpType.MOVE and self.minor_version == 1:
self._CheckMoveOperation(op, data_offset, total_src_blocks,
total_dst_blocks, op_name)
@@ -1068,6 +1075,7 @@
op_counts = {
common.OpType.REPLACE: 0,
common.OpType.REPLACE_BZ: 0,
+ common.OpType.REPLACE_XZ: 0,
common.OpType.MOVE: 0,
common.OpType.ZERO: 0,
common.OpType.BSDIFF: 0,
@@ -1080,6 +1088,7 @@
op_blob_totals = {
common.OpType.REPLACE: 0,
common.OpType.REPLACE_BZ: 0,
+ common.OpType.REPLACE_XZ: 0,
# MOVE operations don't have blobs.
common.OpType.BSDIFF: 0,
# SOURCE_COPY operations don't have blobs.