Handle signature cleanup alongside related package even if package symlink broken

This commit is contained in:
Martchus 2021-04-27 17:06:47 +02:00
parent f621a87812
commit 12050364c8
1 changed files with 3 additions and 2 deletions

View File

@ -710,7 +710,8 @@ void CleanRepository::run()
// delete orphaned signatures, otherwise skip signatures as they are handled alongside the related package // delete orphaned signatures, otherwise skip signatures as they are handled alongside the related package
if (fileName.ends_with(".sig")) { if (fileName.ends_with(".sig")) {
if (!std::filesystem::exists(dirInfo.canonicalPath / std::string_view(fileName.data(), fileName.data() + fileName.size() - 4))) { if (!std::filesystem::exists(std::filesystem::symlink_status(
dirInfo.canonicalPath / std::string_view(fileName.data(), fileName.data() + fileName.size() - 4)))) {
dirInfo.toDelete.emplace_back(fileName); dirInfo.toDelete.emplace_back(fileName);
} }
continue; continue;
@ -733,7 +734,7 @@ void CleanRepository::run()
// check whether the file is still referenced by and relevant database and move it to archive if not // check whether the file is still referenced by and relevant database and move it to archive if not
auto fileStillReferenced = false; auto fileStillReferenced = false;
std::vector<std::string_view> actuallyReferencedFileNames; auto actuallyReferencedFileNames = std::vector<std::string_view>();
for (const auto *const db : dirInfo.relevantDbs) { for (const auto *const db : dirInfo.relevantDbs) {
const auto i = db->packages.find(packageName); const auto i = db->packages.find(packageName);
if (i == db->packages.end()) { if (i == db->packages.end()) {