Repository navigation
Conversation
1. Root cause: VERSION in top-level CMakeLists.txt and APP_VERSION
defaults in reader/ and batch-print/ were never updated from the
initial "1.0.0" placeholder, causing non-Debian CMake builds to
show "1.0.0" in the About dialog
2. Fix: update project() VERSION to 6.6.2 and replace hardcoded
APP_VERSION "1.0.0" with ${PROJECT_VERSION} in both submodules,
making the project version the single source of truth
3. Impact: Debian builds unaffected (debian/rules overrides
APP_VERSION via -DAPP_VERSION=$(DEB_VERSION_UPSTREAM)); community
CMake builds now display the correct version 6.6.2
Log: Fix About dialog showing version 1.0.0 instead of 6.6.2
Influence:
1. Verify About dialog shows 6.6.2 after community CMake build
2. Verify Debian package build still uses changelog version
3. Verify batch-print tool reports correct version
fix: 同步 CMake 版本号至 6.6.2
1. 根因:顶层 CMakeLists.txt 的 VERSION 及 reader/、batch-print/ 子模块
的 APP_VERSION 默认值从未从初始占位值 "1.0.0" 更新,导致非 Debian 的
CMake 构建在"关于"对话框中显示 "1.0.0"
2. 方案:将 project() VERSION 更新为 6.6.2,子模块中硬编码的
APP_VERSION "1.0.0" 替换为 ${PROJECT_VERSION},使项目版本成为唯一数据源
3. 影响:Debian 构建不受影响(debian/rules 通过 -DAPP_VERSION 覆盖);
社区 CMake 构建现在显示正确的版本号 6.6.2
Log: 修复"关于"对话框显示版本号 1.0.0 而非 6.6.2 的问题
Influence:
1. 验证社区 CMake 构建后"关于"对话框显示 6.6.2
2. 验证 Debian 打包构建仍使用 changelog 版本号
3. 验证批量打印工具报告正确版本号
PMS: BUG-378351
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates CMake version metadata to 6.6.2 and makes both reader components derive their default application version from PROJECT_VERSION, fixing community CMake builds while retaining Debian packaging overrides. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pengfeixx 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 |
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="batch-print/CMakeLists.txt" line_range="80" />
<code_context>
INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}"
INSTALL_LIBDIR="${CMAKE_INSTALL_LIBDIR}"
- APP_VERSION="1.0.0"
+ APP_VERSION="${PROJECT_VERSION}"
)
</code_context>
<issue_to_address>
**Batch-print version remains unreported**
When the batch-print tool is expected to report its version, `APP_VERSION` is only defined for `batchprint-convert`; no batch-print source consumes it or sets an application version, so this change does not make the tool report 6.6.2 as promised.
Add a batch-print version-reporting path that consumes `APP_VERSION`, or narrow the claim that the tool reports the version.
</issue_to_address>| INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}" | ||
| INSTALL_LIBDIR="${CMAKE_INSTALL_LIBDIR}" | ||
| APP_VERSION="1.0.0" | ||
| APP_VERSION="${PROJECT_VERSION}" |
There was a problem hiding this comment.
🟡 Medium · Batch-print version remains unreported
When the batch-print tool is expected to report its version, APP_VERSION is only defined for batchprint-convert; no batch-print source consumes it or sets an application version, so this change does not make the tool report 6.6.2 as promised.
Add a batch-print version-reporting path that consumes APP_VERSION, or narrow the claim that the tool reports the version.
Prompt for AI agents
In `batch-print/CMakeLists.txt` at line 80:
**Batch-print version remains unreported**
When the batch-print tool is expected to report its version, `APP_VERSION` is only defined for `batchprint-convert`; no batch-print source consumes it or sets an application version, so this change does not make the tool report 6.6.2 as promised.
Add a batch-print version-reporting path that consumes `APP_VERSION`, or narrow the claim that the tool reports the version.
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 三处 CMake 语句均语法正确:1. project(deepin-reader VERSION 6.6.2 ...) 正确设置项目版本号;2. APP_VERSION="${PROJECT_VERSION}" 在 target_compile_definitions 中正确使用 CMake 变量展开;3. set(APP_VERSION "${PROJECT_VERSION}") 正确使用 set() 命令引用 PROJECT_VERSION 变量。PROJECT_VERSION 由 project() 命令自动设置,在子目录中可直接引用,逻辑链完整。 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 本次变更显著提升了代码可维护性:将版本号从三处独立硬编码改为以 PROJECT_VERSION 为单一数据源,消除版本号不一致风险。现有注释(如 '# 项目基本信息')保留完整。变更精简,仅3行修改,结构清晰。 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 本次变更均为构建时配置项,CMake 变量展开在配置阶段完成,对编译产物和运行时性能零影响。无性能瓶颈。 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: 本次变更不涉及用户输入处理、文件操作、网络通信等安全敏感场景。版本字符串 6.6.2 为静态字面值,${PROJECT_VERSION} 为 CMake 内置变量,均无注入风险。无敏感信息泄露。 💡 改进建议代码示例# CMakeLists.txt - 根项目版本(已正确)
project(deepin-reader
VERSION 6.6.2
DESCRIPTION "Deepin Document Viewer"
LANGUAGES CXX C
)
# reader/CMakeLists.txt - 使用 PROJECT_VERSION 作为回退值(已正确)
if (NOT APP_VERSION)
set(APP_VERSION "${PROJECT_VERSION}")
endif()
# batch-print/CMakeLists.txt - 直接引用 PROJECT_VERSION(已正确)
target_compile_definitions(batchprint-convert PRIVATE
APP_VERSION="${PROJECT_VERSION}"
)本报告由 AI 代码审查工具自动生成 |
修复说明
问题
文档查看器(deepin-reader)在社区 CMake 构建中,"关于"对话框显示版本号为"1.0.0",而非期望的"6.6.2"。
根因
版本号升级提交(6.6.0 → 6.6.1 → 6.6.2)仅更新了
debian/changelog和linglong.yaml,从未同步更新CMakeLists.txt中的VERSION字段及子模块APP_VERSION默认值。Debian 打包通过debian/rules传-DAPP_VERSION=$(DEB_VERSION_UPSTREAM)覆盖了默认值,故 Debian 构建正常;但社区 CMake 构建不传此参数,回退为初始占位值"1.0.0"。修复内容
CMakeLists.txt:5—VERSION 1.0.0→VERSION 6.6.2reader/CMakeLists.txt:112—set(APP_VERSION "1.0.0")→set(APP_VERSION "${PROJECT_VERSION}")batch-print/CMakeLists.txt:80—APP_VERSION="1.0.0"→APP_VERSION="${PROJECT_VERSION}"影响范围
-DAPP_VERSION覆盖机制正常)PROJECT_VERSION成为版本号唯一数据源改动安全评估
风险等级:低风险。三处改动均为 CMake 版本字符串字面值更新,不涉及函数签名、控制逻辑或外部调用者。Debian 覆盖机制不受影响。
PMS: BUG-378351
Summary by Sourcery
Synchronize CMake project and component versioning with release 6.6.2.
Bug Fixes:
Enhancements: