summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/other_tools/ops_maps/repo_fetch_map.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/other_tools/ops_maps/repo_fetch_map.cpp b/src/other_tools/ops_maps/repo_fetch_map.cpp
index 274124a1..e0ff438e 100644
--- a/src/other_tools/ops_maps/repo_fetch_map.cpp
+++ b/src/other_tools/ops_maps/repo_fetch_map.cpp
@@ -51,13 +51,20 @@ auto CreateRepoFetchMap(gsl::not_null<ContentCASMap*> const& content_cas_map,
auto content_path =
casf.BlobPath(ArtifactDigest(content, 0, false));
if (content_path) {
- if (not FileSystemManager::CopyFile(
- *content_path, fetch_dir / distfile)) {
+ auto target_name = fetch_dir / distfile;
+ if (FileSystemManager::Exists(target_name)) {
+ std::filesystem::permissions(
+ target_name,
+ std::filesystem::perms::owner_write,
+ std::filesystem::perm_options::add);
+ }
+ if (not FileSystemManager::CopyFile(*content_path,
+ target_name)) {
(*logger)(fmt::format(
"Failed to copy content {} from CAS "
- "into fetch directory {}",
+ "to {}",
content,
- fetch_dir.string()),
+ target_name.string()),
/*fatal=*/true);
return;
}
@@ -87,12 +94,19 @@ auto CreateRepoFetchMap(gsl::not_null<ContentCASMap*> const& content_cas_map,
auto content_path =
casf.BlobPath(ArtifactDigest(key.archive.content, 0, false));
if (content_path) {
+ auto target_name = fetch_dir / distfile;
+ if (FileSystemManager::Exists(target_name)) {
+ std::filesystem::permissions(
+ target_name,
+ std::filesystem::perms::owner_write,
+ std::filesystem::perm_options::add);
+ }
if (not FileSystemManager::CopyFile(*content_path,
- fetch_dir / distfile)) {
+ target_name)) {
(*logger)(fmt::format("Failed to copy content {} from CAS "
- "into fetch directory {}",
+ "to {}",
key.archive.content,
- fetch_dir.string()),
+ target_name.string()),
/*fatal=*/true);
return;
}
@@ -108,4 +122,4 @@ auto CreateRepoFetchMap(gsl::not_null<ContentCASMap*> const& content_cas_map,
}
};
return AsyncMapConsumer<ArchiveRepoInfo, bool>(fetch_repo, jobs);
-} \ No newline at end of file
+}