From f1d6ceaedbcf81044d6af6b716c63ed79996f0a4 Mon Sep 17 00:00:00 2001 From: Amin Hassani Date: Thu, 7 Dec 2017 12:13:03 -0800 Subject: 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: If82c767a201b189e464f459d5c19485e5278d9b1 Reviewed-on: https://chromium-review.googlesource.com/823227 Commit-Ready: Amin Hassani Tested-by: Amin Hassani Reviewed-by: Ben Chan Reviewed-by: Sen Jiang --- scripts/update_payload/test_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/update_payload/test_utils.py') diff --git a/scripts/update_payload/test_utils.py b/scripts/update_payload/test_utils.py index 61a91f53..bfdc40e6 100644 --- a/scripts/update_payload/test_utils.py +++ b/scripts/update_payload/test_utils.py @@ -282,7 +282,7 @@ class EnhancedPayloadGenerator(PayloadGenerator): Args: is_kernel: whether this is a kernel (True) or rootfs (False) operation - op_type: one of REPLACE, REPLACE_BZ, MOVE or BSDIFF + op_type: one of REPLACE, REPLACE_BZ, REPLACE_XZ, MOVE or BSDIFF src_extents: list of (start, length) pairs indicating src block ranges src_length: size of the src data in bytes (needed for BSDIFF) dst_extents: list of (start, length) pairs indicating dst block ranges -- cgit v1.2.3 From b44f73baa8d302a077ab1c0c73eac63bd02350e5 Mon Sep 17 00:00:00 2001 From: Amin Hassani Date: Fri, 15 Dec 2017 17:45:49 +0000 Subject: Revert "update_payload: Add XZ compression support" This reverts commit f1d6ceaedbcf81044d6af6b716c63ed79996f0a4. Reason for revert: Original change's description: > 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: If82c767a201b189e464f459d5c19485e5278d9b1 > Reviewed-on: https://chromium-review.googlesource.com/823227 > Commit-Ready: Amin Hassani > Tested-by: Amin Hassani > Reviewed-by: Ben Chan > Reviewed-by: Sen Jiang TBR=benchan@chromium.org,senj@chromium.org,ahassani@chromium.org Change-Id: I931ff3be081a41fe5fceef0e049ba4165c6acb49 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: chromium:795313 Reviewed-on: https://chromium-review.googlesource.com/830054 Commit-Ready: Amin Hassani Tested-by: Amin Hassani Reviewed-by: Amin Hassani Reviewed-by: Ben Chan --- scripts/update_payload/test_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/update_payload/test_utils.py') diff --git a/scripts/update_payload/test_utils.py b/scripts/update_payload/test_utils.py index bfdc40e6..61a91f53 100644 --- a/scripts/update_payload/test_utils.py +++ b/scripts/update_payload/test_utils.py @@ -282,7 +282,7 @@ class EnhancedPayloadGenerator(PayloadGenerator): Args: is_kernel: whether this is a kernel (True) or rootfs (False) operation - op_type: one of REPLACE, REPLACE_BZ, REPLACE_XZ, MOVE or BSDIFF + op_type: one of REPLACE, REPLACE_BZ, MOVE or BSDIFF src_extents: list of (start, length) pairs indicating src block ranges src_length: size of the src data in bytes (needed for BSDIFF) dst_extents: list of (start, length) pairs indicating dst block ranges -- cgit v1.2.3 From b05a65a748bd2e2542e7b05f629d3bc69c8d8135 Mon Sep 17 00:00:00 2001 From: Amin Hassani Date: Mon, 18 Dec 2017 15:15:32 -0800 Subject: update_payload: Fix most of lint styling issues. This patch fixes a lot of pylint issues in the update_engine scripts. Majority of this changes are based on recommendation found in: https://www.chromium.org/chromium-os/python-style-guidelines It is a good idea to do these changes now, because if there are many pylint errors when performing 'repo upload', serious problems can be overshadowed by a lot of noise and eventually cause problems. These fixes include: - Fixing executable shebangs to /usr/bin/python2. - Fixing import-error problems by disabiling them. - Removing pylint disables that are not valid anymore. - Changing all imports to proper absolute import format. - Change the import of PayloadError from update_payload.PayloadError for simplicity. - Add pydoc strings for functions and classes that were missing. The remaining unchanged pylint problmes include: - The header files of these scripts are in CrOS copyright format, but the the cros lint hook is configured to AoSP copyright format. - The test* functions in unittests are not compatible with CamelCase format. BUG=chromium:796338 TEST=unittests pass TEST=start_devserver TEST=cros flash TEST=scripts/paycheck.py Change-Id: I7eed4d1625eb7c510c7949fada120de5a6a26c7b Reviewed-on: https://chromium-review.googlesource.com/834875 Commit-Ready: Amin Hassani Tested-by: Amin Hassani Reviewed-by: Ben Chan Reviewed-by: Sen Jiang --- scripts/update_payload/test_utils.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'scripts/update_payload/test_utils.py') diff --git a/scripts/update_payload/test_utils.py b/scripts/update_payload/test_utils.py index 61a91f53..38712fb1 100644 --- a/scripts/update_payload/test_utils.py +++ b/scripts/update_payload/test_utils.py @@ -12,9 +12,9 @@ import os import struct import subprocess -import common -import payload -import update_metadata_pb2 +from update_payload import common +from update_payload import payload +from update_payload import update_metadata_pb2 class TestError(Exception): @@ -84,7 +84,6 @@ def SignSha256(data, privkey_file_name): Raises: TestError if something goes wrong. """ - # pylint: disable=E1101 data_sha256_hash = common.SIG_ASN1_HEADER + hashlib.sha256(data).digest() sign_cmd = ['openssl', 'rsautl', '-sign', '-inkey', privkey_file_name] try: @@ -110,8 +109,6 @@ class SignaturesGenerator(object): version: signature version (None means do not assign) data: signature binary data (None means do not assign) """ - # Pylint fails to identify a member of the Signatures message. - # pylint: disable=E1101 sig = self.sigs.signatures.add() if version is not None: sig.version = version @@ -174,11 +171,9 @@ class PayloadGenerator(object): part_hash: the partition hash """ if is_kernel: - # pylint: disable=E1101 part_info = (self.manifest.new_kernel_info if is_new else self.manifest.old_kernel_info) else: - # pylint: disable=E1101 part_info = (self.manifest.new_rootfs_info if is_new else self.manifest.old_rootfs_info) _SetMsgField(part_info, 'size', part_size) @@ -188,7 +183,6 @@ class PayloadGenerator(object): data_length=None, src_extents=None, src_length=None, dst_extents=None, dst_length=None, data_sha256_hash=None): """Adds an InstallOperation entry.""" - # pylint: disable=E1101 operations = (self.manifest.kernel_install_operations if is_kernel else self.manifest.install_operations) @@ -293,7 +287,6 @@ class EnhancedPayloadGenerator(PayloadGenerator): data_offset = data_length = data_sha256_hash = None if data_blob is not None: if do_hash_data_blob: - # pylint: disable=E1101 data_sha256_hash = hashlib.sha256(data_blob).digest() data_length, data_offset = self.AddData(data_blob) -- cgit v1.2.3