From 755e1958d318b37b38123eaeba4b4b0584881811 Mon Sep 17 00:00:00 2001 From: Martchus Date: Thu, 7 Oct 2021 18:12:44 +0200 Subject: [PATCH] Allow overriding existing files in repository When `repo-add` fails but files could be copied before refusing to override is actually very annoying because one has to delete the files before restarting the build task. --- librepomgr/buildactions/conductbuild.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/librepomgr/buildactions/conductbuild.cpp b/librepomgr/buildactions/conductbuild.cpp index 4d12bc6..2e0888b 100644 --- a/librepomgr/buildactions/conductbuild.cpp +++ b/librepomgr/buildactions/conductbuild.cpp @@ -1091,17 +1091,17 @@ void ConductBuild::addPackageToRepo( auto anyRepoPath = std::filesystem::path(); const auto sourceRepoPath = std::filesystem::path(argsToString(buildResult.repoPath, "/../src/")); std::filesystem::create_directories(sourceRepoPath); - std::filesystem::copy(sourcePackagePath, sourceRepoPath / sourcePackageName, std::filesystem::copy_options::update_existing); + std::filesystem::copy(sourcePackagePath, sourceRepoPath / sourcePackageName, std::filesystem::copy_options::overwrite_existing); for (const auto &binaryPackage : binaryPackages) { if (!binaryPackage.isAny) { std::filesystem::copy( - binaryPackage.path, *buildResult.repoPath % '/' + binaryPackage.fileName, std::filesystem::copy_options::update_existing); + binaryPackage.path, *buildResult.repoPath % '/' + binaryPackage.fileName, std::filesystem::copy_options::overwrite_existing); continue; } if (anyRepoPath.empty()) { std::filesystem::create_directories(anyRepoPath = argsToString(buildResult.repoPath, "/../any")); } - std::filesystem::copy(binaryPackage.path, anyRepoPath / binaryPackage.fileName, std::filesystem::copy_options::update_existing); + std::filesystem::copy(binaryPackage.path, anyRepoPath / binaryPackage.fileName, std::filesystem::copy_options::overwrite_existing); const auto symlink = std::filesystem::path(*buildResult.repoPath % '/' + binaryPackage.fileName); if (std::filesystem::exists(symlink) && !std::filesystem::is_symlink(symlink)) { std::filesystem::remove(symlink); @@ -1178,11 +1178,11 @@ void ConductBuild::invokeGpg( "\" could not be created: ", buildDirSignaturePath, " does not exist after invoking gpg\n"); } else if (!isAny) { std::filesystem::copy(buildDirSignaturePath, *signingSession->repoPath % '/' % binaryPackageName + ".sig", - std::filesystem::copy_options::update_existing); + std::filesystem::copy_options::overwrite_existing); return; } else { std::filesystem::copy(buildDirSignaturePath, argsToString(signingSession->repoPath, "/../any/", binaryPackageName, ".sig"), - std::filesystem::copy_options::update_existing); + std::filesystem::copy_options::overwrite_existing); const auto symlink = std::filesystem::path(argsToString(signingSession->repoPath, '/', binaryPackageName, ".sig")); if (std::filesystem::exists(symlink) && !std::filesystem::is_symlink(symlink)) { std::filesystem::remove(symlink);