paycheck: Support minor version 4.
From https://chromium-review.googlesource.com/#/c/333160/
Bug: 27156473
Test: ./scripts/update_payload/checker_unittest.py
Change-Id: I940debd5c878f622970e214fce75588f96d78407
diff --git a/scripts/update_payload/checker.py b/scripts/update_payload/checker.py
index 7abf178..e13ea13 100644
--- a/scripts/update_payload/checker.py
+++ b/scripts/update_payload/checker.py
@@ -56,6 +56,7 @@
1: (_TYPE_DELTA,),
2: (_TYPE_DELTA,),
3: (_TYPE_DELTA,),
+ 4: (_TYPE_DELTA,),
}
_OLD_DELTA_USABLE_PART_SIZE = 2 * 1024 * 1024 * 1024
@@ -814,8 +815,8 @@
if dst_extent:
raise error.PayloadError('%s: excess dst blocks.' % op_name)
- def _CheckBsdiffOperation(self, data_length, total_dst_blocks, op_name):
- """Specific checks for BSDIFF and SOURCE_BSDIFF operations.
+ def _CheckAnyDiffOperation(self, data_length, total_dst_blocks, op_name):
+ """Specific checks for BSDIFF, SOURCE_BSDIFF and IMGDIFF operations.
Args:
data_length: The length of the data blob associated with the operation.
@@ -875,8 +876,8 @@
if total_src_blocks == 0:
raise error.PayloadError('%s: no src blocks in a source op.' % op_name)
- # Check: src_sha256_hash present in minor version 3.
- if self.minor_version == 3 and op.src_sha256_hash is None:
+ # Check: src_sha256_hash present in minor version >= 3.
+ if self.minor_version >= 3 and op.src_sha256_hash is None:
raise error.PayloadError('%s: source hash missing.' % op_name)
def _CheckOperation(self, op, op_name, is_last, old_block_counters,
@@ -972,14 +973,16 @@
self._CheckMoveOperation(op, data_offset, total_src_blocks,
total_dst_blocks, op_name)
elif op.type == common.OpType.BSDIFF and self.minor_version == 1:
- self._CheckBsdiffOperation(data_length, total_dst_blocks, op_name)
- elif op.type == common.OpType.SOURCE_COPY and self.minor_version in (2, 3):
+ self._CheckAnyDiffOperation(data_length, total_dst_blocks, op_name)
+ elif op.type == common.OpType.SOURCE_COPY and self.minor_version >= 2:
self._CheckSourceCopyOperation(data_offset, total_src_blocks,
total_dst_blocks, op_name)
self._CheckAnySourceOperation(op, total_src_blocks, op_name)
- elif (op.type == common.OpType.SOURCE_BSDIFF and
- self.minor_version in (2, 3)):
- self._CheckBsdiffOperation(data_length, total_dst_blocks, op_name)
+ elif op.type == common.OpType.SOURCE_BSDIFF and self.minor_version >= 2:
+ self._CheckAnyDiffOperation(data_length, total_dst_blocks, op_name)
+ self._CheckAnySourceOperation(op, total_src_blocks, op_name)
+ elif op.type == common.OpType.IMGDIFF and self.minor_version >= 4:
+ self._CheckAnyDiffOperation(data_length, total_dst_blocks, op_name)
self._CheckAnySourceOperation(op, total_src_blocks, op_name)
else:
raise error.PayloadError(
@@ -1038,6 +1041,7 @@
common.OpType.BSDIFF: 0,
common.OpType.SOURCE_COPY: 0,
common.OpType.SOURCE_BSDIFF: 0,
+ common.OpType.IMGDIFF: 0,
}
# Total blob sizes for each operation type.
op_blob_totals = {
@@ -1047,6 +1051,7 @@
common.OpType.BSDIFF: 0,
# SOURCE_COPY operations don't have blobs.
common.OpType.SOURCE_BSDIFF: 0,
+ common.OpType.IMGDIFF: 0,
}
# Counts of hashed vs unhashed operations.
blob_hash_counts = {