releasetools: Always create IMAGES/ directory.
AddImagesToTargetFiles() takes either a zip file, or a zip root as
input. We used to create IMAGES/ directory only when working with zip
root input. Commit 262bf3f0b5
has changed
to also stage boot / recovery images there when working with a zip file.
This CL makes sure the directory is always available under both modes.
Bug: 63456822
Test: zip -d target_files.zip IMAGES/\*;
add_img_to_target_files.py target_files.zip
Test: sign_target_files_apks.py target_files.zip signed-target_files.zip
Change-Id: Iea91d0403cdec1b16bb93bb71d3ed06856b8f7c3
This commit is contained in:
@@ -481,6 +481,17 @@ def ReplaceUpdatedFiles(zip_filename, files_list):
|
|||||||
|
|
||||||
|
|
||||||
def AddImagesToTargetFiles(filename):
|
def AddImagesToTargetFiles(filename):
|
||||||
|
"""Creates and adds images (boot/recovery/system/...) to a target_files.zip.
|
||||||
|
|
||||||
|
It works with either a zip file (zip mode), or a directory that contains the
|
||||||
|
files to be packed into a target_files.zip (dir mode). The latter is used when
|
||||||
|
being called from build/make/core/Makefile.
|
||||||
|
|
||||||
|
The images will be created under IMAGES/ in the input target_files.zip.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
filename: the target_files.zip, or the zip root directory.
|
||||||
|
"""
|
||||||
if os.path.isdir(filename):
|
if os.path.isdir(filename):
|
||||||
OPTIONS.input_tmp = os.path.abspath(filename)
|
OPTIONS.input_tmp = os.path.abspath(filename)
|
||||||
input_zip = None
|
input_zip = None
|
||||||
@@ -512,10 +523,13 @@ def AddImagesToTargetFiles(filename):
|
|||||||
else:
|
else:
|
||||||
OPTIONS.info_dict = common.LoadInfoDict(filename, filename)
|
OPTIONS.info_dict = common.LoadInfoDict(filename, filename)
|
||||||
output_zip = None
|
output_zip = None
|
||||||
images_dir = os.path.join(OPTIONS.input_tmp, "IMAGES")
|
|
||||||
if not os.path.isdir(images_dir):
|
# Always make input_tmp/IMAGES available, since we may stage boot / recovery
|
||||||
os.makedirs(images_dir)
|
# images there even under zip mode. The directory will be cleaned up as part
|
||||||
images_dir = None
|
# of OPTIONS.input_tmp.
|
||||||
|
images_dir = os.path.join(OPTIONS.input_tmp, "IMAGES")
|
||||||
|
if not os.path.isdir(images_dir):
|
||||||
|
os.makedirs(images_dir)
|
||||||
|
|
||||||
has_recovery = (OPTIONS.info_dict.get("no_recovery") != "true")
|
has_recovery = (OPTIONS.info_dict.get("no_recovery") != "true")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user