Pull Request已成功合入, 合并人@CANN-robot
(感谢 LambdaMiX 的贡献)变更摘要
此 PR 修复了 install_deps.sh 脚本中 install_pigz() 函数的两个问题:一是交互提示 [Y/n] 暗示 Y 为默认选项,但用户按 Enter(空输入)时实际走了跳过安装分支,导致行为与用户预期不符;二是 pigz 被跳过安装后,脚本末尾仍无条件打印 "All dependencies installed successfully!",在自动化流程中会造成误判。修复通过调整空输入判断逻辑和引入 PIGZ_SKIPPED 状态变量,使默认行为与提示符一致,并在最终消息中准确反映安装状态。
主要改动
- 修正
install_pigz()中的空输入判断逻辑:将if [[ ! $REPLY =~ ^[Yy]$ ]]改为if [[ -n "$REPLY" && ! $REPLY =~ ^[Yy]$ ]],使得用户按 Enter(空输入)时不再被当作跳过安装,而是执行 pigz 安装,与[Y/n]提示符的默认语义一致。 - 引入
PIGZ_SKIPPED全局状态变量:在脚本开头初始化PIGZ_SKIPPED=false,当install_pigz()跳过安装时将其设为true,用于追踪 pigz 是否被跳过。 - 区分脚本末尾的成功消息:在
main()函数末尾根据PIGZ_SKIPPED的值输出不同的提示——若 pigz 被跳过则输出 "All mandatory dependencies installed successfully! (pigz skipped, run 'sudo apt install pigz' to install manually)",否则输出原始的 "All dependencies installed successfully!"。


代码审查
审查完成
变更文件审查结果
- install_deps.sh:发现 1 个问题(P2)
发现汇总
| 优先级 | 数量 |
|---|---|
| P0 | 0 |
| P1 | 0 |
| P2 | 1 |
| P3 | 0 |
整体风险评估:低风险。 本次变更正确修复了 install_pigz() 中 [Y/n] 提示与默认行为不一致的问题(空输入现在默认为 Yes),并通过 PIGZ_SKIPPED 变量使脚本末尾的成功消息与实际状态保持一致。唯一的缺陷是 pigz 跳过提示消息中硬编码了 sudo apt install pigz,在非 Debian 系统(RHEL/Euler/macOS)上会给出错误的包管理器命令,误导用户。建议使用脚本已有的 $OS / $PKG_MANAGER 变量动态生成该提示。
| 类型 | 数量 |
|---|---|
| 🔴 阻塞 | 0 |
| 🟡 建议 | 1 |
💬 仅评论


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-blas | ✅ 宋恺, xutianze (2/2) | ✅ 宋恺, xutianze (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
LambdaMiX, thanks for your pull request. All authors of the commits have signed the CLA. 👍


CLA Signature Guide
@LambdaMiX , thanks for your pull request.
The following commit(s) have not signed Contributor License Agreement (CLA).
| Commit | Reason |
|---|---|
| 4099fed8 fix:调整 PIGZ_SKIPPED 初始�... | the email is not signed for CLA! please check if it is correct and the same as your signed email. |
| af676195 fix: 修正 install_deps.sh 中 ... | the email used in the commit is platform default email: ***@noreply.gitcode.com! 使用了Gitcode平台系统默认邮箱,需要在平台个人设置里绑定个人邮箱. |
If you need to sign CLA, you can click here to sign the CLA.
If you need to check if the email is set up correctly, you can click here to do it in the FAQs.
After signing the CLA or updating the email, you must comment /check-cla to check the CLA status again.


🟡 Medium Priority
变更行:第 628 行(新增行)
install_deps.sh 通过 detect_os() 支持多种操作系统:debian (apt)、rhel (dnf/yum)、euler (dnf)、macOS (brew)。install_pigz() 函数内部正确使用变量 $PKG_MANAGER 来适配不同系统的包管理器。
但第 628 行新增的 pigz 跳过提示消息中,硬编码了 'sudo apt install pigz'。在 RHEL/Euler 系统上用户应使用 sudo dnf install pigz(或 sudo yum install pigz),在 macOS 上应使用 brew install pigz。当前消息会误导非 Debian 用户执行错误的安装命令。
触发条件:用户在非 Debian 系统(RHEL/Euler/macOS)上运行脚本并选择跳过 pigz 安装时。
失败模式:用户看到错误的安装命令提示,可能执行失败或产生困惑,尤其在自动化流程中会传递不准确的信息。
建议:使用 $OS / $PKG_MANAGER 变量动态生成提示命令,与 install_pigz() 中的安装逻辑保持一致。debian/rhel/euler 使用 sudo $PKG_MANAGER install pigz;macOS 使用 brew install pigz(不加 sudo)。


changed this line on 6177bee1 view diff detail
流水线任务触发成功
任务链接 [ddbc4de89be445d29a0b02b1eff7443a][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86_A2 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_A5 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A2 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A5 | ✅ SUCCESS | >>>>> | >>>>> |
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_A2_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_A5_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A2_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A5_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| codecheck_codestyle | ✅ SUCCESS | >>>>> | |
| precommit | ✅ SUCCESS | >>>>> | |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> |
[2026-07-23 12:21:11] CI执行结束


/approve


流水线任务触发成功
任务链接 [757579bd0f804fe39ca1123efd820c35][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86_A2 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_A5 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A2 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A5 | ✅ SUCCESS | >>>>> | >>>>> |
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_A2_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_A5_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A2_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A5_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| codecheck_codestyle | ✅ SUCCESS | >>>>> | |
| precommit | ✅ SUCCESS | >>>>> | |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> |
[2026-07-24 14:38:15] CI执行结束


/approve


/approve


描述
问题描述
install_deps.sh 脚本存在两个问题:
pigz 安装提示与默认行为不一致:
install_pigz()函数中read -p "Install pigz? [Y/n]"提示符[Y/n]暗示 Y 为默认选项,但用户按 Enter(空输入)时实际走"跳过安装"分支,导致用户以为选择了 Yes 却跳过了 pigz 安装。成功消息误报:pigz 被跳过后,脚本末尾仍无条件打印 "All dependencies installed successfully!",与实际状态不一致,在自动化流程中会造成误判。
修改内容
1.修正
install_pigz()中read交互逻辑:空输入视为 Yes(符合[Y/n]惯例)2.新增
PIGZ_SKIPPED变量追踪 pigz 跳过状态main()末尾根据PIGZ_SKIPPED输出不同消息:跳过时提示用户手动安装命令(pigz skipped, run 'sudo apt install pigz' to install manually),而非声称全部安装成功关联的Issue
issue #327
测试
bash install_deps.sh,pigz 未安装时按 Enter,确认 pigz 被安装(而非跳过)n,确认 pigz 被跳过,且末尾输出提示用户手动安装的消息:"All mandatory dependencies installed successfully! (pigz skipped, run 'sudo apt install pigz' to install manually)"echo "n" | bash install_deps.sh,确认脚本正常完成且输出消息准确文档更新
无
类型标签