已合并
回退--check功能 #6131
chenbinbin199309创建于 6月16日
回退--check功能 #6131
已合并
从已删除 :cherry-pick-mr-6080-1781577469921-auto合入到cann/ops-nn9.1.0
共 1 个文件变更+2-82
| @@ -325,7 +325,7 @@ get_opts() { | |||
| 325 | 325 | ||
| 326 | if [ "$*" = "" ]; then | 326 | if [ "$*" = "" ]; then |
| 327 | echo "[OpsNN] [ERROR]: ERR_NO:${PARAM_INVALID};ERR_DES:\ | 327 | echo "[OpsNN] [ERROR]: ERR_NO:${PARAM_INVALID};ERR_DES:\ |
| 328 | - only support one type: full/upgrade/uninstall/check, operation execute failed!\ | 328 | + only support one type: full/upgrade/uninstall, operation execute failed!\ |
| 329 | Please use [--help] to see the usage." | 329 | Please use [--help] to see the usage." |
| 330 | exitlog | 330 | exitlog |
| 331 | exit 1 | 331 | exit 1 |
| @@ -350,11 +350,6 @@ get_opts() { | |||
| 350 | CONFLICT_CMD_NUMS=$(expr $CONFLICT_CMD_NUMS + 1) | 350 | CONFLICT_CMD_NUMS=$(expr $CONFLICT_CMD_NUMS + 1) |
| 351 | shift | 351 | shift |
| 352 | ;; | 352 | ;; |
| 353 | - --check) | ||
| 354 | - IS_CHECK="y" | ||
| 355 | - CONFLICT_CMD_NUMS=$(expr $CONFLICT_CMD_NUMS + 1) | ||
| 356 | - shift | ||
| 357 | - ;; | ||
| 358 | --install-path=*) | 353 | --install-path=*) |
| 359 | IS_INPUT_PATH="y" | 354 | IS_INPUT_PATH="y" |
| 360 | IN_INSTALL_PATH=$(echo ${1} | cut -d"=" -f2-) | 355 | IN_INSTALL_PATH=$(echo ${1} | cut -d"=" -f2-) |
| @@ -394,7 +389,7 @@ check_opts() { | |||
| 394 | 389 | ||
| 395 | if [ "${CONFLICT_CMD_NUMS}" != 1 ]; then | 390 | if [ "${CONFLICT_CMD_NUMS}" != 1 ]; then |
| 396 | echo "[OpsNN] [ERROR]: ERR_NO:${PARAM_INVALID};ERR_DES:\ | 391 | echo "[OpsNN] [ERROR]: ERR_NO:${PARAM_INVALID};ERR_DES:\ |
| 397 | - only support one type: full/upgrade/uninstall/check, operation execute failed!\ | 392 | + only support one type: full/upgrade/uninstall, operation execute failed!\ |
| 398 | Please use [--help] to see the usage." | 393 | Please use [--help] to see the usage." |
| 399 | exitlog | 394 | exitlog |
| 400 | exit 1 | 395 | exit 1 |
| @@ -656,74 +651,6 @@ pre_check_only() { | |||
| 656 | fi | 651 | fi |
| 657 | } | 652 | } |
| 658 | 653 | ||
| 659 | -check_dependencies() { | ||
| 660 | - local version_info_file="$1" | ||
| 661 | - local failed=0 | ||
| 662 | - | ||
| 663 | - logandprint "[INFO]: Start checking dependencies from ${version_info_file}" | ||
| 664 | - | ||
| 665 | - if [ ! -f "${version_info_file}" ]; then | ||
| 666 | - logandprint "[ERROR]: version.info not found at ${version_info_file}" | ||
| 667 | - return 1 | ||
| 668 | - fi | ||
| 669 | - | ||
| 670 | - local dep_lines | ||
| 671 | - dep_lines=$(grep "^required_package_" "${version_info_file}") | ||
| 672 | - | ||
| 673 | - if [ -z "${dep_lines}" ]; then | ||
| 674 | - logandprint "[INFO]: All dependency checks passed." | ||
| 675 | - return 0 | ||
| 676 | - fi | ||
| 677 | - | ||
| 678 | - while IFS= read -r line; do | ||
| 679 | - local component=$(echo "${line}" | sed -n 's/^required_package_\(.*\)_version=.*/\1/p') | ||
| 680 | - local req_version=$(echo "${line}" | cut -d= -f2- | tr -d '"') | ||
| 681 | - | ||
| 682 | - if [ -z "${component}" ] || [ -z "${req_version}" ]; then | ||
| 683 | - continue | ||
| 684 | - fi | ||
| 685 | - | ||
| 686 | - local ascend_home="${ASCEND_HOME_PATH:-${TARGET_VERSION_DIR}}" | ||
| 687 | - local info_file="${ascend_home}/share/info/${component}/version.info" | ||
| 688 | - if [ ! -f "${info_file}" ]; then | ||
| 689 | - logandprint "[ERROR]: ${component} version.info not found at ${info_file}" | ||
| 690 | - failed=1 | ||
| 691 | - continue | ||
| 692 | - fi | ||
| 693 | - | ||
| 694 | - local actual_version=$(grep "^Version=" "${info_file}" | cut -d= -f2-) | ||
| 695 | - | ||
| 696 | - if [ -z "${actual_version}" ]; then | ||
| 697 | - logandprint "[ERROR]: Failed to get version of ${component} from ${info_file}" | ||
| 698 | - failed=1 | ||
| 699 | - continue | ||
| 700 | - fi | ||
| 701 | - | ||
| 702 | - local op=$(echo "${req_version}" | sed 's/[0-9].*//') | ||
| 703 | - local ver=$(echo "${req_version}" | sed 's/^[^0-9]*//') | ||
| 704 | - | ||
| 705 | - if [ "${op}" = ">=" ]; then | ||
| 706 | - local first=$(printf '%s\n%s\n' "${actual_version}" "${ver}" | sort -V | head -n 1) | ||
| 707 | - | ||
| 708 | - if [ "$first" = "${ver}" ]; then | ||
| 709 | - logandprint "[INFO]: ${component} version ${actual_version} satisfies requirement ${req_version}" | ||
| 710 | - else | ||
| 711 | - logandprint "[ERROR]: ${component} version ${actual_version} does not satisfy requirement ${req_version}" | ||
| 712 | - failed=1 | ||
| 713 | - fi | ||
| 714 | - else | ||
| 715 | - logandprint "[ERROR]: Unsupported version operator '${op}' for ${component}, skipping" | ||
| 716 | - fi | ||
| 717 | - done <<< "${dep_lines}" | ||
| 718 | - | ||
| 719 | - if [ "${failed}" -eq 0 ]; then | ||
| 720 | - logandprint "[INFO]: All dependency checks passed." | ||
| 721 | - else | ||
| 722 | - logandprint "[ERROR]: Some dependency checks failed." | ||
| 723 | - fi | ||
| 724 | - return ${failed} | ||
| 725 | -} | ||
| 726 | - | ||
| 727 | main() { | 654 | main() { |
| 728 | 655 | ||
| 729 | get_run_path "$@" | 656 | get_run_path "$@" |
| @@ -736,13 +663,6 @@ main() { | |||
| 736 | 663 | ||
| 737 | init_env | 664 | init_env |
| 738 | 665 | ||
| 739 | - if [ "${IS_CHECK}" = "y" ]; then | ||
| 740 | - check_dependencies "${VERSION_INFO_FILE}" | ||
| 741 | - local check_ret=$? | ||
| 742 | - exitlog | ||
| 743 | - exit ${check_ret} | ||
| 744 | - fi | ||
| 745 | - | ||
| 746 | check_pre_install | 666 | check_pre_install |
| 747 | 667 | ||
| 748 | mkdir_install_path | 668 | mkdir_install_path |