-
Notifications
You must be signed in to change notification settings - Fork 42
reproducible build error #549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Added CMAKE_SKIP_BUILD_RPATH flag to enable reproducible builds This change ensures consistent binary output across different build environments by preventing the inclusion of build-specific paths in the compiled binaries The flag is added to DEB_CMAKE_EXTRA_FLAGS which is then passed to the configure command Influence: 1. Verify that builds produce identical binaries when built in different environments 2. Test that the application still functions correctly with the new build flag 3. Check that RPATH is not embedded in the resulting binaries 4. Validate that the build process completes successfully with the new parameter feat: 添加可重复编译参数 添加 CMAKE_SKIP_BUILD_RPATH 标志以启用可重复构建 此更改通过防止在编译的二进制文件中包含特定于构建的路径 确保在不同构建环境中产生一致的二进制输出 该标志被添加到 DEB_CMAKE_EXTRA_FLAGS 中,然后传递给配置命令 Influence: 1. 验证在不同环境中构建时是否产生相同的二进制文件 2. 测试应用程序在使用新构建标志后是否仍能正常运行 3. 检查生成的二进制文件中是否未嵌入 RPATH 4. 验证构建过程在使用新参数后是否成功完成
1. Remove CHAMELEON_PATH definition and usage from CMakeLists.txt 2. Replace compile-time CHAMELEON_PATH with runtime path calculation using QGuiApplication::applicationDirPath() 3. Change install directive from copying entire plugin directory to only installing qmldir file 4. This prevents duplicate files during installation and resolves recompilation issues The changes address a problem where redundant installation content was causing repeatable compilation problems. By removing the compile- time path definition and dynamically calculating the path at runtime, we eliminate dependency on build-time paths. Additionally, installing only the qmldir file instead of the entire plugin directory prevents duplicate file conflicts during installation. Influence: 1. Verify that examples can still find and load Chameleon plugins at runtime 2. Test that QML import paths are correctly set in both exhibition and qml-inspect examples 3. Confirm that plugin installation only includes necessary qmldir file 4. Check that style settings work correctly across different Qt versions 5. Validate that no duplicate files are created during build/install process fix: 解决重复编译问题,移除冗余安装内容 1. 从 CMakeLists.txt 中移除 CHAMELEON_PATH 定义和使用 2. 使用 QGuiApplication::applicationDirPath() 运行时路径计算替换编译 时 CHAMELEON_PATH 3. 将安装指令从复制整个插件目录改为仅安装 qmldir 文件 4. 这防止了安装过程中的重复文件问题并解决了重新编译问题 这些更改解决了冗余安装内容导致可重复编译的问题。通过移除编译时路径定义并 在运行时动态计算路径,我们消除了对构建时路径的依赖。此外,仅安装 qmldir 文件而不是整个插件目录可以防止安装过程中的重复文件冲突。 Influence: 1. 验证示例程序在运行时仍能找到并加载 Chameleon 插件 2. 测试 exhibition 和 qml-inspect 示例中的 QML 导入路径是否正确设置 3. 确认插件安装仅包含必要的 qmldir 文件 4. 检查样式设置在不同 Qt 版本中是否正常工作 5. 验证构建/安装过程中不会创建重复文件
Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: linuxdeepin/dtkdeclarative#549
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR replaces hardcoded CHAMELEON_PATH macros with dynamic, applicationDirPath-based resolution in the example apps, removes obsolete path definitions, refines CMake install rules to prevent duplicate compilation, and adds reproducible build parameters to the Debian packaging. Class diagram for main.cpp changes (dynamic chameleonPath resolution)classDiagram
class main {
+int main(int argc, char **argv)
-CHAMELEON_PATH : macro (removed)
+chameleonPath : QString (added)
}
main --> QQmlApplicationEngine : uses
main --> QQuickStyle : uses
main --> QGuiApplication : uses
Class diagram for qml-inspect/main.cpp changes (dynamic chameleonPath resolution)classDiagram
class main {
+int main(int argc, char *argv[])
-CHAMELEON_PATH : macro (removed)
+chameleonPath : QString (added)
}
main --> QQmlApplicationEngine : uses
main --> QQuickStyle : uses
main --> QGuiApplication : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review我来对这个diff进行详细审查:
+DEB_CMAKE_EXTRA_FLAGS += -DCMAKE_SKIP_BUILD_RPATH=ON
-set(CHAMELEON_PATH "${PROJECT_BINARY_DIR}/plugins")
- -DCHAMELEON_PATH="${CHAMELEON_PATH}"
+ const QString chameleonPath = QStringLiteral("%1/../../../plugins").arg(QGuiApplication::applicationDirPath());
-install(DIRECTORY "${PLUGIN_OUTPUT_DIR}/${URI_PATH}/" DESTINATION "${QML_INSTALL_DIR}/${URI_PATH}")
+install(FILES "${PLUGIN_OUTPUT_DIR}/${URI_PATH}/qmldir" DESTINATION "${QML_INSTALL_DIR}/${URI_PATH}")
总体改进建议:
这些修改总体上是积极的,提高了代码的可维护性和安全性,但还可以进一步完善。 |
There was a problem hiding this 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 found some issues that need to be addressed.
- Refactor the duplicated chameleonPath computation in both example mains into a shared helper to reduce copy-paste.
- Use QLibraryInfo::path(QLibraryInfo::PluginsPath) (or QStandardPaths) instead of a hardcoded relative path for locating the QML plugin directory.
- Update the CMake install rule to include the plugin binaries/resources in addition to qmldir so nothing is missing at runtime.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Refactor the duplicated chameleonPath computation in both example mains into a shared helper to reduce copy-paste.
- Use QLibraryInfo::path(QLibraryInfo::PluginsPath) (or QStandardPaths) instead of a hardcoded relative path for locating the QML plugin directory.
- Update the CMake install rule to include the plugin binaries/resources in addition to qmldir so nothing is missing at runtime.
## Individual Comments
### Comment 1
<location> `examples/exhibition/main.cpp:84` </location>
<code_context>
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0) && defined(QT_NO_DEBUG)
- QQuickStyle::setStyle(CHAMELEON_PATH"/Chameleon");
+ QQuickStyle::setStyle(chameleonPath"/Chameleon");
#else
QQuickStyle::setStyle("Chameleon");
</code_context>
<issue_to_address>
**issue (bug_risk):** String concatenation with chameleonPath may not work as intended.
Use chameleonPath + "/Chameleon" for correct QString concatenation in C++.
</issue_to_address>
### Comment 2
<location> `examples/qml-inspect/main.cpp:33` </location>
<code_context>
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0) && defined(QT_NO_DEBUG)
- QQuickStyle::setStyle(CHAMELEON_PATH"/Chameleon");
+ QQuickStyle::setStyle(chameleonPath"/Chameleon");
#else
QQuickStyle::setStyle("Chameleon");
</code_context>
<issue_to_address>
**issue (bug_risk):** Invalid string concatenation for style path.
Use chameleonPath + "/Chameleon" to concatenate the path correctly.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
|
||
| #if QT_VERSION < QT_VERSION_CHECK(5, 12, 0) && defined(QT_NO_DEBUG) | ||
| QQuickStyle::setStyle(CHAMELEON_PATH"/Chameleon"); | ||
| QQuickStyle::setStyle(chameleonPath"/Chameleon"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): String concatenation with chameleonPath may not work as intended.
Use chameleonPath + "/Chameleon" for correct QString concatenation in C++.
|
|
||
| #if QT_VERSION < QT_VERSION_CHECK(5, 12, 0) && defined(QT_NO_DEBUG) | ||
| QQuickStyle::setStyle(CHAMELEON_PATH"/Chameleon"); | ||
| QQuickStyle::setStyle(chameleonPath"/Chameleon"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): Invalid string concatenation for style path.
Use chameleonPath + "/Chameleon" to concatenate the path correctly.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, BLumia, mhduiy 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 |
Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: linuxdeepin/dtkdeclarative#549
Summary by Sourcery
Refactor example applications to compute plugin paths dynamically, remove static CHAMELEON_PATH build definitions, streamline plugin installation to avoid duplicates, and update packaging for reproducible builds.
Bug Fixes:
Enhancements:
Build: