summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKelvin Zhang <zhangkelvin@google.com>2020-08-19 23:24:50 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-08-19 23:24:50 +0000
commit05d0bb6a22374a1de2ee3aedf94e10c44dc01093 (patch)
treef6456eab08e373eb82c365ff22a93840cb22b9c1
parent3dd5c82b921b7d0a92d409b137669ea113717af4 (diff)
parent78e384153aa2bcd9f261689fd58084dec5a8e864 (diff)
Update payload.py to work with OTA packages directly am: 9e7a6db367 am: 648780f352 am: d7ab964653 am: 2d53997ce8 am: 78e384153a
Original change: https://android-review.googlesource.com/c/platform/system/update_engine/+/1399747 Change-Id: I79afb02636cf25123b4286116d4f35f878f9929b
-rw-r--r--scripts/update_payload/payload.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/update_payload/payload.py b/scripts/update_payload/payload.py
index ea5ed308..78b8e2ca 100644
--- a/scripts/update_payload/payload.py
+++ b/scripts/update_payload/payload.py
@@ -20,7 +20,9 @@ from __future__ import absolute_import
from __future__ import print_function
import hashlib
+import io
import struct
+import zipfile
from update_payload import applier
from update_payload import checker
@@ -119,6 +121,10 @@ class Payload(object):
payload_file: update payload file object open for reading
payload_file_offset: the offset of the actual payload
"""
+ 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_offset = payload_file_offset
self.manifest_hasher = None