Skip to content

build(debian): separate Qt5/Qt6 build configurations for V25/V20 support#116

Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
re2zero:bugfix
Jan 27, 2026
Merged

build(debian): separate Qt5/Qt6 build configurations for V25/V20 support#116
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
re2zero:bugfix

Conversation

@re2zero
Copy link
Contributor

@re2zero re2zero commented Jan 26, 2026

Split debian/control into version-specific files to support both Qt6 (V25) and Qt5 (V20) builds. CMake already handles dynamic Qt/DTK detection.

将debian/control拆分为版本特定文件,支持Qt6(V25)和Qt5(V20)双版本构建。 CMake已处理动态Qt/DTK版本检测。

Log: 分离Qt5/Qt6构建配置,支持V25/V20双版本
Influence: 可在不同deepin版本上使用对应Qt版本构建,提升包管理兼容性。

Summary by Sourcery

Add dual Qt5/Qt6 build and packaging support for deepin-downloader and update related metadata.

New Features:

  • Support building the downloader executable with either Qt5 or Qt6 via version-aware moc generation.

Enhancements:

  • Correct the downloader accessiblewidget header path in the CMake configuration.
  • Adjust translation generation CMake script to be Qt major version–aware for lupdate usage.
  • Update README to document supported Qt5/Qt6 and DTK dependencies for build and runtime.

Build:

  • Introduce a Debian control variant (control.1) with explicit Qt5 and DTK build dependencies for version-specific packaging.

@sourcery-ai
Copy link

sourcery-ai bot commented Jan 26, 2026

Reviewer's Guide

This PR introduces dual Qt5/Qt6 build support (aligned with Deepin V20/V25) by splitting Debian packaging control files, updating CMake to choose the correct Qt moc/lupdate tooling dynamically, and refreshing documentation and dependency declarations accordingly.

File-Level Changes

Change Details Files
Make downloader executable compatible with both Qt5 and Qt6 by generating and linking moc files conditionally on the detected Qt version.
  • Fix the include path typo for accessiblewidget.h under the downloader headers directory.
  • Introduce a conditional that uses qt_wrap_cpp for Qt6 and qt5_wrap_cpp for Qt5 to generate moc sources from DWM_EXTENSIONSERVICE_HEADERS.
  • Add the generated moc source variable to the downloader add_executable target so the moc code is compiled and linked.
src/src/downloader/CMakeLists.txt
Update translation generation CMake helper to be Qt major-version agnostic in its lupdate invocation.
  • Adjust the commented example lupdate command to reference Qt${QT_VERSION_MAJOR}_LUPDATE_EXECUTABLE instead of the hardcoded Qt5_LUPDATE_EXECUTABLE, aligning with dynamic Qt detection.
cmake/translation-generate.cmake
Refresh build/runtime documentation to reflect support for both Qt5 and Qt6 and required DTK components.
  • Tighten the documented CMake minimum version and explicitly document supported Qt versions (Qt5 >= 5.11.0 or Qt6 >= 6.0.0) for both build and runtime.
  • Document DTK as a runtime dependency, listing required modules for both Qt5 (DtkWidget, DtkCore, DtkGui) and Qt6 (Dtk6Widget, Dtk6Core, Dtk6Gui).
README.md
Introduce a dedicated Debian control file for the Qt5-based build, separating packaging configuration for different Deepin/Qt versions.
  • Replace the monolithic debian/control with a new debian/control.1 file that defines source package metadata and binary packages for the main application and its libraries.
  • Declare Qt5-specific build dependencies (qtbase5-dev, qttools5-dev-tools, qttools5-dev, libqt5svg5-dev, libqt5webchannel5-dev, libqt5websockets5-dev, libdtkwidget-dev, libdtkgui-dev, libdtkcore-dev) and other required libraries and tools (gtest/gmock, sqlite3, aria2, curl, etc.).
  • Preserve Conflicts/Replaces relationships for the library packages against older org.deepin.downloader versions to maintain upgrade safety.
