Skip to content

feat: add Debian trigger integration for config updates#110

Closed
18202781743 wants to merge 1 commit intolinuxdeepin:masterfrom
18202781743:trigger
Closed

feat: add Debian trigger integration for config updates#110
18202781743 wants to merge 1 commit intolinuxdeepin:masterfrom
18202781743:trigger

Conversation

@18202781743
Copy link
Contributor

@18202781743 18202781743 commented Jun 20, 2025

  1. Added dconfig-trigger-handler script to process configuration file changes via D-Bus
  2. Implemented Debian trigger system to monitor config directories (/ usr/share/dsg/configs, /etc/dsg/configs, /var/lib/linglong entries)
  3. Created postinst script to handle trigger activation and timestamp management
  4. Added documentation explaining the trigger integration process and usage
  5. Updated CMakeLists and install files to deploy the trigger handler
  6. The changes enable automatic configuration updates when package installations modify config files

feat: 添加 Debian 触发器集成以支持配置自动更新

  1. 新增 dconfig-trigger-handler 脚本通过 D-Bus 处理配置文件变更
  2. 实现 Debian 触发器系统监控配置目录(/usr/share/dsg/configs, /etc/dsg/ configs, /var/lib/linglong 条目)
  3. 创建 postinst 脚本处理触发器激活和时间戳管理
  4. 添加文档说明触发器集成流程和使用方法
  5. 更新 CMakeLists 和安装文件以部署触发器处理程序
  6. 这些变更使得在包安装修改配置文件时能够自动更新配置

Summary by Sourcery

Integrate Debian trigger support for dconfig by adding a handler script, packaging hooks, and documentation to enable automatic configuration updates

New Features:

  • Integrate a Debian triggers system to automatically handle configuration file updates when packages modify config files
  • Add a dconfig-trigger-handler script to process configuration changes via D-Bus

Build:

  • Update CMakeLists and install files to deploy the trigger handler script

Deployment:

  • Add Debian postinst script and triggers file to manage trigger activation and timestamp updates

Documentation:

  • Document the trigger integration process and usage

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743

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

@github-actions
Copy link

  • 检测到debian目录文件有变更: debian/dde-dconfig-daemon.postinst,debian/dde-dconfig-daemon.triggers,debian/dde-dconfig-daemon.install

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @18202781743 - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

1. Added dconfig-trigger-handler script to process configuration file changes via D-Bus
2. Implemented Debian trigger system to monitor config directories (/ usr/share/dsg/configs, /etc/dsg/configs, /var/lib/linglong entries)
3. Created postinst script to handle trigger activation and timestamp management
4. Added documentation explaining the trigger integration process and usage
5. Updated CMakeLists and install files to deploy the trigger handler
6. The changes enable automatic configuration updates when package installations modify config files

feat: 添加 Debian 触发器集成以支持配置自动更新

1. 新增 dconfig-trigger-handler 脚本通过 D-Bus 处理配置文件变更
2. 实现 Debian 触发器系统监控配置目录(/usr/share/dsg/configs, /etc/dsg/ configs, /var/lib/linglong 条目)
3. 创建 postinst 脚本处理触发器激活和时间戳管理
4. 添加文档说明触发器集成流程和使用方法
5. 更新 CMakeLists 和安装文件以部署触发器处理程序
6. 这些变更使得在包安装修改配置文件时能够自动更新配置
@sourcery-ai
Copy link

sourcery-ai bot commented Jun 20, 2025

Reviewer's Guide

This PR integrates a Debian-triggered, D-Bus-based configuration update mechanism by introducing a handler script, defining package triggers and post-install hooks, updating the build/install pipeline, and providing documentation for the new workflow.

Sequence diagram for Debian trigger-based config update process

sequenceDiagram
    participant DebianPkg as Debian Package System
    participant Trigger as dconfig-trigger-handler
    participant DConfigDaemon as dde-dconfig-daemon (D-Bus)
    participant ConfigDirs as Config Directories

    DebianPkg->>ConfigDirs: Install/modify config files
    ConfigDirs-->>DebianPkg: Triggers activated (via .triggers)
    DebianPkg->>Trigger: Run dconfig-trigger-handler (via postinst)
    Trigger->>DConfigDaemon: Notify config change via D-Bus
    DConfigDaemon->>DConfigDaemon: Reload/Update configuration
Loading

File-Level Changes

Change Details Files
Introduce a D-Bus trigger‐handler script
  • Added new dconfig-trigger-handler script to process config changes over D-Bus
dconfig-center/dde-dconfig-daemon/scripts/dconfig-trigger-handler
Set up Debian triggers and postinst hook
  • Created .triggers file to watch config directories
  • Implemented postinst script for trigger activation and timestamp management
debian/dde-dconfig-daemon.triggers
debian/dde-dconfig-daemon.postinst
Update build/install files to deploy handler
  • Added install rule in CMakeLists to include the handler
  • Updated debian install manifest to package the script
dconfig-center/dde-dconfig-daemon/CMakeLists.txt
debian/dde-dconfig-daemon.install
Add documentation for trigger integration
  • Authored docs explaining trigger workflow and usage
docs/trigger-integration.md

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

@github-actions
Copy link

  • 检测到debian目录文件有变更: debian/dde-dconfig-daemon.postinst,debian/dde-dconfig-daemon.triggers,debian/dde-dconfig-daemon.install

@deepin-ci-robot
Copy link

deepin pr auto review

代码审查意见:

  1. 脚本错误处理:在call_dbus_update函数中,如果dbus-send命令失败,应该记录错误并退出脚本,而不是继续执行。建议在main函数中添加错误处理逻辑,以确保在调用call_dbus_update失败时,脚本能够正确退出。

  2. 日志记录log_infolog_error函数中使用了logger命令,但是没有处理logger命令可能返回的错误。建议添加错误处理逻辑,以确保日志记录的可靠性。

  3. 配置目录硬编码CONFIG_DIRS数组中的配置目录是硬编码的,这可能会导致维护困难。建议将这些配置目录作为参数传递给脚本,或者从配置文件中读取。

  4. 文件权限:新创建的脚本dconfig-trigger-handler的权限设置为100755,这允许任何用户执行该脚本。建议根据最小权限原则,将脚本权限设置为0755,只允许脚本所有者和所属组执行。

  5. 错误信息:在log_error函数中,错误信息被输出到标准错误流,但没有提供足够的上下文信息。建议在错误信息中包含更多的上下文信息,以便更容易地诊断问题。

  6. 脚本参数检查:在main函数中,没有检查传递给脚本的参数。建议添加参数检查逻辑,以确保脚本能够正确处理传递的参数。

  7. 依赖项检查:在main函数中,脚本依赖于dbus-send命令。建议在脚本开始时检查dbus-send命令是否存在,并记录错误信息,如果命令不存在,则退出脚本。

  8. 脚本退出状态:在main函数中,脚本在处理完所有触发路径后,应该返回一个适当的退出状态码。建议在main函数的最后添加exit 0,以确保脚本在成功执行时返回0。

  9. 代码重复:在process_newer_files_in_directory函数中,ensure_timestamp_dir函数被调用了两次。建议将ensure_timestamp_dir函数的调用移动到process_newer_files_in_directory函数的开始部分,以避免代码重复。

  10. 代码风格:脚本中的代码风格不一致,例如,log_infolog_error函数中的日志消息没有统一的格式。建议统一日志消息的格式,以提高代码的可读性。

  11. 注释:脚本中的注释应该更加详细,以便其他开发者能够更容易地理解代码的功能和目的。

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.

3 participants