Replaces command-based initialization of the logging system with
an explicit backend parameter, simplifying configuration logic
and improving maintainability.
Removes redundant code that inferred the log backend from
command names. Updates all affected components to pass the
appropriate backend directly when initializing the log system.
Refactors the interaction with remote repositories to clarify the code's
intent.
Key changes include:
- Introduce `ClientAPIWrapper` to encapsulate the generated C-style API
client.
- The remote package searching function is renamed from `listRemote` to
`searchRemote` to better reflect its purpose.
- The `pull` method now requires an explicit repo argument.
- add `getPrioritySortedRepos` and `getPriorityGroupedRepos` helpers.
Co-authored-by: reddevillg <reddevillg@gmail.com>
Signed-off-by: reddevillg <reddevillg@gmail.com>
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
The error handling implementation has been simplified by removing Qt
dependencies from the core error module. The ErrorImpl class now uses
std::string instead of QString for message storage and formatting. This
makes the error module more portable and reduces dependencies on Qt.
The error message output in main.cpp has been updated to directly use
the std::string message without unnecessary conversion to std::string
via toStdString() since the message() method now returns std::string
directly.
Additionally, the test files have been reorganized - the result_test.cpp
has been removed and its content merged into a new error_test.cpp file
with expanded test coverage. The new tests cover more error scenarios
including standard error codes and Qt file errors.
Log: Improved error handling and testing infrastructure
Influence:
1. Test repository operations (add/remove/update/set-default/enable-
mirror/disable-mirror) to verify error messages are displayed correctly
2. Run the updated error tests to ensure all error scenarios are
properly handled
3. Verify error messages contain relevant context information when
operations fail
4. Check that error handling works consistently across different error
types
重构:简化错误处理并改进测试
错误处理实现已通过从核心错误模块中移除 Qt 依赖项得到简化。ErrorImpl 类
现在使用 std::string 而不是 QString 进行消息存储和格式化。这使得错误模
块更具可移植性并减少了对 Qt 的依赖。main.cpp 中的错误消息输出已更新为直
接使用 std::string 消息,无需通过 toStdString() 进行不必要的转换,因为
message() 方法现在直接返回 std::string。
此外,测试文件已重新组织 - result_test.cpp 已被删除,其内容已合并到新的
error_test.cpp 文件中,并扩展了测试覆盖范围。新测试涵盖了更多错误场景,
包括标准错误代码和 Qt 文件错误。
Log: 改进错误处理和测试基础设施
影响:
1. 测试仓库操作(添加/删除/更新/设置默认/启用镜像/禁用镜像)以验证错误消
息是否正确显示
2. 运行更新后的错误测试以确保所有错误场景得到正确处理
3. 验证操作失败时错误消息包含相关上下文信息
4. 检查错误处理在不同错误类型间的一致性
Changed error handling system to use std::string instead of QString
for trace messages to improve performance and reduce unnecessary string
conversions. The LINGLONG_TRACE macro now directly stores the message
as std::string without complex type detection logic. All error creation
methods have been updated to accept std::string for trace messages and
handle string concatenation more efficiently.
This refactoring eliminates the need for QString conversions when
working with standard C++ strings, reducing overhead in error handling
paths. The changes maintain backward compatibility while improving type
consistency throughout the error system.
Influence:
1. Verify error messages are correctly formatted and displayed
2. Test error handling with various string types (QString, std::string,
const char*)
3. Confirm trace functionality works correctly in different scenarios
4. Check that existing error reporting mechanisms continue to function
properly
5. Validate that no string conversion errors occur during error
propagation
refactor: 使用 std::string 进行错误追踪
将错误处理系统中的跟踪消息从 QString 改为 std::string,以提高性能并减少
不必要的字符串转换。LINGLONG_TRACE 宏现在直接以 std::string 存储消息,无
需复杂的类型检测逻辑。所有错误创建方法都已更新为接受 std::string 类型的
跟踪消息,并更高效地处理字符串连接。
此次重构消除了在处理标准 C++ 字符串时进行 QString 转换的需求,减少了错误
处理路径的开销。这些更改在提高类型一致性的同时保持了向后兼容性。
Influence:
1. 验证错误消息格式正确且显示正常
2. 测试使用各种字符串类型(QString、std::string、const char*)的错误处理
3. 确认跟踪功能在不同场景下正常工作
4. 检查现有的错误报告机制是否继续正常运行
5. 验证在错误传播过程中不会发生字符串转换错误
Refactors file and directory handling within the builder, replacing
Qt-based implementations with the modern C++ standard library.
Key changes include:
- Removed support for the deprecated `$appid.install` file. Its presence
now causes a build error to enforce the `modules` definition in the
project configuration.
- Introduced `utils::moveFiles`, a new utility function that centralizes
the logic for moving directory contents based on a flexible matcher
predicate.
- Simplified the handling of the default `binary` and `develop` modules.
The `binary` module now defaults to a "catch-all" rule (`/`) if not
explicitly defined by the user.
- Added unit tests for the new `utils::moveFiles` function and the
refactored `installModule` logic.
Signed-off-by: reddevillg <reddevillg@gmail.com>
1. Deprecated QString-based toString() method in favor of toStdString()
2. Changed getTriplet() return type from QString to std::string
3. Added comprehensive unit tests for architecture handling
4. Improved error handling with std::optional and exceptions
5. Added test coverage for all supported architectures and edge cases
The changes were made to:
1. Reduce Qt dependencies in core functionality
2. Improve performance by avoiding QString conversions
3. Provide better type safety with std::string
4. Enhance testability with comprehensive unit tests
5. Prepare for future cross-platform compatibility
Log: Architecture string handling now uses std::string instead of
QString
Influence:
1. Test all architecture-related functionality with various inputs
2. Verify backward compatibility with existing code using toString()
3. Check error handling with invalid architecture strings
4. Validate cross-platform behavior on different CPU architectures
5. Test performance impact of string conversions
refactor: 将架构字符串处理迁移到 std::string
1. 弃用基于 QString 的 toString() 方法,改用 toStdString()
2. 将 getTriplet() 返回类型从 QString 改为 std::string
3. 添加了全面的架构处理单元测试
4. 使用 std::optional 和异常改进了错误处理
5. 增加了对所有支持架构和边界情况的测试覆盖
这些修改是为了:
1. 减少核心功能对 Qt 的依赖
2. 通过避免 QString 转换提高性能
3. 使用 std::string 提供更好的类型安全
4. 通过全面的单元测试增强可测试性
5. 为未来的跨平台兼容性做准备
Log: 架构字符串处理现在使用 std::string 替代 QString
Influence:
1. 使用各种输入测试所有架构相关功能
2. 验证与现有使用 toString() 代码的向后兼容性
3. 检查无效架构字符串的错误处理
4. 在不同 CPU 架构上验证跨平台行为
5. 测试字符串转换的性能影响
Key changes include:
- The `Builder` and `OverlayFS` classes now store and operate on
`std::filesystem::path` objects.
- A new utility function `utils::copyDirectory` is introduced to handle
recursive directory copying with filtering.
Signed-off-by: reddevillg <reddevillg@gmail.com>
Previously, a simple `unshare` call was made deep within the builder
logic. This approach was brittle and has been replaced by a re-execution
execution pattern at the application entry point.
The new implementation consists of:
- A check (`needRunInNamespace`) at startup to determine if the process
has sufficient capabilities (`CAP_SYS_ADMIN`).
- If not, the application re-launches itself in a new user and mount
namespace using `clone(CLONE_NEWNS | CLONE_NEWUSER)`.
- The parent process configures UID and GID mappings for the child using
the external `newuidmap` and `newgidmap` tools. This maps the current
user to root inside the new namespace and includes any subordinate
UIDs/GIDs.
- The container configuration for build stages is updated to run within
this parent namespace. It no longer creates a nested user namespace
but instead operates with a specific, limited set of capabilities.
This change introduces a runtime dependency on the `newuidmap` and
`newgidmap` utilities, which are typically provided by the `uidmap`
package.
Signed-off-by: reddevillg <reddevillg@gmail.com>
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. 测试空应用程序列表的边界情况
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>
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>
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标志。
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>
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>
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.
When writing a version number incorrectly, it should return an error and exit instead of crashing directly.
Signed-off-by: ice909 <gaochang1@uniontech.com>
Option --loader=<app_loader> can be used to run app without container
involved. With custom loader, only app's layer will be exported. When
custom loader get started, environment variable LINGLONG_UAB_APPROOT
is the app directory.
Provide "build depends" and "depends" for apt build extension, build
phase seperate into build phase and prepare phase. "build depends"
to be installed in build environment before build phase starting, and
preserve in overlayfs. "depends" to be installed in prepare phase, and
will be merged to apps output.
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.