diff options
Diffstat (limited to 'scripts/update_payload/checker.py')
-rw-r--r-- | scripts/update_payload/checker.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/scripts/update_payload/checker.py b/scripts/update_payload/checker.py index 7abf1785..e13ea139 100644 --- a/scripts/update_payload/checker.py +++ b/scripts/update_payload/checker.py @@ -56,6 +56,7 @@ _SUPPORTED_MINOR_VERSIONS = { 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 @@ class PayloadChecker(object): 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 @@ class PayloadChecker(object): 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 @@ class PayloadChecker(object): 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 @@ class PayloadChecker(object): 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 @@ class PayloadChecker(object): 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 = { |