Commit Graph

401 Commits

Author SHA1 Message Date
wrj97 f83e78523a feat: add no-clean-objects option for remove command
1. Add new flag --no-clean-objects to remove command options
2. Modify cmdRemoveApp function signature to accept prune parameter
3. Conditionally execute repo.prune() based on prune flag
4. Maintain repo.mergeModules() execution regardless of prune flag
5. Update command line interface to expose the new flag

This change allows users to control whether object files should be
cleaned during app removal. By default, objects are cleaned (previous
behavior), but users can now skip this step using --no-clean-objects
flag for faster removal operations or when they want to preserve objects
for other purposes.

Log: Added --no-clean-objects flag to ll-builder remove command

Influence:
1. Test default remove behavior (should clean objects)
2. Test remove with --no-clean-objects flag (should not clean objects)
3. Verify repo.mergeModules() is always called
4. Test removal of single and multiple apps with both options
5. Verify error handling for invalid app references
6. Test edge cases with empty app list

feat: 为 remove 命令添加 no-clean-objects 选项

1. 为 remove 命令选项添加新的 --no-clean-objects 标志
2. 修改 cmdRemoveApp 函数签名以接受 prune 参数
3. 根据 prune 标志有条件地执行 repo.prune()
4. 无论 prune 标志如何都执行 repo.mergeModules()
5. 更新命令行界面以暴露新标志

此更改允许用户控制在删除应用程序期间是否应清理对象文件。默认情况下,对象
会被清理(之前的行为),但用户现在可以使用 --no-clean-objects 标志跳过此
步骤,以实现更快的删除操作或在他们希望为其他目的保留对象时使用。

Log: 为 ll-builder remove 命令添加 --no-clean-objects 标志

Influence:
1. 测试默认删除行为(应清理对象)
2. 测试使用 --no-clean-objects 标志的删除(不应清理对象)
3. 验证 repo.mergeModules() 是否始终被调用
4. 测试单个和多个应用程序的删除(两种选项)
5. 验证无效应用程序引用的错误处理
6. 测试空应用程序列表的边界情况
2025-09-19 15:57:13 +08:00
dengbo 4e0b686c67 fix: correct no-dbus flag logic
The logic for handling the `--no-dbus` flag was inverted.  It was
checking `!noDBusFlag` which meant the sudo block was executed when
`--no-dbus` was *not* set. This meant that the application attempted
to use the package manager connection even when the user explicitly
requested to not use dbus (and likely intended to run as root).  This
commit corrects the logic by checking `*noDBusFlag`. Now the sudo block
will only execute when `--no-dbus` is actually set.

Influence:
1. Test ll-cli commands with and without the `--no-dbus` flag as a
normal user.  Verify that without `--no-dbus`, the commands fail due to
insufficient permissions.
2. Test ll-cli commands with the `--no-dbus` flag as root. Verify that
the commands succeed.
3. Test ll-cli commands without the `--no-dbus` flag as root. Verify
that the commands succeed as they will connect via DBus.

fix: 修正 no-dbus 标志逻辑

`--no-dbus` 标志的处理逻辑被反转了。 它检查的是 `!noDBusFlag`,这意味着
当 *没有* 设置 `--no-dbus` 时,sudo 代码块会被执行。 这意味着即使当用户
明确要求不使用 dbus (并且可能打算以 root 身份运行) 时,应用程序也会尝试
使用包管理器连接。 此提交通过检查 `*noDBusFlag` 来更正逻辑。 现在,只有
在实际设置 `--no-dbus` 时,sudo 代码块才会执行。

Influence:
1. 作为普通用户,使用和不使用 `--no-dbus` 标志测试 ll-cli 命令。 验证在
没有 `--no-dbus` 的情况下,由于权限不足,命令会失败。
2. 作为 root 用户,使用 `--no-dbus` 标志测试 ll-cli 命令。 验证命令是否
成功。
3. 作为 root 用户,在没有 `--no-dbus` 标志的情况下测试 ll-cli 命令。 验
证命令是否成功,因为它们将通过 DBus 连接。
2025-09-19 11:10:34 +08:00
deepsource-autofix[bot] f818837af1 style: format code with ClangFormat and Prettier
This commit fixes the style issues introduced in 9466067 according to the output
from ClangFormat and Prettier.

