feat(ll-builder): add clean subcommand to remove build artifacts - #1789
feat(ll-builder): add clean subcommand to remove build artifacts#1789dengbo11 wants to merge 1 commit into
Conversation
- Add CleanCommandOptions and register `ll-builder clean` with optional `-f/--file` - Validate project location through getProjectYAMLPath before cleaning - Implement cmdCleanBuildArtifacts to fix overlay workdir permissions via makeDirectoryTreeRemovable and remove the linglong/ directory Log: Add a clean subcommand to ll-builder for removing the build-generated linglong directory and handling overlay workdir permission issues
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dengbo11 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
deepin pr auto review★ 总体评分:95分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 diff --git a/libs/linglong/src/linglong/builder/linglong_builder.cpp b/libs/linglong/src/linglong/builder/linglong_builder.cpp
index 23b98bb1d..123456789 100644
--- a/libs/linglong/src/linglong/builder/linglong_builder.cpp
+++ b/libs/linglong/src/linglong/builder/linglong_builder.cpp
@@ -2288,10 +2288,15 @@ std::string Builder::layerExportFilename(const linglong::package::Reference &ref
ref.arch.toString(),
module);
}
+
utils::error::Result<void> cmdCleanBuildArtifacts(const std::filesystem::path &workingDir) noexcept
{
LINGLONG_TRACE("clean build artifacts");
- auto linglongDir = workingDir / "linglong";
std::error_code ec;
+ // 规范化路径,消除..等相对路径成分,防止路径混淆
+ auto canonicalWorkingDir = std::filesystem::weakly_canonical(workingDir, ec);
+ if (ec) {
+ return LINGLONG_ERR(fmt::format("failed to canonicalize workingDir: {}", ec.message()));
+ }
+ auto linglongDir = canonicalWorkingDir / "linglong";
if (!std::filesystem::exists(linglongDir, ec)) {
return LINGLONG_OK; |
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
ll-builder cleanwith optional-f/--fileLog: Add a clean subcommand to ll-builder for removing the build-generated linglong directory and handling overlay workdir permission issues