From b9880e8ecdce02f047dfb1d19de5f1ed07a82ac6 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Fri, 8 Jul 2022 10:29:05 +0200 Subject: In install-cas be more liberal in parsing artifact identifiers --- src/buildtool/main/main.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/buildtool/main/main.cpp') diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index e3c1385a..4c977955 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -1160,32 +1160,28 @@ void ReportTaintedness(const AnalysisResult& result) { [[nodiscard]] auto FetchAndInstallArtifacts( gsl::not_null const& api, FetchArguments const& clargs) -> bool { - auto object_info = Artifact::ObjectInfo::FromString(clargs.object_id); - if (not object_info) { - Logger::Log( - LogLevel::Error, "failed to parse object id {}.", clargs.object_id); - return false; - } + auto object_info = + Artifact::ObjectInfo::LiberalFromString(clargs.object_id); if (clargs.output_path) { auto output_path = (*clargs.output_path / "").parent_path(); if (FileSystemManager::IsDirectory(output_path)) { - output_path /= object_info->digest.hash(); + output_path /= object_info.digest.hash(); } if (not FileSystemManager::CreateDirectory(output_path.parent_path()) or - not api->RetrieveToPaths({*object_info}, {output_path})) { + not api->RetrieveToPaths({object_info}, {output_path})) { Logger::Log(LogLevel::Error, "failed to retrieve artifact."); return false; } Logger::Log(LogLevel::Info, "artifact {} was installed to {}", - object_info->ToString(), + object_info.ToString(), output_path.string()); } else { // dump to stdout - if (not api->RetrieveToFds({*object_info}, {dup(fileno(stdout))})) { + if (not api->RetrieveToFds({object_info}, {dup(fileno(stdout))})) { Logger::Log(LogLevel::Error, "failed to dump artifact."); return false; } -- cgit v1.2.3