Details: None
2025-09-11 20:06:25 +08:00
wrj97 71f4a716f8 fix: correct list command logic and logging
1. Fixed inverted logic in list command for showing upgrade list vs
regular package list
2. Added sorting by package ID for both regular list and upgrade list
outputs
3. Replaced Qt logging with linglong's custom logging in ostree
repository
4. Maintained existing filtering functionality by package type

Log: Fixed package list display logic and improved sorting

Influence:
1. Test ll-cli list command without parameters to show installed
packages
2. Test ll-cli list --upgradable to show available upgrades
3. Verify package sorting by ID in both list modes
4. Test package type filtering with --type parameter
5. Verify installation time display in package list
6. Confirm error handling for repository access issues

fix: 修复列表命令逻辑和日志记录

1. 修复了显示升级列表与常规包列表的反向逻辑
2. 为常规列表和升级列表输出添加了按包ID排序功能
3. 在ostree仓库中将Qt日志替换为linglong自定义日志
4. 保持了按包类型过滤的现有功能

Log: 修复包列表显示逻辑并改进排序功能

Influence:
1. 测试不带参数的 ll-cli list 命令以显示已安装的包
2. 测试 ll-cli list --upgradable 以显示可用升级
3. 验证两种列表模式下的包ID排序
4. 测试使用 --type 参数的包类型过滤功能
5. 验证包列表中的安装时间显示
6. 确认仓库访问错误的处理机制
2025-09-11 20:06:25 +08:00
wrj97 6d1b5e3a06 feat: add base and runtime options
1. Add `--base` option to specify the base layer.
2. Add `--runtime` option to specify the runtime.
3. Modify `RunContext::resolve` to utilize the `--base` and `--runtime`
options.
4. Update builder resolution to pass base and runtime references.
5. Add logging for base and runtime resolution

Log: Added command-line options to specify the base and runtime for
application execution.

Influence:
1. Test application execution with different base layers.
2. Verify that specifying a runtime overrides the default runtime.
3. Ensure that the `--base` and `--runtime` options are respected during
application resolution.
4. Check that the logging accurately reflects the used base and runtime.

feat: 为 ll-cli 添加 base 和 runtime 选项

1. 添加 --base 选项来指定基础层
2. 添加 --runtime 选项来指定运行时环境
3. 修改 RunContext::resolve 以使用 --base 和 --runtime 选项
4. 更新构建器解析以传递基础和运行时引用
5. 添加基础和运行时解析的日志记录

Log: 增加了 ll-cli 的命令行选项,用于指定应用程序执行的基础层和运行时
环境。

Influence:
1. 使用不同的基础层测试应用程序执行
2. 验证指定运行时是否会覆盖默认运行时
3. 确保在应用程序解析期间尊重 --base 和 --runtime 选项
4. 检查日志是否准确地反映所使用的基础和运行时
2025-09-11 20:06:25 +08:00
wrj97 4cdcfb1559 refactor: refactor CLI command options structure for better maintainability
- 为每个子命令创建专门的选项:RunOptions、EnterOptions、KillOptions等
- 添加GlobalOptions用于处理全局选项如verbose
- 重构main.cpp中的命令解析逻辑,使用新的选项结构体
- 改进代码组织,使每个子命令的选项更加清晰和独立
2025-09-09 21:19:59 +08:00
ComixHe dac9f1e56b fix(ll-init): improve signal handling robustness
- Only forward signals from non-kernel sources in handle_sigevent
- Handle EINTR in epoll_wait loop to avoid premature exit on signal interruption

Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-09-09 21:19:59 +08:00
ComixHe 73395ea2d8 fix: improve UAB loader and packager with better mount handling
- Add processProfile function for triplet configuration
- Fix mount options from rbind to bind
- Optimize custom loader handling in packager

Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-09-05 10:24:25 +08:00
ComixHe 2ed4a92739 feat: add '--ref' export option for exporting package
Add ability to export specific package references from repository using
--ref and --modules parameters, without requiring complete project setup.

