Repository navigation
fix: use CMAKE_INSTALL_SYSCONFDIR instead of hardcoded /etc path - #643
Conversation
1. Replace hardcoded /etc with ${CMAKE_INSTALL_SYSCONFDIR} in install rule
2. Ensure DESTDIR is respected during packaging
3. CMAKE_INSTALL_SYSCONFDIR is provided by GNUInstallDirs already included
Influence:
1. Verify package installs conf file under DESTDIR/etc/NetworkManager/conf.d/
2. Confirm no regression in NetworkManager daemon configuration loading
fix: 使用 CMAKE_INSTALL_SYSCONFDIR 替换 NM 配置路径
1. 将 install 规则中硬编码的 /etc 替换为 ${CMAKE_INSTALL_SYSCONFDIR}
2. 确保打包时 DESTDIR 正确生效
3. CMAKE_INSTALL_SYSCONFDIR 已由已包含的 GNUInstallDirs 提供
Influence:
1. 验证打包后配置文件安装到 DESTDIR/etc/NetworkManager/conf.d/ 下
2. 确认 NetworkManager 守护进程配置加载无回归
|
Skipping CI for Draft Pull Request. |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe PR fixes package installation staging by replacing the hardcoded Flow diagram for configurable NetworkManager configuration installationflowchart LR
CMakeInstall[CMake install rule] --> SysconfDir[CMAKE_INSTALL_SYSCONFDIR]
SysconfDir --> Staging[DESTDIR staging directory]
Staging --> Config[deepin.dde.daemon.conf]
Config --> NetworkManager[NetworkManager conf.d]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="network-service-plugin/CMakeLists.txt" line_range="80" />
<code_context>
endif()
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/system/deepin.dde.daemon.conf DESTINATION /etc/NetworkManager/conf.d/)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/system/deepin.dde.daemon.conf DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/NetworkManager/conf.d/)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/system/org.deepin.dde.Network1.conf DESTINATION share/dbus-1/system.d/)
install(FILES ${CMAKE_SOURCE_DIR}/src/misc/polkit-action/com.deepin.dde.network.policy DESTINATION share/polkit-1/actions)
</code_context>
<issue_to_address>
**NetworkManager drop-in is ignored**
When the project uses its default `/usr` prefix without setting `CMAKE_INSTALL_SYSCONFDIR` to an absolute system configuration path, `CMAKE_INSTALL_SYSCONFDIR` remains the relative path `etc`, so this install rule places the file under `/usr/etc/NetworkManager/conf.d/`. NetworkManager does not load it and the package manifest cannot find the expected `/etc` file, leaving the daemon setting unapplied.
Install the file under `/etc/NetworkManager/conf.d/` or ensure `CMAKE_INSTALL_SYSCONFDIR` is set to `/etc`.
</issue_to_address>
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 语法正确,逻辑清晰。${CMAKE_INSTALL_SYSCONFDIR} 是 GNUInstallDirs 模块提供的标准变量,该模块已在文件第12行通过 include(GNUInstallDirs) 引入,变量可用性有保障。install(FILES ... DESTINATION ...) 命令语法正确。 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 代码结构清晰,使用标准变量替代硬编码路径,与文件中第75行已使用的 ${CMAKE_INSTALL_LIBDIR} 风格一致,符合 CMake 最佳实践。 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 构建配置文件修改,无运行时性能影响。 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: 存在0个安全漏洞。使用 ${CMAKE_INSTALL_SYSCONFDIR} 替代硬编码 /etc 路径,使打包过程正确尊重 DESTDIR 环境变量,避免了文件在打包阶段被安装到真实系统目录的安全风险。 💡 改进建议代码示例# 修改前(硬编码绝对路径,DESTDIR 被忽略):
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/system/deepin.dde.daemon.conf DESTINATION /etc/NetworkManager/conf.d/)
# 修改后(使用 GNUInstallDirs 变量,正确尊重 DESTDIR):
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/system/deepin.dde.daemon.conf DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/NetworkManager/conf.d/)本报告由 AI 代码审查工具自动生成 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: caixr23, deepin-wm The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
TAG Bot New tag: 2.0.105 |
Change
Replace hardcoded
/etcpath with${CMAKE_INSTALL_SYSCONFDIR}innetwork-service-plugin/CMakeLists.txt:80.Why
The
install(FILES ... DESTINATION /etc/NetworkManager/conf.d/)rule hardcoded the absolute path/etc, which causedDESTDIRto be ignored during packaging — the file was installed to the real/etcinstead of the staging directory. Using${CMAKE_INSTALL_SYSCONFDIR}(provided byGNUInstallDirs, already included in the rootCMakeLists.txt) fixes this.Testing
Related Issue
Multica issue: https://agentapi-dev.uniontech.com/issues/01a14377-5e0b-7eee-9271-69623401ff1a
Summary by Sourcery
Bug Fixes: