Goal::Impl::add_specs_to_goal: Skip processing of empty query in *ALL*

The actions UPGRADE_ALL, UPGRADE_ALL_MINIMAL, and DISTRO_SYNC_ALL
unnecessarily processed an empty queries, creating an empty IdQueue and
passing it to the functions `rpm_goal.add_upgrade` and
`rpm_goal.add_distro_sync`.
This commit is contained in:
Jaroslav Rohel 2025-07-13 23:54:20 +02:00
parent 9ebdbce965
commit 64f223b9ab
1 changed files with 8 additions and 0 deletions

View File

@ -612,6 +612,10 @@ GoalProblem Goal::Impl::add_specs_to_goal(base::Transaction & transaction) {
}
}
if (query.empty()) {
return GoalProblem::NO_PROBLEM;
}
// Make the smallest possible upgrade
if (action == GoalAction::UPGRADE_ALL_MINIMAL) {
query.filter_earliest_evr();
@ -637,6 +641,10 @@ GoalProblem Goal::Impl::add_specs_to_goal(base::Transaction & transaction) {
query.filter_repo_id(settings.get_to_repo_ids(), sack::QueryCmp::GLOB);
}
if (query.empty()) {
return GoalProblem::NO_PROBLEM;
}
libdnf5::solv::IdQueue upgrade_ids;
for (auto package_id : *query.p_impl) {
upgrade_ids.push_back(package_id);