Commit Graph

117 Commits

Author SHA1 Message Date
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
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
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
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 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
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 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
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
dengbo11 4c66ed5a85 feat(cli): ll-cli add dir sub command
ll-cli add dir sub command to support get layer director by appid.
2025-03-04 09:59:10 +08:00
ComixHe d7cea3443a refactor: optimize starting container
Signed-off-by: ComixHe <heyuming@deepin.org>
2025-02-27 19:42:27 +08:00
ice909 c8d3330c9c feat: add priority to the repo config
The default priority for the stable repository is 0.
When adding a new repository, its priority will be set to the current minimum priority minus 100.
If the new repository is set as the default repository, its priority will be set to the current maximum priority plus 100.
Added the set-priority subcommand to allow manual specification of priorities (duplicates are not allowed).
2025-02-25 14:23:22 +08:00
ice909 0283ea34f4 fix: ll-cli outputs --help info instead of --help-all
This commit ensures that `ll-cli` now outputs the standard `--help` information when no arguments are provided, aligning with common CLI conventions.
The `--help-all` option remains available for users who need expanded details.
2025-02-20 14:09:12 +08:00
ice909 fa51411213 feat: add translations for all titles
ll-cli list and search remove arch field.
2025-02-19 16:51:54 +08:00
ice909 1148261f8c fix: can't search after adding repo using alias
OSTree still uses defaultRepo, but defaultRepo has now become an alias.
2025-02-18 11:42:53 +08:00
ice909 ae7beb907f feat: filter search results to show only latest versions by default
Added a new `--all` flag to the search command to display all versions of packages.
By default, search results will only show the latest version of each package.
2025-02-13 20:56:31 +08:00
ice909 4b3fed1f00 feat: add --alias option for repo add
Add the --alias option to set aliases for the 'll-cli repo add' and 'll-builder repo add' commands.

So update, remove, and set-default also need to pass alias instead of name.
2025-02-13 20:29:24 +08:00
ComixHe a233980823 feat: support kill container by specific signal
Signed-off-by: ComixHe <heyuming@deepin.org>
2025-02-12 16:23:05 +08:00
ComixHe d393cf3ed5 fix: make option accepts empty container
Signed-off-by: ComixHe <heyuming@deepin.org>
2025-02-07 18:14:50 +08:00
ComixHe bef4a49985 feat(ll-cli): add subcommand 'inspect'
Signed-off-by: ComixHe <heyuming@deepin.org>
2025-01-20 05:41:29 +00:00
Comix 27ea143990
refactor: only create runtime directory before container running (#965)
Signed-off-by: ComixHe <heyuming@deepin.org>
2025-01-16 16:12:01 +08:00
ComixHe e1c9652009 fix: Correcting file mappings when there is no file path passing
Signed-off-by: ComixHe <heyuming@deepin.org>
2024-12-24 17:47:57 +08:00
myml 0b7d27fc0b fix: getRemoteModuleList for incompatibility with runtime modules
获取远程模块列表时, 应该考虑兼容旧版本的runtime modules
优化安装和升级流程, 只安装单个模块时, 不需要提前获取远程模块列表
2024-12-20 10:39:18 +08:00
ComixHe 851e178d3f refactor: move migrating process to ll-package-manager
Signed-off-by: ComixHe <heyuming@deepin.org>
2024-11-26 14:27:39 +08:00
dengbo11 db54a5f645 fix(cli): ll-cli kill can not stop app by reference
1. Compatible with old versions to stop running app container using fuzz reference.
2. Only support enter running app container by fuzz reference.
2024-11-23 17:24:25 +08:00
dengbo11 e6aea9d998 feat(cli): support kill or enter container by appid
Support kill or enter application by appid.
2024-11-22 17:20:22 +08:00
ComixHe 57ea9cb404 feat: filepathMapping supports multiple files or urls
Signed-off-by: ComixHe <heyuming@deepin.org>
2024-11-22 15:15:50 +08:00
ComixHe 7a45551fd9 refactor(migrate): try to migrate builder repo
Signed-off-by: ComixHe <heyuming@deepin.org>
2024-11-21 17:34:58 +08:00
myml 4bea611f7b feat: re-export all application entries after migrate
在迁移后重新导出所有应用的entries, 避免数据残留影响功能
2024-11-21 16:55:36 +08:00
dengbo11 ce9545dd78 fix(ll-cli): cli sub command will error when use --json flag
Use fallthrough to allow list,search,info,content sub command to support --json flags.
2024-11-21 14:52:18 +08:00
dengbo11 124bc72721 fix(cli): add some options back for compatibility
--prune and --all options should be provided for compatibility with older command line parsing.

Bug: https://pms.uniontech.com/bug-view-288097.html
2024-11-20 17:16:00 +08:00
ComixHe ca4f8bc7c7 refactor: re-implement migrate
Signed-off-by: ComixHe <heyuming@deepin.org>
2024-11-19 17:46:22 +08:00
kamiyadm c9d59d653d fix: adjust error output level
-

Log:
2024-11-14 17:17:33 +08:00
dengbo11 2d561fcab3 fix: subcommand help information display error
Subcommand should add usage, or will inherited the parent command.
2024-11-13 11:30:23 +08:00
dengbo11 dc2c18ee73 chore: code clear
Old command is not use, delete it.
2024-11-12 15:48:28 +08:00
dengbo11 71fe2c0e4b feat(cli): cli version support json format output
Cli version add json format output.
2024-11-12 15:48:28 +08:00
kamiyadm 06cd6d955e fix: cli returned if no avilable notifier
Fallback to DummyNotifier if no avilable notifier.

Log:
2024-11-11 17:07:59 +08:00
kamiyadm 7d848ab3a5 fix: some buildflag has uncertain value
Fully initialize those options.

Log:
2024-11-07 09:56:12 +08:00
dengbo11 f9ae16f25d feat(builder): linglong builder help information internationalization
Add ll-builder chinese, en_US, en_GB and spanish help information.
2024-11-06 18:16:45 +08:00
kamiyadm 97e0898bbf fix: can not do the migration
* If there need migrate and the current operation is
  not 'll-cli migrate', notify the message.
* Call runningAsRoot() before call migrate().

Log:
2024-11-06 10:43:11 +08:00
dengbo11 583ad9d024 feat(cli): linglong cli help information internationalization
Add ll-cli chinese and spanish help information.
2024-11-05 20:12:08 +08:00
kamiyadm c482eef998 fix(ll-cli): used a moved object
-

Log:
2024-11-05 20:10:10 +08:00