Skip to content

Commit 513a4c4

Browse files
committed
Record the archive file in FetcherContext
When a file is extracted from an archive, record the name of the archive and the path within the archive where it was stored. Bug: b/461888155
1 parent d9211c3 commit 513a4c4

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

base/cvd/cuttlefish/host/commands/cvd/fetch/fetch_context.cc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ Result<void> FetchArtifact::ExtractOneTo(const std::string& member_name,
134134

135135
CF_EXPECT(ExtractFile(*zip, member_name, extract_path));
136136

137-
CF_EXPECT(fetch_build_context_.AddFileToConfig(extract_path));
137+
CF_EXPECT(fetch_build_context_.AddFileToConfig(extract_path, artifact_name_,
138+
local_path));
138139

139140
std::string phase =
140141
fmt::format("Extracted '{}' from '{}'", member_name, artifact_name_);
@@ -207,12 +208,15 @@ Result<void> FetchBuildContext::DesparseFiles(std::vector<std::string> files) {
207208
return {};
208209
}
209210

210-
Result<void> FetchBuildContext::AddFileToConfig(std::string file) {
211+
Result<void> FetchBuildContext::AddFileToConfig(std::string file,
212+
std::string archive_name,
213+
std::string archive_path) {
211214
auto [build_id, build_target] = GetBuildIdAndTarget(build_);
212215

213216
CvdFile config_member = CF_EXPECT(BuildFetcherConfigMember(
214217
file_source_, std::move(build_id), std::move(build_target),
215-
std::move(file), fetch_context_.target_directories_.root));
218+
std::move(file), fetch_context_.target_directories_.root,
219+
std::move(archive_name), std::move(archive_path)));
216220

217221
CF_EXPECT(fetch_context_.fetcher_config_.add_cvd_file(
218222
std::move(config_member), /* override_entry = */ true));

base/cvd/cuttlefish/host/commands/cvd/fetch/fetch_context.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ class FetchBuildContext {
9595

9696
Result<void> DesparseFiles(std::vector<std::string> files);
9797

98-
Result<void> AddFileToConfig(std::string);
98+
Result<void> AddFileToConfig(std::string file, std::string archive_name = "",
99+
std::string archive_path = "");
99100

100101
class FetchContext& fetch_context_;
101102
::cuttlefish::Build build_;

0 commit comments

Comments
 (0)