fix: honor DISABLE_DRIVER in CMake - #739
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: felixonmars 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 |
Reviewer's GuideThe PR makes DISABLE_DRIVER effective across configuration, compilation, dependency discovery, and runtime navigation by excluding driver-only sources, avoiding QApt/kmod requirements, and blocking access to the driver page when disabled. Sequence diagram for disabled driver page navigationsequenceDiagram
participant Caller
participant MainWindow
Caller->>MainWindow: slotSetPage(page)
alt page is driver and DISABLE_DRIVER is defined
MainWindow-->>Caller: return
else driver support enabled or another page
MainWindow->>MainWindow: slotSetPage(page)
end
Flow diagram for DISABLE_DRIVER build configurationflowchart TD
A[DISABLE_DRIVER option] --> B{DISABLE_DRIVER enabled?}
B -->|Yes| C[Define DISABLE_DRIVER]
C --> D[Exclude drivercontrol sources]
C --> E[Skip QApt and kmod discovery]
C --> F[Omit QApt link libraries]
B -->|No| G[Discover QApt and kmod]
G --> H[Build driver-control sources]
G --> I[Link QApt libraries]
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="CMakeLists.txt" line_range="9" />
<code_context>
-set(DISABLE_DRIVER false CACHE BOOL "disable driver")
-if (DISABLE_DRIVER)
+option(DISABLE_DRIVER "Disable driver support" OFF)
+if(DISABLE_DRIVER)
add_definitions(-DDISABLE_DRIVER)
</code_context>
<issue_to_address>
**issue (broader_impact):** Enabling `DISABLE_DRIVER` still makes a coverage/test configuration require QApt and libkmod because `deepin-devicemanager-server/tests/CMakeLists.txt` unconditionally calls `find_package(QApt...)` and `PKG_SEARCH_MODULE(kmod REQUIRED ...)`. The disabled build therefore fails at CMake configuration when those driver dependencies are absent.
**Triggers:** When `CMAKE_COVERAGE_ARG=CMAKE_COVERAGE_ARG_ON` and QApt or libkmod is not installed.
**Suggested fix:** Guard the test dependency discovery and driver-specific test sources/link libraries with `if(NOT DISABLE_DRIVER)`, or disable the driver tests when the option is enabled.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
05214b0 to
662f2f5
Compare
The top-level option defines DISABLE_DRIVER for source code, but the build still required QApt and built driver-only sources. Make the option skip QApt/kmod discovery and driver-control sources in normal and coverage/test builds, and ignore direct requests for the driver page when the feature is disabled.
662f2f5 to
a3abe53
Compare
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: [] 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: ['可考虑在 C++ 代码中使用单一条件路径优化 #ifdef 块结构,例如将 DISABLE_DRIVER 的早返回逻辑与其他页面检查合并'] 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例// 暂无代码示例本报告由 AI 代码审查工具自动生成 |
The top-level option defines DISABLE_DRIVER for source code, but the build still required QApt and built driver-only sources. Make the option skip QApt/kmod discovery and driver-control sources, and ignore direct requests for the driver page when the feature is disabled.
Summary by Sourcery
Make DISABLE_DRIVER fully control driver support in both the build configuration and application behavior.
Bug Fixes:
Enhancements:
Build:
Tests: