Skip to content

Commit ad8edc6

Browse files
committed
Merge commit '3371e5145480ff968c1d4bc3543e5705c91d8d89'
# Conflicts: # cmds/cmd_package.py
2 parents 8ad6a27 + 3371e51 commit ad8edc6

File tree

1 file changed

+40
-52
lines changed

1 file changed

+40
-52
lines changed

cmds/cmd_package.py

Lines changed: 40 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -501,47 +501,6 @@ def pre_package_update():
501501

502502
return [oldpkgs, newpkgs, pkgs_fn, bsp_packages_path, dbsqlite_pathname]
503503

504-
def error_packages_handle(error_packages_list, read_back_pkgs_json, pkgs_fn):
505-
bsp_root = Import('bsp_root')
506-
env_root = Import('env_root')
507-
508-
flag = None
509-
510-
error_packages_redownload_error_list = []
511-
512-
if len(error_packages_list):
513-
print("\n==============================> Error packages list : \n")
514-
for pkg in error_packages_list:
515-
print pkg['name'], pkg['ver']
516-
print("\nThe package in the list above is accidentally deleted.")
517-
print("Env will redownload packages that have been accidentally deleted.")
518-
print("If you really want to remove these packages, do that in the menuconfig command.\n")
519-
520-
for pkg in error_packages_list: # Redownloaded the packages in error_packages_list
521-
if install_pkg(env_root, bsp_root, pkg):
522-
print("==============================> %s %s is redownloaded successfully. \n" % (
523-
pkg['name'], pkg['ver']))
524-
else:
525-
error_packages_redownload_error_list.append(pkg)
526-
print pkg, 'download failed.'
527-
flag = False
528-
529-
if len(error_packages_redownload_error_list):
530-
print("%s" % error_packages_redownload_error_list)
531-
print ("Packages:%s,%s redownloed error,you need to use 'pkgs --update' command again to redownload them." %
532-
pkg['name'], pkg['ver'])
533-
write_back_pkgs_json = sub_list(
534-
read_back_pkgs_json, error_packages_redownload_error_list)
535-
read_back_pkgs_json = write_back_pkgs_json
536-
#print("write_back_pkgs_json:%s"%write_back_pkgs_json)
537-
pkgs_file = file(pkgs_fn, 'w')
538-
pkgs_file.write(json.dumps(write_back_pkgs_json, indent=1))
539-
pkgs_file.close()
540-
else:
541-
print("\nAll the selected packages have been downloaded successfully.\n")
542-
543-
return flag
544-
545504

546505
def package_update():
547506
"""Update env's packages.
@@ -668,7 +627,7 @@ def package_update():
668627
#print(read_back_pkgs_json)
669628

670629
error_packages_list = []
671-
630+
error_packages_redownload_error_list = []
672631
for pkg in read_back_pkgs_json:
673632
dirpath = pkg['path']
674633
ver = pkg['ver']
@@ -678,11 +637,11 @@ def package_update():
678637

679638
dirpath = os.path.basename(dirpath)
680639
removepath = os.path.join(bsp_packages_path, dirpath)
681-
#print("if floder exist : %s"%removepath)
640+
682641
git_removepath = get_pkg_folder_by_orign_path(removepath, ver)
683-
#print("if floder exist : %s"%git_removepath)
642+
#print "if floder exist",removepath
684643
removepath_ver = get_pkg_folder_by_orign_path(removepath, ver[1:])
685-
#print("if floder exist : %s"%removepath_ver)
644+
#print "if floder exist",removepath
686645

687646
if os.path.exists(removepath):
688647
continue
@@ -693,13 +652,42 @@ def package_update():
693652
else:
694653
error_packages_list.append(pkg)
695654

696-
get_flag = error_packages_handle(error_packages_list, read_back_pkgs_json, pkgs_fn)
697-
698-
if get_flag != None:
699-
flag = get_flag
700-
701-
update_latest_packages(read_back_pkgs_json, bsp_packages_path)
702-
655+
if len(error_packages_list):
656+
print("\n==============================> Error packages list : \n")
657+
for pkg in error_packages_list:
658+
print pkg['name'], pkg['ver']
659+
print("\nThe package in the list above is accidentally deleted.")
660+
print("Env will redownload packages that have been accidentally deleted.")
661+
print("If you really want to remove these packages, do that in the menuconfig command.\n")
662+
663+
for pkg in error_packages_list: # Redownloaded the packages in error_packages_list
664+
if install_pkg(env_root, bsp_root, pkg):
665+
print("==============================> %s %s is redownloaded successfully. \n" % (
666+
pkg['name'], pkg['ver']))
667+
else:
668+
error_packages_redownload_error_list.append(pkg)
669+
print pkg, 'download failed.'
670+
flag = False
671+
672+
if len(error_packages_redownload_error_list):
673+
print("%s" % error_packages_redownload_error_list)
674+
print ("Packages:%s,%s redownloed error,you need to use 'pkgs --update' command again to redownload them." %
675+
pkg['name'], pkg['ver'])
676+
write_back_pkgs_json = sub_list(
677+
read_back_pkgs_json, error_packages_redownload_error_list)
678+
read_back_pkgs_json = write_back_pkgs_json
679+
#print("write_back_pkgs_json:%s"%write_back_pkgs_json)
680+
pkgs_file = file(pkgs_fn, 'w')
681+
pkgs_file.write(json.dumps(write_back_pkgs_json, indent=1))
682+
pkgs_file.close()
683+
else:
684+
print("\nAll the selected packages have been downloaded successfully.\n")
685+
686+
try:
687+
update_latest_packages(read_back_pkgs_json, bsp_packages_path)
688+
except KeyboardInterrupt:
689+
flag = 0
690+
703691
if flag:
704692
print ("Operation completed successfully.")
705693
else:

0 commit comments

Comments
 (0)