Fix duplicate super_empty.img

When calling add_img_to_target_files twice, super_empty.img will be
written twice, and resulting zip would contain duplicate entries.

Test: th
Bug: 278522974
Change-Id: I2419d0c4f8b04f876a8cc69a1517f59cab94d75d
This commit is contained in:
Kelvin Zhang 2023-04-17 09:52:39 -07:00
parent 629bc8dc1c
commit aecdc18222

View file

@ -818,6 +818,9 @@ def AddSuperEmpty(output_zip):
"""Create a super_empty.img and store it in output_zip."""
img = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES", "super_empty.img")
if os.path.exists(img.name):
logger.info("super_empty.img already exists; no need to rebuild...")
return
build_super_image.BuildSuperImage(OPTIONS.info_dict, img.name)
img.Write()