Skip to content

Commit 2c86116

Browse files
committed
【修改】:解决子模块更新出现的错误
1 parent 9ea9c25 commit 2c86116

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

cmds/cmd_package.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -295,30 +295,33 @@ def install_pkg(env_root, bsp_root, pkg):
295295
if package_url[-4:] == '.git':
296296

297297
repo_path = os.path.join(bsp_pkgs_path, pkgs_name_in_json)
298-
repo_path__ = repo_path + '-' + pkg['ver']
298+
repo_path = repo_path + '-' + pkg['ver']
299+
repo_path_full = '"' + repo_path + '"'
299300

300-
repo_path = '"' + repo_path + '-' + pkg['ver'] + '"'
301-
cmd = 'git clone ' + package_url + ' ' + repo_path
301+
cmd = 'git clone ' + package_url + ' ' + repo_path_full
302302
execute_command(cmd, cwd=bsp_pkgs_path)
303303

304304
cmd = 'git checkout -q ' + ver_sha
305-
execute_command(cmd, cwd=repo_path__)
305+
execute_command(cmd, cwd=repo_path)
306306

307307
if upstream_change_flag:
308308
cmd = 'git remote set-url origin ' + url_from_json
309-
execute_command(cmd, cwd=repo_path__)
309+
execute_command(cmd, cwd=repo_path)
310310

311311
# If there is a .gitmodules file in the package, prepare to update the
312312
# submodule.
313313
submod_path = os.path.join(repo_path, '.gitmodules')
314314
if os.path.isfile(submod_path):
315315
print("Start to update submodule")
316+
# print("开始更新软件包子模块")
316317

317318
if os.path.isfile(env_config_file) and find_macro_in_config(env_config_file, 'SYS_PKGS_DOWNLOAD_ACCELERATE'):
319+
# print("开启了镜像加速,开始修改 .gitmodules 文件")
318320
replace_list = modify_submod_file_to_mirror(submod_path) # Modify .gitmodules file
319321

322+
# print("开始执行更新动作")
320323
cmd = 'git submodule update --init --recursive'
321-
execute_command(cmd, cwd=repo_path__)
324+
execute_command(cmd, cwd=repo_path)
322325

323326
if os.path.isfile(env_config_file) and find_macro_in_config(env_config_file, 'SYS_PKGS_DOWNLOAD_ACCELERATE'):
324327
if len(replace_list):
@@ -331,7 +334,7 @@ def install_pkg(env_root, bsp_root, pkg):
331334
if os.path.isfile(env_config_file) and find_macro_in_config(env_config_file, 'SYS_PKGS_DOWNLOAD_ACCELERATE'):
332335
if os.path.isfile(submod_path):
333336
cmd = 'git checkout .gitmodules'
334-
execute_command(cmd, cwd=repo_path__)
337+
execute_command(cmd, cwd=repo_path)
335338

336339
else:
337340
# Download a package of compressed package type.
@@ -623,7 +626,7 @@ def error_packages_handle(error_packages_list, read_back_pkgs_json, pkgs_fn):
623626
if len(error_packages_list):
624627
print("\n==============================> Packages list to download : \n")
625628
for pkg in error_packages_list:
626-
print("Packages name : %s, Ver : %s"%(pkg['name'].encode("utf-8"), pkg['ver'].encode("utf-8")))
629+
print("Package name : %s, Ver : %s"%(pkg['name'].encode("utf-8"), pkg['ver'].encode("utf-8")))
627630
print("\nThe packages in the list above are accidentally deleted, env will redownload them.")
628631
print("Warning: Packages should be deleted in <menuconfig> command.\n")
629632

0 commit comments

Comments
 (0)