Fix incremental OTA generation failures

source_file might be a directory, use the _ReadApexInfo() helper
function to read it instead of go straight to zipfiles.

Test: build incremental OTA for pixel
Bug: 279142680
Bug: 227848550
Bug: 277028723
(cherry picked from https://android-review.googlesource.com/q/commit:ca45d7a85d5eaf09ba8684f09440e8706ab190ca)
Merged-In: Ia0041e2c72c1a57123519c970f6e734194a81cd2
Change-Id: Ia0041e2c72c1a57123519c970f6e734194a81cd2
This commit is contained in:
Kelvin Zhang 2023-04-21 09:46:47 -07:00 committed by Cherrypicker Worker
parent 056ae79b51
commit 657af614c6

View file

@ -642,8 +642,7 @@ def ConstructOtaApexInfo(target_zip, source_file=None):
if not source_file:
return target_apex_string
with zipfile.ZipFile(source_file, "r", allowZip64=True) as source_zip:
source_apex_string = _ReadApexInfo(source_zip)
source_apex_string = _ReadApexInfo(source_file)
if not source_apex_string:
return target_apex_string