已合并
feat(install): 新增 --check 选项用于安装前依赖版本校验 #3439
songkai111创建于 6月18日
feat(install): 新增 --check 选项用于安装前依赖版本校验 #3439
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 songkai111 的贡献)6月18日 创建了 pull request,commit 7859f332
6月18日 添加了label:cann-cla/yes
CANN-robot
6月18日 评论:
6月18日 评论:
Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/ops-math | ✅ 王林木, wangrui_ (2/2) | ✅ 王林木 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
songkai111, thanks for your pull request. All authors of the commits have signed the CLA. 👍


songkai111
6月18日 评论:
6月18日 评论:
compile


Ssongkai111
6月18日 update merge request[project id: 7649531, iid: 3439, commit_id: 420e13d8f2cd77c1376f7081baa4f5f24a6fd739] virtual merging success
6月18日 update merge request[project id: 7649531, iid: 3439, commit_id: 420e13d8f2cd77c1376f7081baa4f5f24a6fd739] virtual merging success
6月18日 添加了label:ci-pipeline-running
CANN-robot
6月18日 评论:
6月18日 评论:
流水线任务触发成功
任务链接 [8559b9a0431447a0bdf3c9987edf20ab][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_single | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_A5 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A5 | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_A5_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_harmony-infer | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_single_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A5_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test | ✅ SUCCESS | ||
| UT_Test_experimental | ✅ SUCCESS | ||
| UT_Test_kernel | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> |
[2026-06-18 16:24:59] CI执行结束


CANN-robot
6月18日 评论:
6月18日 评论:
流水线任务触发成功
任务链接 [449e199f83f0481794a5ba006a9b71dc][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_Pr | ✅ SUCCESS | ||
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_codestyle | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ✅ SUCCESS | >>>>> | >>>>> |
[2026-06-18 16:17:36] CI执行结束


6月18日 添加了label:api-check-pass
6月18日 删除了label:ci-pipeline-running
6月18日 添加了label:ci-pipeline-passed
Ssongkai111
6月18日 修改标题为 “feat(install): 新增 --check 选项用于安装前依赖版本校验”,原标题为“feat(install): 新增 --check 选项用于依赖版本校验”
6月18日 修改标题为 “feat(install): 新增 --check 选项用于安装前依赖版本校验”,原标题为“feat(install): 新增 --check 选项用于依赖版本校验”
6月18日 修改了pull request 的描述
6月18日 添加了label:approved
6月18日 添加了label:lgtm
6月18日 关闭了关联的issue
6月18日 合入了pull request
描述
本 PR 为
install.sh新增--check命令行选项,用于在安装前校验依赖组件的版本是否满足version.info中声明的要求,无需执行完整安装流程即可完成依赖检查。改动原因
安装前缺少独立的依赖校验入口,用户难以在不触发完整安装/升级/卸载流程的情况下,快速确认当前环境中各依赖组件(如其他 Ascend 组件)的版本是否满足本包
version.info的要求。改动方法
get_opts()中新增--check参数解析,设置IS_CHECK="y"并计入CONFLICT_CMD_NUMS,使其与--full/--upgrade/--uninstall互斥(每次仅允许一种操作类型)。get_opts()与check_opts()中的错误提示文案:only support one type: full/upgrade/uninstall→only support one type: full/upgrade/uninstall/check。check_dependencies()函数:${VERSION_INFO_FILE}(即../version.info)中以required_package_开头的行,解析出组件名component(取required_package_<component>_version=中的<component>)和要求版本req_version(=后的值,去除双引号)。${ASCEND_HOME_PATH:-${TARGET_VERSION_DIR}}/share/info/${component}/version.info文件,读取其中的Version=字段作为实际版本actual_version。>=版本操作符:从req_version中拆分出操作符(op)与版本号(ver),通过sort -V比较实际版本与要求版本。main()的init_env之后增加判断:若IS_CHECK="y",则调用check_dependencies "${VERSION_INFO_FILE}"并以返回码退出(成功退出 0,失败退出 1)。关联的Issue
测试
构造包含
required_package_<component>_version=">=x.y.z"的version.info及对应组件的version.info(含Version=字段),分别验证:>=要求时,输出 "All dependency checks passed." 且退出码为 0。--check与--full/--upgrade/--uninstall同时传入时,提示 "only support one type" 并退出。文档更新
无文档更新。
类型标签