@@ -262,10 +262,9 @@ def install_pkg(env_root, bsp_root, pkg):
262262 ver_sha = get_ver_sha
263263
264264 upstream_change_flag = True
265-
266265 except Exception , e :
267266 # print('e.message:%s\t' % e.message)
268- print ("Failed to obtain mirror url , package will be downloaded from non-mirror server." )
267+ print ("Failed to connect to the mirror server , package will be downloaded from non-mirror server." )
269268
270269 if package_url [- 4 :] == '.git' :
271270
@@ -459,18 +458,22 @@ def update_latest_packages(pkgs_fn, bsp_packages_path):
459458 repo_path = os .path .join (bsp_packages_path , pkgs_name_in_json )
460459 repo_path = get_pkg_folder_by_orign_path (repo_path , pkg ['ver' ])
461460
462- # If mirror acceleration is enabled, get the update address from
463- # the mirror server.
464- if os .path .isfile (env_config_file ) and find_macro_in_config (env_config_file , 'SYS_PKGS_DOWNLOAD_ACCELERATE' ):
465- payload_pkgs_name_in_json = pkgs_name_in_json .encode ("utf-8" )
461+ try :
462+ # If mirror acceleration is enabled, get the update address from
463+ # the mirror server.
464+ if os .path .isfile (env_config_file ) and find_macro_in_config (env_config_file , 'SYS_PKGS_DOWNLOAD_ACCELERATE' ):
465+ payload_pkgs_name_in_json = pkgs_name_in_json .encode ("utf-8" )
466466
467- # Change repo's upstream address.
468- mirror_url = get_url_from_mirror_server (
469- payload_pkgs_name_in_json , pkg ['ver' ])
467+ # Change repo's upstream address.
468+ mirror_url = get_url_from_mirror_server (
469+ payload_pkgs_name_in_json , pkg ['ver' ])
470470
471- if mirror_url [0 ] != None :
472- cmd = 'git remote set-url origin ' + mirror_url [0 ]
473- git_cmd_exec (cmd , repo_path )
471+ if mirror_url [0 ] != None :
472+ cmd = 'git remote set-url origin ' + mirror_url [0 ]
473+ git_cmd_exec (cmd , repo_path )
474+
475+ except Exception , e :
476+ print ("Failed to connect to the mirror server, using non-mirror server to update." )
474477
475478 # Update the package repository from upstream.
476479 cmd = 'git pull'
0 commit comments