debian/control
debian/control.1

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

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 - I've left some high level feedback:

  • The new Qt MOC handling in src/downloader/CMakeLists.txt mixes qt_wrap_cpp/qt5_wrap_cpp, which are deprecated/Qt5-style macros; consider using CMake AUTOMOC or the modern Qt6 qt_add_executable/qt_add_library approach so the same CMake logic works cleanly for both Qt5 and Qt6.
  • Renaming debian/control to debian/control.1 will break standard Debian tooling that expects debian/control; if this split is for V20/V25 variants, it would be better to keep a canonical debian/control and generate/switch the version-specific control files via a script or packaging branch instead of committing .1 directly.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new Qt MOC handling in `src/downloader/CMakeLists.txt` mixes `qt_wrap_cpp`/`qt5_wrap_cpp`, which are deprecated/Qt5-style macros; consider using CMake `AUTOMOC` or the modern Qt6 `qt_add_executable`/`qt_add_library` approach so the same CMake logic works cleanly for both Qt5 and Qt6.
- Renaming `debian/control` to `debian/control.1` will break standard Debian tooling that expects `debian/control`; if this split is for V20/V25 variants, it would be better to keep a canonical `debian/control` and generate/switch the version-specific control files via a script or packaging branch instead of committing `.1` directly.

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.

Split debian/control into version-specific files to support both Qt6 (V25)
and Qt5 (V20) builds. CMake already handles dynamic Qt/DTK detection.

将debian/control拆分为版本特定文件,支持Qt6(V25)和Qt5(V20)双版本构建。
CMake已处理动态Qt/DTK版本检测。

Log: 分离Qt5/Qt6构建配置,支持V25/V20双版本
Influence: 可在不同deepin版本上使用对应Qt版本构建,提升包管理兼容性。
PMS: https://pms.uniontech.com/task-view-386321.html
@deepin-ci-robot
Copy link
Contributor

deepin pr auto review

这份代码变更主要是将项目从 Qt5 迁移到 Qt6(或者使其兼容 Qt5 和 Qt6),同时更新了构建依赖和打包配置。以下是对语法逻辑、代码质量、代码性能和代码安全方面的详细审查意见:

1. 语法逻辑与代码逻辑

问题点 1:拼写错误修正

  • 位置: src/src/downloader/CMakeLists.txt
  • 代码: ${PROJECT_SOURCE_DIR}/src/include/downlaoder/accessiblewidget.h -> ${PROJECT_SOURCE_DIR}/src/include/downloader/accessiblewidget.h
  • 审查意见: 正确。原路径中 downlaoder 是拼写错误,修改为 downloader 是必要的,否则会导致编译时找不到头文件。

问题点 2:Qt 版本兼容性处理

  • 位置: src/src/downloader/CMakeLists.txtcmake/translation-generate.cmake
  • 代码:
    if (QT_VERSION VERSION_GREATER_EQUAL "6.0")
        qt_wrap_cpp (...)
    else()
        qt5_wrap_cpp (...)
    endif()
  • 审查意见: 逻辑正确。使用 QT_VERSION 变量进行判断,并根据版本调用对应的 CMake 命令(qt_wrap_cpp vs qt5_wrap_cpp),这是处理跨版本构建的标准做法。

问题点 3:MOC 文件生成与链接

  • 位置: src/src/downloader/CMakeLists.txt
  • 代码:
    add_executable(downloader main.cpp
        accessiblewidget.cpp
        ${DWM_EXTENSIONSERVICE_HEADERS_MOC}
    )
  • 审查意见: 逻辑正确。显式地将生成的 MOC 文件(${DWM_EXTENSIONSERVICE_HEADERS_MOC})添加到可执行文件的源列表中,确保 Qt 的元对象系统正确工作。

2. 代码质量与构建配置

问题点 1:Debian 依赖管理

  • 位置: debian/controldebian/control.1
  • 代码:
    • debian/control 中移除了 | (或) 选项,强制依赖 qt6-...
    • 新增了 debian/control.1,保留了 Qt5 的依赖配置。
  • 审查意见: 存在风险,建议改进
    • debian/control 中完全移除 Qt5 支持而转向 Qt6 是一个重大的破坏性变更。如果这是项目的主分支且确定全面迁移 Qt6,则可以接受。
    • debian/control.1 的出现令人困惑。通常不应该在版本控制中保留名为 .1 的备份文件。如果这是为了支持 Qt5 的发行版(如 Debian stable),应该使用不同的分支或构建逻辑,而不是在同一个目录下放置两个 control 文件。这容易导致打包时的混淆。
    • 建议: 确认项目是否完全放弃 Qt5。如果是,删除 control.1。如果不是,应恢复 control 中的 | 选项,或者使用 CMake 变量动态生成 debian/control 文件,以区分 Qt5 和 Qt6 的构建包。

