Skip to content

fix: use CMAKE_INSTALL_SYSCONFDIR instead of hardcoded /etc path - #643

Merged
caixr23 merged 1 commit into
linuxdeepin:masterfrom
deepin-wm:agent/bot/953e094cd5a7
Oct 20, 2026
Merged

caixr23 merged 1 commit into
linuxdeepin:masterfrom
deepin-wm:agent/bot/953e094cd5a7

Conversation

@deepin-wm

@deepin-wm deepin-wm commented Oct 16, 2026 •

Copy link
Copy Markdown

Change

Replace hardcoded /etc path with ${CMAKE_INSTALL_SYSCONFDIR} in network-service-plugin/CMakeLists.txt:80.

Why

The install(FILES ... DESTINATION /etc/NetworkManager/conf.d/) rule hardcoded the absolute path /etc, which caused DESTDIR to be ignored during packaging — the file was installed to the real /etc instead of the staging directory. Using ${CMAKE_INSTALL_SYSCONFDIR} (provided by GNUInstallDirs, already included in the root CMakeLists.txt) fixes this.

Testing

  • Code review passed (100 points)
  • Package build verified: deb generated, DESTDIR correctly respected

Related Issue

Multica issue: https://agentapi-dev.uniontech.com/issues/01a14377-5e0b-7eee-9271-69623401ff1a

Summary by Sourcery

Bug Fixes:

  • Respect configurable system configuration paths when installing the NetworkManager service configuration, ensuring staged package installations honor DESTDIR.

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 守护进程配置加载无回归
@deepin-ci-robot

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@sourcery-ai

sourcery-ai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR fixes package installation staging by replacing the hardcoded /etc path with ${CMAKE_INSTALL_SYSCONFDIR} for the NetworkManager configuration file, allowing GNUInstallDirs settings and DESTDIR to be respected.

Flow diagram for configurable NetworkManager configuration installation

flowchart 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]
Loading

File-Level Changes

Change Details Files
Use CMake’s configurable system configuration directory for the NetworkManager plugin configuration installation.
  • Replace the hardcoded /etc destination with ${CMAKE_INSTALL_SYSCONFDIR}.
  • Preserve the existing NetworkManager/conf.d subdirectory and installation behavior.
  • Ensure package staging via DESTDIR and non-default sysconfdir configurations are honored.
network-service-plugin/CMakeLists.txt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@wineee
wineee marked this pull request as ready for review October 16, 2026 08:08

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread network-service-plugin/CMakeLists.txt
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 总体评分 100 分,大于 70 分通过阈值,代码质量符合要求。本次修改将 CMakeLists.txt 中硬编码的 /etc 路径替换为 ${CMAKE_INSTALL_SYSCONFDIR} 变量,修复了打包时 DESTDIR 被忽略的问题,修改正确且符合最佳实践。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 语法正确,逻辑清晰。${CMAKE_INSTALL_SYSCONFDIR} 是 GNUInstallDirs 模块提供的标准变量,该模块已在文件第12行通过 include(GNUInstallDirs) 引入,变量可用性有保障。install(FILES ... DESTINATION ...) 命令语法正确。


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 代码结构清晰,使用标准变量替代硬编码路径,与文件中第75行已使用的 ${CMAKE_INSTALL_LIBDIR} 风格一致,符合 CMake 最佳实践。


3. 代码性能 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 构建配置文件修改,无运行时性能影响。


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: 存在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 代码审查工具自动生成

@deepin-ci-robot

Copy link
Copy Markdown

[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.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-bot

deepin-bot Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 2.0.105
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #645

@caixr23
caixr23 merged commit d2ee948 into linuxdeepin:master Oct 20, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants