forked from openkylin/platform_build
Adds --output-ota flag to enable building the OTA package.
This simplifies the use case for mixed build users. Instead of having to remember to call ota_from_target_files.py after this script, they can use this flag to automatically create the OTA package. Bug: 129976345 Test: Ran merge_target_files.py using --output-ota and inspected the resulting zip. Change-Id: Icc95943c24b8f83b3221e845a7d69a34c1edb4fc
This commit is contained in:
parent
f031825560
commit
3b64ce1437
|
@ -54,6 +54,10 @@ Usage: merge_target_files.py [args]
|
||||||
file patterns to copy into the --output-dir. Required if providing
|
file patterns to copy into the --output-dir. Required if providing
|
||||||
the --output-dir flag.
|
the --output-dir flag.
|
||||||
|
|
||||||
|
--output-ota output-ota-package
|
||||||
|
The output ota package. This is a zip archive. Use of this flag may
|
||||||
|
require passing the --path common flag; see common.py.
|
||||||
|
|
||||||
--output-super-empty output-super-empty-image
|
--output-super-empty output-super-empty-image
|
||||||
If provided, creates a super_empty.img file from the merged target
|
If provided, creates a super_empty.img file from the merged target
|
||||||
files package and saves it at this path.
|
files package and saves it at this path.
|
||||||
|
@ -78,6 +82,7 @@ import zipfile
|
||||||
import add_img_to_target_files
|
import add_img_to_target_files
|
||||||
import build_super_image
|
import build_super_image
|
||||||
import common
|
import common
|
||||||
|
import ota_from_target_files
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
OPTIONS = common.OPTIONS
|
OPTIONS = common.OPTIONS
|
||||||
|
@ -90,6 +95,7 @@ OPTIONS.other_item_list = None
|
||||||
OPTIONS.output_target_files = None
|
OPTIONS.output_target_files = None
|
||||||
OPTIONS.output_dir = None
|
OPTIONS.output_dir = None
|
||||||
OPTIONS.output_item_list = None
|
OPTIONS.output_item_list = None
|
||||||
|
OPTIONS.output_ota = None
|
||||||
OPTIONS.output_super_empty = None
|
OPTIONS.output_super_empty = None
|
||||||
OPTIONS.rebuild_recovery = False
|
OPTIONS.rebuild_recovery = False
|
||||||
OPTIONS.keep_tmp = False
|
OPTIONS.keep_tmp = False
|
||||||
|
@ -590,6 +596,7 @@ def merge_target_files(
|
||||||
output_target_files,
|
output_target_files,
|
||||||
output_dir,
|
output_dir,
|
||||||
output_item_list,
|
output_item_list,
|
||||||
|
output_ota,
|
||||||
output_super_empty,
|
output_super_empty,
|
||||||
rebuild_recovery):
|
rebuild_recovery):
|
||||||
"""Merge two target files packages together.
|
"""Merge two target files packages together.
|
||||||
|
@ -625,6 +632,8 @@ def merge_target_files(
|
||||||
output_target_files: The name of the output zip archive target files
|
output_target_files: The name of the output zip archive target files
|
||||||
package created by merging system and other.
|
package created by merging system and other.
|
||||||
|
|
||||||
|
output_ota: The name of the output zip archive ota package.
|
||||||
|
|
||||||
output_super_empty: If provided, creates a super_empty.img file from the
|
output_super_empty: If provided, creates a super_empty.img file from the
|
||||||
merged target files package and saves it at this path.
|
merged target files package and saves it at this path.
|
||||||
|
|
||||||
|
@ -770,6 +779,15 @@ def merge_target_files(
|
||||||
logger.info('creating %s', output_target_files)
|
logger.info('creating %s', output_target_files)
|
||||||
common.RunAndWait(command, verbose=True)
|
common.RunAndWait(command, verbose=True)
|
||||||
|
|
||||||
|
# Create the OTA package from the merged target files package.
|
||||||
|
|
||||||
|
if output_ota:
|
||||||
|
ota_from_target_files_args = [
|
||||||
|
output_zip,
|
||||||
|
output_ota,
|
||||||
|
]
|
||||||
|
ota_from_target_files.main(ota_from_target_files_args)
|
||||||
|
|
||||||
|
|
||||||
def call_func_with_temp_dir(func, keep_tmp):
|
def call_func_with_temp_dir(func, keep_tmp):
|
||||||
"""Manage the creation and cleanup of the temporary directory.
|
"""Manage the creation and cleanup of the temporary directory.
|
||||||
|
@ -827,6 +845,8 @@ def main():
|
||||||
OPTIONS.output_dir = a
|
OPTIONS.output_dir = a
|
||||||
elif o == '--output-item-list':
|
elif o == '--output-item-list':
|
||||||
OPTIONS.output_item_list = a
|
OPTIONS.output_item_list = a
|
||||||
|
elif o == '--output-ota':
|
||||||
|
OPTIONS.output_ota = a
|
||||||
elif o == '--output-super-empty':
|
elif o == '--output-super-empty':
|
||||||
OPTIONS.output_super_empty = a
|
OPTIONS.output_super_empty = a
|
||||||
elif o == '--rebuild_recovery':
|
elif o == '--rebuild_recovery':
|
||||||
|
@ -848,6 +868,7 @@ def main():
|
||||||
'output-target-files=',
|
'output-target-files=',
|
||||||
'output-dir=',
|
'output-dir=',
|
||||||
'output-item-list=',
|
'output-item-list=',
|
||||||
|
'output-ota=',
|
||||||
'output-super-empty=',
|
'output-super-empty=',
|
||||||
'rebuild_recovery',
|
'rebuild_recovery',
|
||||||
'keep-tmp',
|
'keep-tmp',
|
||||||
|
@ -901,6 +922,7 @@ def main():
|
||||||
output_target_files=OPTIONS.output_target_files,
|
output_target_files=OPTIONS.output_target_files,
|
||||||
output_dir=OPTIONS.output_dir,
|
output_dir=OPTIONS.output_dir,
|
||||||
output_item_list=output_item_list,
|
output_item_list=output_item_list,
|
||||||
|
output_ota=OPTIONS.output_ota,
|
||||||
output_super_empty=OPTIONS.output_super_empty,
|
output_super_empty=OPTIONS.output_super_empty,
|
||||||
rebuild_recovery=OPTIONS.rebuild_recovery),
|
rebuild_recovery=OPTIONS.rebuild_recovery),
|
||||||
OPTIONS.keep_tmp)
|
OPTIONS.keep_tmp)
|
||||||
|
|
Loading…
Reference in New Issue