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:
Wei Liu
2019-10-22 19:21:10 +08:00
committed by wenlingz
parent fbd8597fbf
commit 24d3eaba27
7 changed files with 42 additions and 35 deletions

View File

@@ -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):

View File

@@ -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)

View File

@@ -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):

View File

@@ -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):