acrn-config: add "enable_commit" parameter for config tool

Config tool will generate files for board/scenaro/launch, some files are
part of souce code for specify board. Git add/commit these files should
be one optional of user experience. Add "--enable_commit" parameter to
enable git add/commit.

usage:
--enable_commit: flag of whether to do git commit the config file changes
to current git branch. Do commit with this flag and not do without the flag.

Tracked-On: #3834
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
Wei Liu
2019-10-14 19:47:55 +08:00
committed by ACRN System Integration
parent 780a53a175
commit 8eaee3b09b
5 changed files with 76 additions and 35 deletions

View File

@@ -31,7 +31,7 @@ def main(args):
config_srcs = []
config_dirs = []
(err_dic, board_info_file, scenario_info_file) = board_cfg_lib.get_param(args)
(err_dic, board_info_file, scenario_info_file, enable_commit) = board_cfg_lib.get_param(args)
if err_dic:
return err_dic
@@ -104,22 +104,29 @@ def main(args):
if err_dic:
return err_dic
config_str = 'Config files'
gen_str = 'generated'
# move changes to patch, and apply to the source code
err_dic = board_cfg_lib.gen_patch(config_srcs, board)
if enable_commit:
err_dic = board_cfg_lib.gen_patch(config_srcs, board)
config_str = 'Config patch'
gen_str = 'committed'
if board not in board_cfg_lib.BOARD_NAMES and not err_dic:
print("Config patch for NEW board {} is committed successfully!".format(board))
print("{} for NEW board {} is {} successfully!".format(config_str, board, gen_str))
elif not err_dic:
print("Config patch for {} is committed successfully!".format(board))
print("{} for {} is {} successfully!".format(config_str, board, gen_str))
else:
print("Config patch for {} is failed".format(board))
print("{} for {} is failed".format(config_str, board))
return err_dic
def ui_entry_api(board_info,scenario_info):
def ui_entry_api(board_info,scenario_info, enable_commit=False):
arg_list = ['board_cfg_gen.py', '--board', board_info, '--scenario', scenario_info]
if enable_commit:
arg_list.append('--enable_commit')
err_dic = board_cfg_lib.prepare()
if err_dic: