Skip to content

feat: export appid binary wrapper and inject via systemd environment generator - #1882

Open
wrj97-alt wants to merge 2 commits into
OpenAtom-Linyaps:masterfrom
wrj97-alt:agent/agent/c424f913
Open

wrj97-alt wants to merge 2 commits into
OpenAtom-Linyaps:masterfrom
wrj97-alt:agent/agent/c424f913

Conversation

@wrj97-alt

@wrj97-alt wrj97-alt commented Aug 28, 2026 •

Copy link
Copy Markdown

概述

在安装/升级 app 类型的玲珑包时,向 entries/bin 导出一个与 appid 同名的可执行 wrapper(exec ll-cli run <APPID> -- <command...> "$@"),并通过 systemd 环境生成器把 entries/bin 追加进 PATH,使宿主可直接运行导出的命令。

主要改动

1. 二进制 wrapper 导出与生命周期(ostree_repo)

  • 导出:exportAppBinaries 生成真实脚本 entries/bin/apps/<APPID>/bin/<APPID>,并在 entries/bin 下建立指向它的相对符号链接;内容取完整 command 数组。创建为幂等 upsert(内容相同为 no-op,不同则覆盖)。
  • 模块归属:wrapper 固定由 binary 模块导出,非 binary 模块(如 develop)不创建、不覆盖。
  • 空 command 清理:层升级为无 command 版本时,删除上一版本残留的 wrapper 与脚本目录(与 unexport 清理一致,含单测覆盖)。
  • 卸载:unexportAppEntries 仅在应用最后一个未删除 layer 被移除时清理 wrapper,升级/模块级卸载时保留。
  • 目录稳定性:清理空目录时保留顶层 entries/bin、entries/share(环境注入引用它们)。
  • 目录创建:entries/bin/apps/<APPID>/bin 与 entries/share 由导出逻辑(createBinaryWrapperScript / exportAppBinaries)自行创建,不再依赖 tmpfiles 预建。
  • LINGLONG_EXPORT_VERSION 升至 1.0.0.5 以触发现有安装重新导出。

2. 环境注入(misc/)

  • 还原环境导出文件到 master 布局:移除 user-environment-generators/61-linglong 与 profile.d 的 PATH 注入;在 system-environment-generators/61-linglong 的 master 形态基础上直接追加 PATH 导出(追加不前置、目录存在才注入、去重),同时保持输出 XDG_DATA_DIRS。

测试

  • 新增 exporter 相关单测(空 command 清理、非 binary 模块跳过、幂等 upsert、卸载保留/清理等)。
  • 本地 ctest:745/745 通过;pre-commit 通过。

@deepin-ci-robot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: wrj97-alt

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

@deepin-ci-robot

Copy link
Copy Markdown
Collaborator

Hi @wrj97-alt. Thanks for your PR.

I'm waiting for a OpenAtom-Linyaps member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@codecov

codecov Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 54.83871% with 56 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
libs/linglong/src/linglong/repo/ostree_repo.cpp 54.83% 26 Missing and 30 partials ⚠️
Files with missing lines Coverage Δ
libs/linglong/src/linglong/repo/ostree_repo.h 8.33% <ø> (ø)
libs/linglong/src/linglong/repo/ostree_repo.cpp 41.78% <54.83%> (+1.15%) ⬆️

... and 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wrj97-alt
wrj97-alt force-pushed the agent/agent/c424f913 branch 13 times, most recently from 3877a97 to 1bd2dfd Compare September 10, 2026 03:43
@ComixHe
ComixHe requested a review from reddevillg September 10, 2026 03:45
@wrj97-alt
wrj97-alt force-pushed the agent/agent/c424f913 branch 4 times, most recently from 43c9e0a to bef2703 Compare September 11, 2026 09:01
@wrj97-alt
wrj97-alt force-pushed the agent/agent/c424f913 branch 3 times, most recently from 17e9f27 to 034c38e Compare September 22, 2026 12:48
@wrj97-alt
wrj97-alt force-pushed the agent/agent/c424f913 branch 2 times, most recently from 7cb508a to 463d0c1 Compare October 8, 2026 04:24
@ComixHe ComixHe changed the title feat: implement binary export functionality (exportedBinaries & ll-cli alias) feat: implement binary export functionality Oct 8, 2026
@wrj97-alt
wrj97-alt force-pushed the agent/agent/c424f913 branch from 463d0c1 to 0f979bf Compare October 15, 2026 10:25
@wrj97-alt wrj97-alt changed the title feat: implement binary export functionality feat: export appid binary wrapper and inject via systemd environment generator Oct 15, 2026
@wrj97-alt
wrj97-alt force-pushed the agent/agent/c424f913 branch from 0f979bf to d6e787b Compare October 15, 2026 13:13
Write a single executable wrapper named after the appid into entries/bin:
the real script lives under entries/bin/apps/<APPID>/bin and a relative
symlink in entries/bin points to it. The wrapper is owned by the app's
binary module (other modules never overwrite it) and a command-less layer
removes any stale wrapper from a previous version. Wrapper creation is an
idempotent upsert (EEXIST with identical content is a no-op, different
content is overwritten). unexportAppEntries cleans up the wrapper at the
appID level, removing it only when no other undeleted layer of the same app
remains, keeping it alive across upgrades and module-level uninstalls. The
top-level bin/share entries directories are kept even when empty since the
environment injection references them. Bump LINGLONG_EXPORT_VERSION to
1.0.0.5.
Restore the environment export layout to master form (the
user-environment-generators/profile.d multi-leg split left over from the
refactor is dropped) and have the systemd system environment generator
(61-linglong) append entries/bin to PATH idempotently and only when the
directory exists, in addition to emitting XDG_DATA_DIRS. The entries/bin and
entries/share directories are created by the package manager on export
(createBinaryWrapperScript makes entries/bin/apps/<APPID>/bin and
exportAppBinaries ensures entries/share), so no tmpfiles pre-creation or
CMake prefix checks are needed.
@wrj97-alt
wrj97-alt force-pushed the agent/agent/c424f913 branch from d6e787b to 2c540fd Compare October 15, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants