Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions libdnf/goal/Goal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,6 @@ Goal::describeProblemRules(unsigned i, bool pkgs)
auto problem = pImpl->describeProtectedRemoval();
if (!problem.empty()) {
output.push_back(std::move(problem));
return output;
}
auto solv = pImpl->solv;

Expand Down Expand Up @@ -1753,11 +1752,11 @@ Goal::Impl::protectedInRemovals()
std::string
Goal::Impl::describeProtectedRemoval()
{
std::string message(_("The operation would result in removing"
" the following protected packages: "));
Pool * pool = solv->pool;

if (removalOfProtected && removalOfProtected->size()) {
const std::string removal_message(_("The operation would result in removing "
"the following protected packages: "));
Id id = -1;
std::vector<const char *> names;
while((id = removalOfProtected->next(id)) != -1) {
Expand All @@ -1767,9 +1766,13 @@ Goal::Impl::describeProtectedRemoval()
if (names.empty()) {
return {};
}
return message + std::accumulate(std::next(names.begin()), names.end(),
std::string(names[0]), [](std::string a, std::string b) { return a + ", " + b; });
return removal_message +
std::accumulate(std::next(names.begin()), names.end(), std::string(names[0]),
[](std::string a, std::string b) { return a + ", " + b; });
}

const std::string broken_dependency_message(_("The operation would result in broken "
"dependencies for the following protected packages: "));
auto pset = brokenDependencyAllPkgs(DNF_PACKAGE_STATE_INSTALLED);
Id id = -1;
Id protected_kernel = protectedRunningKernel();
Expand All @@ -1782,8 +1785,9 @@ Goal::Impl::describeProtectedRemoval()
}
if (names.empty())
return {};
return message + std::accumulate(std::next(names.begin()), names.end(), std::string(names[0]),
[](std::string a, std::string b) { return a + ", " + b; });
return broken_dependency_message +
std::accumulate(std::next(names.begin()), names.end(), std::string(names[0]),
[](std::string a, std::string b) { return a + ", " + b; });
}

}