This mode is only for distributing.

Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-09-05 10:24:25 +08:00
reddevillg ccdc5dd9df feat: add new fmt based logging system
Introduces a new fmt based logging system to replace the previous
Qt-based logging mechanism.

Key features:
- Logging macros (LogD, LogI, LogW, LogE, LogF) for different levels.
- Configurable log levels and backends (Console, Journal).
- Configuration via environment variables (LINYAPS_LOG_LEVEL,
  LINYAPS_LOG_BACKEND) for flexible control.
- Integration with systemd-journal for structured logging, including
  code location (file, line, function).
- Custom `fmt` formatters for `QString`, `QStringList`, and
  `linglong::utils::error::Error`.
- New string utility functions (`stringEqual`, `splitString`) are added.

The `qdebug_helper.h` is removed as part of this transition.

Signed-off-by: reddevillg <reddevillg@gmail.com>
2025-08-05 16:28:53 +08:00
ComixHe f7cf75b867 feat(run): add option '--env'
Adding a '--env' option to the ll-cli run command,
allowing users to set environment variables when running applications.
This feature supports multiple environment variables in KEY=VALUE format with
input validation to ensure proper formatting.

Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-07-28 15:29:16 +08:00
deepsource-autofix[bot] f4277e2b74 style: format code with ClangFormat and Prettier
This commit fixes the style issues introduced in 941b502 according to the output
from ClangFormat and Prettier.

Details: None
2025-07-18 15:13:19 +08:00
reddevillg 2ae89a44d8 fix: Return exit code of initial child process
The init process will now exit with the same code as the initial child
process it manages.  This is crucial for environments like the builder,
where the success or failure of a command must be detected.

Add missing LINYAPS_INIT_SINGLE_MODE in handling process build depends.

Signed-off-by: reddevillg <reddevillg@gmail.com>
2025-07-16 15:36:46 +08:00
dengbo 466faea895 refactor: extends ll-cli dir command with module support
Adds support for specifying a module when using the `ll-cli dir`
command. This allows users to retrieve the layer directory for a
specific module within an application.
2025-07-16 15:06:19 +08:00
reddevillg 33ac90db39 fix: fix compiler on gcc-8
Signed-off-by: reddevillg <reddevillg@gmail.com>
2025-07-15 16:43:03 +08:00
ComixHe d01567dad1 fix(uab): set mount option 'rw' while generating config
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-07-11 17:00:12 +08:00
ComixHe 0d164e08df feat: add signleMode for ll-init
all of the builder container shouldn't reuse container

Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-07-11 16:40:15 +08:00
ComixHe ce30563923 refactor: reimplement reusing container
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-07-10 21:07:16 +08:00
myml bdf2cde3c9 feat: add mirror enable/disable functionality for repos
1. Added new CLI commands `enable-mirror` and `disable-mirror` for
repository management
2. Implemented handler functions for mirror enable/disable operations in
both ll-builder and ll-cli
3. Modified repo config handling to support mirrorEnabled flag as
optional boolean
4. Updated test cases to include mirrorEnabled field in test data
5. Improved repo alias handling by using value_or to fallback to
repoName when alias is not provided

These changes allow users to control mirror functionality for
repositories through CLI commands, providing more flexibility in
repository configuration. The mirrorEnabled flag is now properly handled
in the OSTree repo configuration.

feat: 为仓库添加镜像启用/禁用功能

1. 新增了用于仓库管理的`enable-mirror`和`disable-mirror` CLI命令
2. 在ll-builder和ll-cli中实现了镜像启用/禁用操作的处理函数
3. 修改了仓库配置处理以支持可选的mirrorEnabled标志
4. 更新了测试用例,在测试数据中包含mirrorEnabled字段
5. 通过使用value_or在别名未提供时回退到repoName,改进了仓库别名处理

这些变更允许用户通过CLI命令控制仓库的镜像功能,为仓库配置提供更多灵活
性。现在在OSTree仓库配置中正确处理了mirrorEnabled标志。
2025-07-10 19:28:36 +08:00
reddevillg 71ee2bd1d1 fix: improve ld.so.cache validation and regeneration
- Add content-based validation for ld.so.conf to detect layer path
  changes
