Skip to content

build(linglong): migrate to buildext.apt declarative dependencies - #534

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:linglong-buildext-migration
Oct 28, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:linglong-buildext-migration

Conversation

@add-uos

@add-uos add-uos commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

迁移 deepin-camera 的玲珑打包方式:将手动 apt --download-only + install_dep/deploy_dep/LDD_FILES 方案替换为声明式 buildext.apt.build_depends / depends,与 deepin-movie-reborn、deepin-editor 已完成的 buildext 迁移保持一致。

变更内容

  • 删除 install_dep、deploy_dep 脚本及 .reuse/dep5 中对应的 REUSE 条目
  • buildext.apt.build_depends(仅声明 base/runtime 层未提供的构建期包):
    cmake、libavutil-dev、libavformat-dev、libavcodec-dev、libswscale-dev、libswresample-dev、libv4l-dev、portaudio19-dev、libpciaccess-dev、libusb-1.0-0-dev、libffmpegthumbnailer-dev、libva-dev、libimageeditor6-dev、libgstreamer1.0-dev、libgstreamer-plugins-base1.0-dev
    (Qt6/DTK6/X11/glib/udev 等开发包与工具链由 base org.deepin.base/25.2.2 与 runtime org.deepin.runtime.dtk/6.7.0 提供;debian/control 中未被代码引用的 deepin-gettext-tools 等条目已剔除)
  • buildext.apt.depends(仅声明 base/runtime 层未提供的直接运行时包):
    deepin-event-log、libimageeditor6、libportaudio2、libffmpegthumbnailer4v5、gstreamer1.0-plugins-base、gstreamer1.0-plugins-good、dmidecode
    (代码 QProcess 调用 dmidecode;deepin-event-log 提供代码 dlopen 的裸名 libdeepin-event-log.so;blas/lapack 由 apt 闭包自动带入,替代旧配方的手动 mv + ldconfig)
  • build::保留源码编译,新增两处头文件路径 sed(gstreamer/libusb,buildext 将 -dev 头文件装入 /usr/include 而非 ${PREFIX}/include),不改源码
  • 兼容旧层 dlopen 行为:
    • 复制真实 libblas.so.3/liblapack.so.3 到应用库目录(其顶层符号链接指向层内不存在的 /etc/alternatives,会导致层内 ffmpegthumbnailer/ffmpeg 二进制 ldd 检查失败)
    • 按旧层配方补建裸名符号链接 libswscale.so/libffmpegthumbnailer.so/libportaudio.so(代码经 libPath()/load_libs.c 按裸名 dlopen,缺失会导致缩略图等功能失效)

验证

  • ll-builder build 全流程通过(含 [Runtime Check] ldd 闭包检查),产物层 241M(对比:deepin-movie-reborn 迁移后 317M)
  • 容器内冒烟测试:ldd ./deepin-camera 无 not found;QT_QPA_PLATFORM=offscreen 启动 10s 无 dlopen 失败、无崩溃(无摄像头设备仅报正常警告)

Summary by Sourcery

Migrate deepin-camera’s Linglong packaging to declarative APT dependencies while preserving runtime library compatibility and validated application startup.

Bug Fixes:

  • Preserve runtime loading of libraries required by thumbnails and related functionality while ensuring bundled binaries pass dependency checks.

Enhancements:

  • Migrate Linglong dependency management to declarative build-time and runtime package declarations.
  • Simplify the build recipe by removing manual dependency installation, deployment scripts, and legacy dependency packaging logic.
  • Adapt the build configuration for system-installed development headers and retain required bundled library links.

Build:

  • Update the Linglong build configuration to declare build and runtime APT dependencies explicitly.

Tests:

  • Verify the migrated package builds successfully with runtime dependency checks and launches in an offscreen smoke test without missing-library errors.

Chores:

  • Remove obsolete dependency installation and deployment scripts and their associated REUSE metadata.

Replace the manual install_dep/deploy_dep packaging with declarative
buildext.apt.build_depends/depends, aligning with the buildext
migration of deepin-movie-reborn and deepin-editor:

- declare build-time packages missing from base/runtime (cmake, ffmpeg
  dev libs, v4l/portaudio/pciaccess/usb/va/imageeditor/gstreamer dev)
- declare runtime packages missing from base/runtime (deepin-event-log,
  libimageeditor6, libportaudio2, libffmpegthumbnailer4v5, gst
  plugins-base/good, dmidecode); drop entries unused by code or already
  provided by base/runtime
- fix hardcoded include paths (gstreamer/libusb) for the buildext
  layout via build-time seds, keeping src/CMakeLists.txt untouched
- copy real libblas.so.3/liblapack.so.3 and create bare-name symlinks
  (libswscale/libffmpegthumbnailer/libportaudio) into the app lib dir,
  reproducing the old layer's dlopen support and replacing the
  mv-blas/lapack + LDD_FILES logic

Verified with ll-builder build (runtime ldd check included); the app
runs with zero dlopen failures in an offscreen smoke test.

Change-Id: I7ce1c50db645bbad31d670090aabdbdc85691205
@sourcery-ai

sourcery-ai Bot commented Oct 27, 2026

Copy link
Copy Markdown

Sorry @add-uos, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 14 hours and 6 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@github-actions

Copy link
Copy Markdown
  • 检测到敏感词dmidecode变动
详情
    {
    "dmidecode": {
        "linglong.yaml": [
            "      - dmidecode"
        ]
    }
}

@sourcery-ai

sourcery-ai Bot commented Oct 27, 2026

Copy link
Copy Markdown

