Merge "releasetools: Fix an issue in common.GetSparseImage"

This commit is contained in:
Treehugger Robot
2021-02-25 05:05:42 +00:00
committed by Gerrit Code Review

View File

@@ -1939,12 +1939,13 @@ def GetSparseImage(which, tmpdir, input_zip, allow_shared_blocks,
# filename listed in system.map may contain an additional leading slash # filename listed in system.map may contain an additional leading slash
# (i.e. "//system/framework/am.jar"). Using lstrip to get consistent # (i.e. "//system/framework/am.jar"). Using lstrip to get consistent
# results. # results.
arcname = entry.replace(which, which.upper(), 1).lstrip('/') # And handle another special case, where files not under /system
# Special handling another case, where files not under /system
# (e.g. "/sbin/charger") are packed under ROOT/ in a target_files.zip. # (e.g. "/sbin/charger") are packed under ROOT/ in a target_files.zip.
if which == 'system' and not arcname.startswith('SYSTEM'): arcname = entry.lstrip('/')
if which == 'system' and not arcname.startswith('system'):
arcname = 'ROOT/' + arcname arcname = 'ROOT/' + arcname
else:
arcname = arcname.replace(which, which.upper(), 1)
assert arcname in input_zip.namelist(), \ assert arcname in input_zip.namelist(), \
"Failed to find the ZIP entry for {}".format(entry) "Failed to find the ZIP entry for {}".format(entry)