- Include configuration sources hash in ld.so.conf for validation
- In PackageManager GenerateCache always generate cache,
  tryGenerateCache will skip it if cache directory exists
- use memcpy in sha256 to avoid unaligned visit

This ensures that ld.so.cache is properly regenerated when the
underlying layer configuration changes, preventing stale cache issues.

Signed-off-by: reddevillg <reddevillg@gmail.com>
2025-06-30 18:26:02 +08:00
ComixHe 6cfef1d117 fix: compiling error at UOS 20 and anolisOS
missing unistd.h

Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-06-23 10:31:41 +08:00
ComixHe b21f5968e5 feat: ll-init waits all child processes in the container
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-06-17 16:37:50 +08:00
ComixHe 19235c222b refacrtor: use our custom container init
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-06-16 17:01:03 +08:00
ComixHe 67aff2635e fix: correct the way of exporting only-app UAB
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-06-11 16:37:05 +08:00
reddevillg c6386bdfe5 feat: modify the way container patches work
1. provide application level patches
2. application level patches will apply after global patches

move configure.h.in to src root, becasue lib utils depends on QT,
we don't want to introduce QT in certain scenarios.

Signed-off-by: reddevillg <reddevillg@gmail.com>
2025-06-04 14:45:07 +08:00
ComixHe 881f0d5b1e refactor: move gvfs envs to OstreeRepo ctor
ensure that gvfs module wouldn't be loaded

Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-06-04 10:14:31 +08:00
reddevillg 01455c39f2 feat: support architecture specfied linglong.yaml
1. ll-builder use current directory as project directory.
2. Project yaml file(aka linglong.yaml) must reside within project
   directory or its subdirectories.
3. User can use -f option to specfy a project yaml file.
4. ll-builder will attempt to load project yaml file in the following
   order from the project root directory:
     - linglong.<arch>.yaml (architecture-specific)
     - linglong.yaml (generic)

Signed-off-by: reddevillg <reddevillg@gmail.com>
2025-05-29 11:19:54 +08:00
dengbo fa65a7be3c fix: layer file can not install in uos v20
Do not support lzma compressor in uos v20.
2025-05-15 19:05:28 +08:00
ice909 ca321628aa feat: add support for installing packages from specific repositories
1. Added a new --repo option to the install command to specify a
repository for installation
2. Enhanced repository management with priority-based package resolution
3. Implemented methods to get, promote and recover repository priorities
4. Updated package installation logic to respect repository selection
5. Improved error handling for module not found cases
6. Added ReferenceWithRepo struct to track package references with their
source repositories
2025-05-15 12:23:25 +08:00
ComixHe dbe988add5 style: format whole project
based on clang-format 19.1.7

Signed-off-by: ComixHe <heyuming@deepin.org>
2025-05-14 11:35:50 +08:00
dengbo 8b2d49a6f1 refactor: adjust the default display type
The default display type is changed from app to all.
2025-05-12 10:27:23 +08:00
ice909 bb3624da8e feat: enhance package search with multi-repository support
1. Added repository field to search parameters requiring specifying
repos to search
2. Modified search implementation to support searching in multiple
repositories
3. Restructured search results to group packages by repository source
4. Added --repo option to the CLI search command
5. Updated display format to show repository information in search
results
6. Improved filtering logic to work with the repository-grouped package
structure
7. Added PackageManager1PruneResult type to separate it from search
results
2025-05-09 17:05:28 +08:00
ice909 f7415b9341 fix: improve base and runtime version validation
The code now parses base and runtime fields using FuzzyReference::parse
before validating their versions, adding proper error handling for
parsing failures. This ensures that complex reference formats are
correctly handled before version validation is performed, making
the validation process more robust.
2025-05-08 16:11:03 +08:00
ice909 a9c83dbef8 refactor: implement semantic version matching
1. Added semanticMatch functionality to VersionV1, VersionV2, and
FallbackVersion classes
2. Added semanticMatching flag to clearReferenceOption struct
3. Updated clearReference implementations to use semantic version
matching
4. Modified package filtering to support semantic versioning
5. Replaced version tweak handling with more robust semantic matching
6. Enabled semantic matching in Builder, PackageManager and CLI
components