Reviewer's Guide

本 PR 将 deepin-camera 从手动 apt 下载、解包和 LDD 部署迁移到 buildext.apt 的声明式依赖管理,并在保持源码构建不变的基础上适配头文件路径及运行时动态库布局,确保层内 ldd 检查和应用启动兼容性。

Sequence diagram for buildext dependency migration

sequenceDiagram
    participant Builder as ll-builder
    participant Buildext as buildext.apt
    participant CMake as CMake build
    participant Layer as Application layer
    participant Check as Runtime check
    Builder->>Buildext: Resolve build_depends
    Buildext-->>CMake: Provide development headers and libraries
    CMake->>CMake: cmake --build build-linglong
    CMake->>Layer: Install deepin-camera
    Builder->>Buildext: Resolve depends
    Buildext-->>Layer: Add runtime packages
    Layer->>Layer: Copy libblas.so.3 and liblapack.so.3
    Layer->>Layer: Create bare-name dlopen links
    Layer->>Check: Validate installed binaries
    Check-->>Builder: ldd closure passes
Loading

Flow diagram for runtime library compatibility

flowchart TD
    App["deepin-camera"] --> Loader["Runtime dlopen by bare name"]
    Loader --> Links["libswscale.so\nlibffmpegthumbnailer.so\nlibportaudio.so"]
    Loader --> EventLog["libdeepin-event-log.so from depends"]
    FFmpeg["ffmpegthumbnailer / ffmpeg"] --> BLAS["Real libblas.so.3 and liblapack.so.3"]
    Links --> Layer["Application library directory"]
    EventLog --> Layer
    BLAS --> Layer
    Layer --> Valid["No missing libraries in ldd check"]
Loading

File-Level Changes

Change Details Files
迁移玲珑依赖管理至 buildext.apt 声明式配置,移除手动下载、安装和部署依赖的脚本流程。
  • 删除 install_dep、deploy_dep 及对应 REUSE 条目。
  • 将构建期开发包和运行期直接依赖分别声明为 build_depends 与 depends,并清理未使用依赖。
  • 依赖 base/runtime 已提供的 Qt、DTK、工具链及基础运行库不再重复打包。
.reuse/dep5
install_dep
deploy_dep
linglong.yaml
调整构建脚本以适配 buildext 的头文件布局,同时保留源码编译和安装流程。
  • 将 CMake 构建目录切换为 build-linglong。
  • 通过 sed 修正 gstreamer 与 libusb 头文件路径,源码本身不变。
  • 移除旧的 LDD_FILES、install 文件生成及资源依赖部署逻辑。
linglong.yaml
补齐运行时动态加载和层内链接解析所需的库文件与裸名符号链接。
  • 复制真实的 libblas.so.3 与 liblapack.so.3,避免 /etc/alternatives 链接在应用层内失效。
  • 为 libswscale.so、libffmpegthumbnailer.so 和 libportaudio.so 创建裸名链接,以兼容代码的 dlopen 行为。
linglong.yaml

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

deepin pr auto review

🤖 AI 代码审查报告

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

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交将玲珑构建从手动 install_dep/deploy_dep bash 脚本迁移至 buildext.apt 声明式依赖, 删除约240行复杂脚本,显著提升可维护性。四维度分析均通过,无安全漏洞, 代码注释详尽、逻辑清晰。仅在构建阶段对 CMakeLists.txt 使用 sed 修改路径的方式略有代码质量瑕疵, 但已有充分注释说明原因,整体质量优秀。

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: ['无需修改,语法和逻辑均正确']


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: ['建议将 src/CMakeLists.txt 中的 ${CMAKE_INSTALL_PREFIX}/include/gstreamer-1.0 和 ${CMAKE_INSTALL_PREFIX}/include/libusb-1.0 路径改为使用 CMake find_package 或 pkg_check_modules 自动检测,避免构建时 sed 修改源文件']


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: ['无需修改,性能表现良好']


4. 代码安全 🔒

评价: 存在0个安全漏洞 ✅ 通过

🔐 发现 0 个安全漏洞

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

建议: ['无需修改,安全合规']


💡 改进建议代码示例

# 建议:将 src/CMakeLists.txt 中的头文件路径改为通过 CMake 自动检测,避免构建时 sed 修改
#
# 在 src/CMakeLists.txt 中,将硬编码路径替换为 find_package / pkg_check_modules:
#
# # 旧代码(需 sed 修改):
# target_include_directories(deepin-camera PRIVATE
#     ${CMAKE_INSTALL_PREFIX}/include/gstreamer-1.0
#     ${CMAKE_INSTALL_PREFIX}/include/libusb-1.0
# )
#
# # 新代码(自动检测,无需 sed):
# find_package(PkgConfig REQUIRED)
# pkg_check_modules(GSTREAMER REQUIRED gstreamer-1.0)
# pkg_check_modules(LIBUSB REQUIRED libusb-1.0)
#
# target_include_directories(deepin-camera PRIVATE
#     ${GSTREAMER_INCLUDE_DIRS}
#     ${LIBUSB_INCLUDE_DIRS}
# )
#
# 这样无论头文件安装在 ${PREFIX}/include 还是 /usr/include,
# CMake 都能自动定位,linglong.yaml 中可移除 sed 命令。

本报告由 AI 代码审查工具自动生成

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: add-uos, lzwind

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

@add-uos

add-uos commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

This pr force merged! (status: unstable)

@deepin-bot
deepin-bot Bot merged commit dcf0c67 into linuxdeepin:master Oct 28, 2026
14 of 17 checks passed
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