问题点 2:README.md 的依赖描述

  • 位置: README.md
  • 代码: Qt5 (>= 5.11.0) 或 Qt6 (>= 6.0.0)
  • 审查意见: 不一致。README 中声称支持 Qt5 或 Qt6,但 debian/controldebian/control.1 分别是互斥的(一个只支持 Qt6,一个只支持 Qt5)。
  • 建议: 修改 README,明确指出不同分支或版本对应的 Qt 依赖,或者修改构建系统以支持同时安装两种版本(虽然这通常不推荐)。或者,如果 debian/control 是当前主构建配置,README 应明确指出 "Current master branch requires Qt6"。

问题点 3:CMake 翻译生成逻辑

  • 位置: cmake/translation-generate.cmake
  • 代码: 注释掉的命令 # COMMAND ${Qt${QT_VERSION_MAJOR}_LUPDATE_EXECUTABLE} ...
  • 审查意见: 需确认。注释掉 lupdate 命令意味着不再自动更新 .ts 翻译源文件,只使用 lrelease 编译现有的 .ts 文件。如果是出于构建速度考虑(避免每次构建都扫描源码),这是合理的。但如果是开发者希望提取新的翻译字符串,这会导致工作流中断。
  • 建议: 可以保留注释,但最好在文档中说明如何手动触发翻译更新(例如 make update-translations)。

3. 代码性能

  • 审查意见: 本次变更主要集中在构建系统和依赖管理上,不涉及直接的 C++ 运行时代码,因此对运行时性能无直接影响。
  • 构建性能: Qt6 通常比 Qt5 有更快的构建速度(尤其是 moc 和构建系统的优化),因此迁移到 Qt6 在构建性能上可能带来提升。

4. 代码安全

  • 审查意见: 本次变更未引入明显的安全漏洞。
  • 依赖安全: 更新到 Qt6 (>= 6.0.0) 通常意味着获得了比旧版 Qt5 更多的安全补丁和修复,这是一个积极的安全改进。
  • 依赖一致性: debian/control 中移除了 qt5-x11extras 的依赖(原 diff 中未显示移除,但在 README 中移除了)。Qt6 通常将 X11 相关功能整合到了核心模块中,这减少了对外部库的依赖,降低了潜在的攻击面。

总结与改进建议

  1. 清理构建产物: 删除 debian/control.1。如果需要维护 Qt5 版本,请使用 Git 分支或单独的构建目录。
  2. 统一文档与配置: 确保 README.md 中的依赖说明与 debian/control 中的实际依赖一致。如果决定全面转向 Qt6,请更新 README 移除 Qt5 的描述,反之亦然。
  3. CMake 变量检查: 在 cmake/translation-generate.cmake 中使用 QT_VERSION_MAJOR 之前,请确保 find_package(Qt...) 已经被正确调用并设置了该变量。
  4. 头文件包含: 虽然拼写错误已修正,建议在代码审查中检查 accessiblewidget.h 是否确实包含 Q_OBJECT 宏,否则强制 MOC 它虽然不会报错,但是是多余的。

总体评价: 代码变更逻辑基本正确,成功适配了 Qt6 的构建命令。主要问题在于构建配置文件(debian/control)的管理和文档(README.md)的一致性上。建议理清 Qt5/Qt6 的共存策略,避免配置文件混乱。

@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lzwind, re2zero

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

@re2zero
Copy link
Contributor Author

re2zero commented Jan 27, 2026

/merge

@deepin-bot deepin-bot bot merged commit 97f92e3 into linuxdeepin:master Jan 27, 2026
18 checks passed
@re2zero re2zero deleted the bugfix branch January 27, 2026 05:39
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