Include merge_target_files.py deps in otatools.zip, use common argv processing.
The merge_target_files.py script needs fc_sort and sefcontext_compile, so include these tools into otatools.zip via core/Makefile. Modify tools/releasetools/merge_target_files.py to use the otatools common argv processing to take advantage of the '--path' option so that we add point the '--path' option to an extracted otatools.zip package to gain access to fc_sort, sefcontext_compile, and soong_zip (previously included in otatools.zip). Bug: 123600124 Test: extract otatools.zip, use --path option to point to it, verify result Change-Id: I7d84525981b8741c6bdbcac9984256920fc7f417
This commit is contained in:
@@ -3417,6 +3417,8 @@ OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
|
|||||||
$(HOST_OUT_EXECUTABLES)/lib/shflags/shflags \
|
$(HOST_OUT_EXECUTABLES)/lib/shflags/shflags \
|
||||||
$(HOST_OUT_EXECUTABLES)/delta_generator \
|
$(HOST_OUT_EXECUTABLES)/delta_generator \
|
||||||
$(HOST_OUT_EXECUTABLES)/care_map_generator \
|
$(HOST_OUT_EXECUTABLES)/care_map_generator \
|
||||||
|
$(HOST_OUT_EXECUTABLES)/fc_sort \
|
||||||
|
$(HOST_OUT_EXECUTABLES)/sefcontext_compile \
|
||||||
$(LPMAKE) \
|
$(LPMAKE) \
|
||||||
$(AVBTOOL) \
|
$(AVBTOOL) \
|
||||||
$(BLK_ALLOC_TO_BASE_FS) \
|
$(BLK_ALLOC_TO_BASE_FS) \
|
||||||
|
@@ -35,7 +35,6 @@ Usage: merge_target_files.py [args]
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import argparse
|
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@@ -48,6 +47,10 @@ import add_img_to_target_files
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
OPTIONS = common.OPTIONS
|
OPTIONS = common.OPTIONS
|
||||||
OPTIONS.verbose = True
|
OPTIONS.verbose = True
|
||||||
|
OPTIONS.system_target_files = None
|
||||||
|
OPTIONS.other_target_files = None
|
||||||
|
OPTIONS.output_target_files = None
|
||||||
|
OPTIONS.keep_tmp = False
|
||||||
|
|
||||||
# system_extract_as_is_item_list is a list of items to extract from the partial
|
# system_extract_as_is_item_list is a list of items to extract from the partial
|
||||||
# system target files package as is, meaning these items will land in the
|
# system target files package as is, meaning these items will land in the
|
||||||
@@ -561,8 +564,7 @@ def merge_target_files(
|
|||||||
f.write(other_content)
|
f.write(other_content)
|
||||||
|
|
||||||
command = [
|
command = [
|
||||||
# TODO(124468071): Use soong_zip from otatools.zip
|
'soong_zip',
|
||||||
'prebuilts/build-tools/linux-x86/bin/soong_zip',
|
|
||||||
'-d',
|
'-d',
|
||||||
'-o', output_zip,
|
'-o', output_zip,
|
||||||
'-C', output_target_files_temp_dir,
|
'-C', output_target_files_temp_dir,
|
||||||
@@ -643,36 +645,41 @@ def main():
|
|||||||
|
|
||||||
common.InitLogging()
|
common.InitLogging()
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
def option_handler(o, a):
|
||||||
|
if o == '--system-target-files':
|
||||||
|
OPTIONS.system_target_files = a
|
||||||
|
elif o == '--other-target-files':
|
||||||
|
OPTIONS.other_target_files = a
|
||||||
|
elif o == '--output-target-files':
|
||||||
|
OPTIONS.output_target_files = a
|
||||||
|
elif o == '--keep_tmp':
|
||||||
|
OPTIONS.keep_tmp = True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
parser.add_argument(
|
args = common.ParseOptions(
|
||||||
'--system-target-files',
|
sys.argv[1:], __doc__,
|
||||||
required=True,
|
extra_long_opts=[
|
||||||
help='The input target files package containing system bits.')
|
'system-target-files=',
|
||||||
|
'other-target-files=',
|
||||||
|
'output-target-files=',
|
||||||
|
"keep_tmp",
|
||||||
|
],
|
||||||
|
extra_option_handler=option_handler)
|
||||||
|
|
||||||
parser.add_argument(
|
if (len(args) != 0 or
|
||||||
'--other-target-files',
|
OPTIONS.system_target_files is None or
|
||||||
required=True,
|
OPTIONS.other_target_files is None or
|
||||||
help='The input target files package containing other bits.')
|
OPTIONS.output_target_files is None):
|
||||||
|
common.Usage(__doc__)
|
||||||
parser.add_argument(
|
return 1
|
||||||
'--output-target-files',
|
|
||||||
required=True,
|
|
||||||
help='The output merged target files package.')
|
|
||||||
|
|
||||||
parser.add_argument(
|
|
||||||
'--keep-tmp',
|
|
||||||
required=False,
|
|
||||||
action='store_true',
|
|
||||||
help='Keep the temporary directories after execution.')
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
return merge_target_files_with_temp_dir(
|
return merge_target_files_with_temp_dir(
|
||||||
system_target_files=args.system_target_files,
|
system_target_files=OPTIONS.system_target_files,
|
||||||
other_target_files=args.other_target_files,
|
other_target_files=OPTIONS.other_target_files,
|
||||||
output_target_files=args.output_target_files,
|
output_target_files=OPTIONS.output_target_files,
|
||||||
keep_tmp=args.keep_tmp)
|
keep_tmp=OPTIONS.keep_tmp)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Reference in New Issue
Block a user