releasetools: Fix fstab path detection when input_file is a path to zip

If _FindAndLoadRecoveryFstab() is called with a path to target files zip
file, then it'll always attempt to read the fallback recovery.fstab
path. By making sure to pass zipfile.ZipFile(), it'll be able to read
the zip file ToC and use the correct path instead.

Test: Generate signed ota package for gts4lv
Change-Id: I4f3b975c677b7928999d0fe4fb137c868d7a206e
This commit is contained in:
LuK1337 2024-01-28 11:08:16 +01:00 committed by Bartłomiej Rudecki
parent 73d586ad36
commit 201b843839
Signed by: przekichane
GPG key ID: 751F23C6F014EF76

View file

@ -945,6 +945,10 @@ def LoadInfoDict(input_file, repacking=False):
makeint(b.replace(".img", "_size"))
# Load recovery fstab if applicable.
if isinstance(input_file, str) and zipfile.is_zipfile(input_file):
with zipfile.ZipFile(input_file, 'r', allowZip64=True) as input_zip:
d["fstab"] = _FindAndLoadRecoveryFstab(d, input_zip, read_helper)
else:
d["fstab"] = _FindAndLoadRecoveryFstab(d, input_file, read_helper)
ramdisk_format = GetRamdiskFormat(d)