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
Signed-off-by: RITEFANG <1721985272@qq.com>
This commit is contained in:
LuK1337
2024-01-28 11:08:16 +01:00
committed by SkyMinus
parent 3604743512
commit f040245dd2

View File

@@ -965,7 +965,11 @@ def LoadInfoDict(input_file, repacking=False):
makeint(b.replace(".img", "_size"))
# Load recovery fstab if applicable.
d["fstab"] = _FindAndLoadRecoveryFstab(d, input_file, read_helper)
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)
# Tries to load the build props for all partitions with care_map, including