@@ -256,7 +256,7 @@ def install_pkg(env_root, bsp_root, pkg):
256256 upstream_change_flag = False
257257
258258 try :
259- if os .path .isfile (env_config_file ) and find_macro_in_config (env_config_file , 'SYS_PKGS_DOWNLOAD_ACCELERATE' ):
259+ if ( not os .path .isfile (env_config_file )) or ( os . path . isfile ( env_config_file ) and find_macro_in_config (env_config_file , 'SYS_PKGS_DOWNLOAD_ACCELERATE' ) ):
260260 get_package_url , get_ver_sha = get_url_from_mirror_server (pkgs_name_in_json , pkg ['ver' ])
261261
262262 # determine whether the package package url is valid
@@ -296,23 +296,23 @@ def install_pkg(env_root, bsp_root, pkg):
296296 print ("Start to update submodule" )
297297 # print("开始更新软件包子模块")
298298
299- if os .path .isfile (env_config_file ) and find_macro_in_config (env_config_file , 'SYS_PKGS_DOWNLOAD_ACCELERATE' ):
299+ if ( not os .path .isfile (env_config_file )) or ( os . path . isfile ( env_config_file ) and find_macro_in_config (env_config_file , 'SYS_PKGS_DOWNLOAD_ACCELERATE' ) ):
300300 # print("开启了镜像加速,开始修改 .gitmodules 文件")
301301 replace_list = modify_submod_file_to_mirror (submod_path ) # Modify .gitmodules file
302302
303303 # print("开始执行更新动作")
304304 cmd = 'git submodule update --init --recursive'
305305 execute_command (cmd , cwd = repo_path )
306306
307- if os .path .isfile (env_config_file ) and find_macro_in_config (env_config_file , 'SYS_PKGS_DOWNLOAD_ACCELERATE' ):
307+ if ( not os .path .isfile (env_config_file )) or ( os . path . isfile ( env_config_file ) and find_macro_in_config (env_config_file , 'SYS_PKGS_DOWNLOAD_ACCELERATE' ) ):
308308 if len (replace_list ):
309309 for item in replace_list :
310310 submod_dir_path = os .path .join (repo_path , item [2 ])
311311 if os .path .isdir (submod_dir_path ):
312312 cmd = 'git remote set-url origin ' + item [0 ]
313313 execute_command (cmd , cwd = submod_dir_path )
314314
315- if os .path .isfile (env_config_file ) and find_macro_in_config (env_config_file , 'SYS_PKGS_DOWNLOAD_ACCELERATE' ):
315+ if ( not os .path .isfile (env_config_file )) or ( os . path . isfile ( env_config_file ) and find_macro_in_config (env_config_file , 'SYS_PKGS_DOWNLOAD_ACCELERATE' ) ):
316316 if os .path .isfile (submod_path ):
317317 cmd = 'git checkout .gitmodules'
318318 execute_command (cmd , cwd = repo_path )
@@ -476,7 +476,7 @@ def update_latest_packages(pkgs_fn, bsp_packages_path):
476476 try :
477477 # If mirror acceleration is enabled, get the update address from
478478 # the mirror server.
479- if os .path .isfile (env_config_file ) and find_macro_in_config (env_config_file , 'SYS_PKGS_DOWNLOAD_ACCELERATE' ):
479+ if ( not os .path .isfile (env_config_file )) or ( os . path . isfile ( env_config_file ) and find_macro_in_config (env_config_file , 'SYS_PKGS_DOWNLOAD_ACCELERATE' ) ):
480480 payload_pkgs_name_in_json = pkgs_name_in_json .encode ("utf-8" )
481481
482482 # Change repo's upstream address.
@@ -981,7 +981,7 @@ def upgrade_packages_index():
981981 env_root = Import ('env_root' )
982982 env_kconfig_path = os .path .join (env_root , 'tools\scripts\cmds' )
983983 env_config_file = os .path .join (env_kconfig_path , '.config' )
984- if os .path .isfile (env_config_file ) and find_macro_in_config (env_config_file , 'SYS_PKGS_DOWNLOAD_ACCELERATE' ):
984+ if ( not os .path .isfile (env_config_file )) or ( os . path . isfile ( env_config_file ) and find_macro_in_config (env_config_file , 'SYS_PKGS_DOWNLOAD_ACCELERATE' ) ):
985985 get_package_url , get_ver_sha = get_url_from_mirror_server ('packages' , 'latest' )
986986 if get_package_url != None :
987987 git_repo = get_package_url
@@ -1025,7 +1025,7 @@ def upgrade_env_script():
10251025 env_root = Import ('env_root' )
10261026 env_kconfig_path = os .path .join (env_root , 'tools\scripts\cmds' )
10271027 env_config_file = os .path .join (env_kconfig_path , '.config' )
1028- if os .path .isfile (env_config_file ) and find_macro_in_config (env_config_file , 'SYS_PKGS_DOWNLOAD_ACCELERATE' ):
1028+ if ( not os .path .isfile (env_config_file )) or ( os . path . isfile ( env_config_file ) and find_macro_in_config (env_config_file , 'SYS_PKGS_DOWNLOAD_ACCELERATE' ) ):
10291029 get_package_url , get_ver_sha = get_url_from_mirror_server ('env' , 'latest' )
10301030 if get_package_url != None :
10311031 env_scripts_repo = get_package_url
0 commit comments