Skip to content

fix: Fix non-reproducible builds#180

Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
wangrong1069:pr1023
Oct 23, 2025
Merged

fix: Fix non-reproducible builds#180
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
wangrong1069:pr1023

Conversation

@wangrong1069
Copy link
Contributor

@wangrong1069 wangrong1069 commented Oct 23, 2025

Skip build rpath when the build type is set to "Release" to ensure reproducible builds.

Summary by Sourcery

Build:

  • Skip build RPATH for Release builds to improve build reproducibility

Skip build rpath when the build type is set to "Release" to ensure reproducible builds.
@sourcery-ai
Copy link

sourcery-ai bot commented Oct 23, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR updates the CMake configuration to disable setting the build rpath when building in Release mode, ensuring reproducible release builds.

File-Level Changes

Change Details Files
Skip build rpath for Release builds to ensure reproducible builds
  • Add conditional check for CMAKE_BUILD_TYPE == "Release"
  • Enable CMAKE_SKIP_BUILD_RPATH within the Release branch
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

deepin pr auto review

我来对这个CMakeLists.txt的修改进行审查:

  1. 语法逻辑:
  • 语法正确,使用了标准的CMake条件判断语法
  • 逻辑清晰,仅在Release构建类型下设置CMAKE_SKIP_BUILD_RPATH
  1. 代码质量:
  • 代码结构清晰,注释说明了修改的目的
  • 变量命名符合CMake规范
  • 条件判断使用STREQUAL是正确的字符串比较方式
  1. 代码性能:
  • 这个修改主要影响构建过程而不是运行时性能
  • 设置CMAKE_SKIP_BUILD_RPATH可以减少构建产物的RPATH信息,有助于减小二进制文件大小
  1. 代码安全:
  • 这个修改本身不会引入安全风险
  • 但需要注意,禁用RPATH可能会影响动态库的加载行为

改进建议:

  1. 建议添加更详细的注释,说明为什么在Release构建中需要跳过RPATH,以及这可能带来的影响:
# Skip build rpath for reproducible release build
# Note: This may affect runtime library search path
# Ensure all necessary libraries are in standard system paths
if(CMAKE_BUILD_TYPE STREQUAL "Release")
    set(CMAKE_SKIP_BUILD_RPATH TRUE)
endif()
  1. 考虑添加一个选项让用户可以控制这个行为:
# Add option to control RPATH behavior
option(SKIP_RPATH_IN_RELEASE "Skip RPATH in Release builds" ON)
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND SKIP_RPATH_IN_RELEASE)
    set(CMAKE_SKIP_BUILD_RPATH TRUE)
endif()
  1. 建议在设置CMAKE_SKIP_BUILD_RPATH之前添加一个检查,确保这不是交叉编译场景:
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND NOT CMAKE_CROSSCOMPILING)
    set(CMAKE_SKIP_BUILD_RPATH TRUE)
endif()

这些改进可以让代码更加健壮和可配置,同时提供更好的文档说明。

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

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

@wangrong1069
Copy link
Contributor Author

/merge

@deepin-bot deepin-bot bot merged commit 416fdd9 into linuxdeepin:master Oct 23, 2025
18 checks passed
@wangrong1069 wangrong1069 deleted the pr1023 branch October 23, 2025 06:15
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