diff options
author | Kelvin Zhang <zhangkelvin@google.com> | 2020-12-01 12:06:40 -0500 |
---|---|---|
committer | Treehugger Robot <treehugger-gerrit@google.com> | 2020-12-14 19:28:58 +0000 |
commit | 576efc53d5499558c911dbe476487016f9490592 (patch) | |
tree | 3a0174c617b10f0dfe70f336ebe2878b672819aa /scripts/update_payload/payload.py | |
parent | eb8703b9f6db3fb386507b71f180c98ca3137638 (diff) |
Add host side simulation python script
This enables host side simulation of partial updates with the original
complete target file
Bug: 171519321
Test: run this script with a partial update
python3 simulate_ota.py --source
~/aosp/aosp_cf_x86_phone-target_files-6949164.zip --target
~/aosp/aosp_cf_x86_phone-target_files-6937553.zip
~/aosp/cf_x86_downgrade.zip
Change-Id: Iec52d8ac585b499d50bdb0c89d203ea353f2e94f
Diffstat (limited to 'scripts/update_payload/payload.py')
-rw-r--r-- | scripts/update_payload/payload.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/update_payload/payload.py b/scripts/update_payload/payload.py index fe3a4502..6b28046e 100644 --- a/scripts/update_payload/payload.py +++ b/scripts/update_payload/payload.py @@ -124,8 +124,11 @@ class Payload(object): if zipfile.is_zipfile(payload_file): with zipfile.ZipFile(payload_file) as zfp: with zfp.open("payload.bin") as payload_fp: - payload_file = io.BytesIO(payload_fp.read()) - self.payload_file = payload_file + self.payload_file = io.BytesIO(payload_fp.read()) + elif isinstance(payload_file, str): + self.payload_file = open(payload_file, "rb") + else: + self.payload_file = payload_file self.payload_file_offset = payload_file_offset self.manifest_hasher = None self.is_init = False |