Skip to content

fix: sync CMake version to 6.6.2 - #420

Open
pengfeixx wants to merge 1 commit into
linuxdeepin:masterfrom
pengfeixx:agent/pms-bug-bot/c1aab947c531
Open

pengfeixx wants to merge 1 commit into
linuxdeepin:masterfrom
pengfeixx:agent/pms-bug-bot/c1aab947c531

Conversation

@pengfeixx

@pengfeixx pengfeixx commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

修复说明

问题

文档查看器(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"。

修复内容

  1. CMakeLists.txt:5 — VERSION 1.0.0 → VERSION 6.6.2
  2. reader/CMakeLists.txt:112 — set(APP_VERSION "1.0.0") → set(APP_VERSION "${PROJECT_VERSION}")
  3. batch-print/CMakeLists.txt:80 — APP_VERSION="1.0.0" → APP_VERSION="${PROJECT_VERSION}"

影响范围

  • 社区 CMake 构建版本号显示正确(6.6.2)
  • Debian 打包构建不受影响(-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:

  • Ensure CMake-based builds report the correct 6.6.2 application version instead of the placeholder 1.0.0.

Enhancements:

  • Make the project version the single source of truth for reader and batch-print application version metadata.

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
@sourcery-ai

sourcery-ai Bot commented Oct 16, 2026

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

Reviewer's Guide

Updates 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

Change Details Files
Synchronize the project’s CMake version and propagate it as the default application version.
  • Update the top-level project version to 6.6.2.
  • Use PROJECT_VERSION for the reader’s fallback APP_VERSION.
  • Use PROJECT_VERSION for the batch-print compile definition while preserving Debian’s override path.
CMakeLists.txt
reader/CMakeLists.txt
batch-print/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

@deepin-ci-robot

Copy link
Copy Markdown

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

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

@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="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>

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

INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}"
INSTALL_LIBDIR="${CMAKE_INSTALL_LIBDIR}"
APP_VERSION="1.0.0"
APP_VERSION="${PROJECT_VERSION}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

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

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 总体评分 100 分,大于 70 分通过阈值。本次变更仅涉及3处 CMakeLists.txt 版本字符串同步更新,将占位版本号 1.0.0 修正为 6.6.2,并将子模块硬编码版本改为引用 ${PROJECT_VERSION} 变量,实现版本号单一数据源管理。变更风险极低,语法正确,逻辑清晰,无安全漏洞。

🔍 详细分析

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. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

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

建议: 本次变更不涉及用户输入处理、文件操作、网络通信等安全敏感场景。版本字符串 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 代码审查工具自动生成

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.

2 participants