mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-04 13:19:47 +00:00
acrn-config: skip git environment check when not do git commit
Check git environment only when '--enable_commit' option was set. Tracked-On: #3854 Signed-off-by: Wei Liu <weix.w.liu@intel.com> Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
parent
fbd8597fbf
commit
24d3eaba27
@ -35,6 +35,11 @@ def main(args):
|
||||
if err_dic:
|
||||
return err_dic
|
||||
|
||||
# check env
|
||||
err_dic = board_cfg_lib.prepare(enable_commit)
|
||||
if err_dic:
|
||||
return err_dic
|
||||
|
||||
board_cfg_lib.BOARD_INFO_FILE = board_info_file
|
||||
board_cfg_lib.SCENARIO_INFO_FILE = scenario_info_file
|
||||
board_cfg_lib.get_vm_count(scenario_info_file)
|
||||
@ -124,11 +129,13 @@ def main(args):
|
||||
|
||||
def ui_entry_api(board_info,scenario_info, enable_commit=False):
|
||||
|
||||
git_env_check = False
|
||||
arg_list = ['board_cfg_gen.py', '--board', board_info, '--scenario', scenario_info]
|
||||
if enable_commit:
|
||||
arg_list.append('--enable_commit')
|
||||
git_env_check = True
|
||||
|
||||
err_dic = board_cfg_lib.prepare()
|
||||
err_dic = board_cfg_lib.prepare(git_env_check)
|
||||
if err_dic:
|
||||
return err_dic
|
||||
|
||||
@ -139,12 +146,6 @@ def ui_entry_api(board_info,scenario_info, enable_commit=False):
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
err_dic = board_cfg_lib.prepare()
|
||||
if err_dic:
|
||||
for err_k, err_v in err_dic.items():
|
||||
board_cfg_lib.print_red("{}: {}".format(err_k, err_v), err=True)
|
||||
sys.exit(1)
|
||||
|
||||
ARGS = sys.argv
|
||||
err_dic = main(ARGS)
|
||||
if err_dic:
|
||||
|
@ -84,13 +84,14 @@ def validate_launch_setting(board_info, scenario_info, launch_info):
|
||||
def ui_entry_api(board_info, scenario_info, launch_info, enable_commit=False):
|
||||
|
||||
err_dic = {}
|
||||
|
||||
git_env_check = False
|
||||
arg_list = ['board_cfg_gen.py', '--board', board_info, '--scenario', scenario_info, '--launch', launch_info, '--uosid', '0']
|
||||
|
||||
if enable_commit:
|
||||
arg_list.append('--enable_commit')
|
||||
git_env_check = True
|
||||
|
||||
err_dic = launch_cfg_lib.prepare()
|
||||
err_dic = launch_cfg_lib.prepare(git_env_check)
|
||||
if err_dic:
|
||||
return err_dic
|
||||
|
||||
@ -148,6 +149,12 @@ def main(args):
|
||||
(err_dic, board_info_file, scenario_info_file, launch_info_file, vm_th, enable_commit) = launch_cfg_lib.get_param(args)
|
||||
if err_dic:
|
||||
return err_dic
|
||||
|
||||
# check env
|
||||
err_dic = launch_cfg_lib.prepare(enable_commit)
|
||||
if err_dic:
|
||||
return err_dic
|
||||
|
||||
# vm_th =[0..post_vm_max]
|
||||
# 0: generate all launch script for all post vm launch script
|
||||
# 1: generate launch script for 1st post vm launch script
|
||||
@ -236,12 +243,6 @@ def main(args):
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
err_dic = launch_cfg_lib.prepare()
|
||||
if err_dic:
|
||||
for err_k, err_v in err_dic.items():
|
||||
launch_cfg_lib.print_red("{}: {}".format(err_k, err_v), err=True)
|
||||
sys.exit(1)
|
||||
|
||||
ARGS = sys.argv
|
||||
err_dic = main(ARGS)
|
||||
if err_dic:
|
||||
|
@ -34,9 +34,9 @@ ERR_LIST = {}
|
||||
HEADER_LICENSE = common.open_license() + "\n"
|
||||
|
||||
|
||||
def prepare():
|
||||
def prepare(check_git):
|
||||
""" check environment """
|
||||
return common.check_env()
|
||||
return common.check_env(check_git)
|
||||
|
||||
|
||||
def print_yel(msg, warn=False):
|
||||
|
@ -15,7 +15,6 @@ HV_LICENSE_FILE = SOURCE_PATH + 'misc/acrn-config/library/hypervisor_license'
|
||||
|
||||
|
||||
PY_CACHES = ["__pycache__", "../board_config/__pycache__", "../scenario_config/__pycache__"]
|
||||
BIN_LIST = ['git']
|
||||
GUEST_FLAG = ["0UL", "GUEST_FLAG_SECURE_WORLD_ENABLED", "GUEST_FLAG_LAPIC_PASSTHROUGH",
|
||||
"GUEST_FLAG_IO_COMPLETION_POLLING", "GUEST_FLAG_CLOS_REQUIRED",
|
||||
"GUEST_FLAG_HIDE_MTRR", "GUEST_FLAG_RT", "GUEST_FLAG_HIGHEST_SEVERITY"]
|
||||
@ -105,10 +104,19 @@ def get_param(args):
|
||||
return (err_dic, board_info_file, scenario_info_file, enable_commit)
|
||||
|
||||
|
||||
def check_env():
|
||||
def check_env(check_git=False):
|
||||
""" Prepare to check the environment """
|
||||
err_dic = {}
|
||||
for excute in BIN_LIST:
|
||||
bin_list = []
|
||||
|
||||
if check_git:
|
||||
bin_list.append('git')
|
||||
|
||||
usr_dir = os.environ['HOME']
|
||||
if not os.path.isfile("{}/.gitconfig".format(usr_dir)):
|
||||
err_dic['commn error: check env failed'] = "git not configured!"
|
||||
|
||||
for excute in bin_list:
|
||||
res = subprocess.Popen("which {}".format(excute), shell=True, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE, close_fds=True)
|
||||
|
||||
@ -125,10 +133,6 @@ def check_env():
|
||||
if "acrn" not in line:
|
||||
err_dic['commn error: check env failed'] = "Run this tool in acrn-hypervisor mainline source code!"
|
||||
|
||||
usr_dir = os.environ['HOME']
|
||||
if not os.path.isfile("{}/.gitconfig".format(usr_dir)):
|
||||
err_dic['commn error: check env failed'] = "git not configured!"
|
||||
|
||||
for py_cache in PY_CACHES:
|
||||
if os.path.exists(py_cache):
|
||||
shutil.rmtree(py_cache)
|
||||
|
@ -54,9 +54,9 @@ PT_SLOT = {
|
||||
POST_UUID_DIC = {}
|
||||
|
||||
|
||||
def prepare():
|
||||
def prepare(check_git):
|
||||
""" Check environment """
|
||||
return common.check_env()
|
||||
return common.check_env(check_git)
|
||||
|
||||
|
||||
def print_yel(msg, warn=False):
|
||||
|
@ -35,9 +35,9 @@ COMMUNICATE_VM_ID = []
|
||||
|
||||
ERR_LIST = {}
|
||||
|
||||
def prepare():
|
||||
def prepare(check_git):
|
||||
""" Check environment """
|
||||
return common.check_env()
|
||||
return common.check_env(check_git)
|
||||
|
||||
|
||||
def print_yel(msg, warn=False):
|
||||
|
@ -82,6 +82,11 @@ def main(args):
|
||||
if err_dic:
|
||||
return err_dic
|
||||
|
||||
# check env
|
||||
err_dic = scenario_cfg_lib.prepare(enable_commit)
|
||||
if err_dic:
|
||||
return err_dic
|
||||
|
||||
scenario_cfg_lib.BOARD_INFO_FILE = board_info_file
|
||||
scenario_cfg_lib.SCENARIO_INFO_FILE = scenario_info_file
|
||||
|
||||
@ -145,11 +150,13 @@ def main(args):
|
||||
|
||||
def ui_entry_api(board_info, scenario_info, enable_commit=False):
|
||||
|
||||
git_env_check = False
|
||||
arg_list = ['board_cfg_gen.py', '--board', board_info, '--scenario', scenario_info]
|
||||
if enable_commit:
|
||||
arg_list.append('--enable_commit')
|
||||
git_env_check = True
|
||||
|
||||
err_dic = scenario_cfg_lib.prepare()
|
||||
err_dic = scenario_cfg_lib.prepare(git_env_check)
|
||||
if err_dic:
|
||||
return err_dic
|
||||
|
||||
@ -160,12 +167,6 @@ def ui_entry_api(board_info, scenario_info, enable_commit=False):
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
err_dic = scenario_cfg_lib.prepare()
|
||||
if err_dic:
|
||||
for err_k, err_v in err_dic.items():
|
||||
scenario_cfg_lib.print_red("{}: {}".format(err_k, err_v), err=True)
|
||||
sys.exit(1)
|
||||
|
||||
ARGS = sys.argv
|
||||
err_dic = main(ARGS)
|
||||
if err_dic:
|
||||
|
Loading…
Reference in New Issue
Block a user