refactor: 实现语义化版本匹配

1. 为 VersionV1、VersionV2 和 FallbackVersion 类添加 semanticMatch 功能
2. 在 clearReferenceOption 结构体中添加 semanticMatching 标志
3. 更新 clearReference 实现以使用语义化版本匹配
4. 修改包过滤功能以支持语义化版本控制
5. 用更健壮的语义匹配替代版本补丁处理
6. 在 Builder、PackageManager 和 CLI 组件中启用语义化匹配
2025-05-08 15:05:32 +08:00
ice909 71a8e8041d feat: support semver sepc
Supports semver specification version numbers.
2025-05-08 15:05:32 +08:00
reddevillg 3e0a9d8ca5 feat: use ll-box in ll-builder-utils when export UAB
Signed-off-by: reddevillg <reddevillg@gmail.com>
2025-04-28 15:13:11 +08:00
ComixHe 1840243f59 refactor: fix compiling warnings
Signed-off-by: ComixHe <heyuming@deepin.org>
2025-04-24 13:53:45 +08:00
ice909 b70df3c967 fix: builder build crash when parsing version number
When writing a version number incorrectly, it should return an error and exit instead of crashing directly.

Signed-off-by: ice909 <gaochang1@uniontech.com>
2025-04-22 16:42:47 +08:00
reddevillg 06cdb32115 refactor: refactor ll-builder main function
Signed-off-by: reddevillg <reddevillg@gmail.com>
2025-04-21 16:00:57 +08:00
ComixHe ec5352d860 fix: correct container's hook
Signed-off-by: ComixHe <heyuming@deepin.org>
2025-04-16 16:50:29 +08:00
ice909 fb09ada313 feat: optimization error message
Define error codes to identify different errors.
The cli displays error information to users based on error codes.
Add -v,--verbose option to display detailed error information.

Signed-off-by: ice909 <gaochang1@uniontech.com>
2025-04-16 10:56:11 +08:00
reddevillg f32ba2cfb2 feat: add ll-builder-utils to build uab header and loader
Signed-off-by: reddevillg <reddevillg@gmail.com>
2025-04-15 10:14:35 +08:00
reddevillg b8705353a6 feat: Add output file option and improve compressor handling
Signed-off-by: reddevillg <reddevillg@gmail.com>
2025-04-15 10:14:35 +08:00
reddevillg 71fb063e1c fix: clear project working directory
Set the directory containing the YAML file as the project working
directory

Signed-off-by: reddevillg <reddevillg@gmail.com>
2025-04-14 15:21:07 +08:00
ice 5821e5c4ef
chore: update translate (#1114)
add ca、fi、pl、pt_BR、uk translates.
fix some typo.

Signed-off-by: ice909 <gaochang1@uniontech.com>
2025-04-14 14:44:09 +08:00
ComixHe 963e00d928 feat: vendoring 'dumb-init' as container init
project source: https://github.com/Yelp/dumb-init

We need an init process to forwarding signal and cleaning orphaned zombie processes.
In above cases, it is more convenent that replacing bash with dumb-init

Signed-off-by: ComixHe <heyuming@deepin.org>
2025-04-10 16:52:23 +08:00
ComixHe c5271dd5fe refactor: remove vendoring ll-box
Signed-off-by: ComixHe <heyuming@deepin.org>
2025-04-10 16:52:23 +08:00
reddevillg b67fc5c348 feat: add isolate network option for build
use --isolate-network to build in an isolated network environment
2025-04-08 10:08:43 +08:00
reddevillg 761d44f5ad refactor: make builder and pm use ContainerCfgBuiler
Make builder and pm use ContainerCfgBuiler
2025-04-08 10:08:43 +08:00
ComixHe 64277c75d0 feat(ll-box): waiting for all process within the container
Signed-off-by: ComixHe <heyuming@deepin.org>
2025-04-07 17:34:51 +08:00