From 80479dd22dc6d74285805d705a17fe7dfb7877b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= Date: Tue, 9 Apr 2024 09:35:51 +0200 Subject: [PATCH] Fix `DISTRO_SYNC_ALL` (distro-sync without arguments, system upgrade) Since distro-sync uses `SOLVER_TARGETED` mode we cannot pass in installed packages because if we did updating only a subset of packages would be a valid solution. However in a distro-sync we want to ensure ALL packages are synchronized with the target repository. This brings dnf5 behavior closer to dnf4. There is still one difference in the transaction setup, dnf4 doesn't specify the transaction as targeted but thanks to libsolv's `auto-targeting` this should have the same behavior. For: https://bugzilla.redhat.com/show_bug.cgi?id=2273749 --- libdnf5/base/goal.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libdnf5/base/goal.cpp b/libdnf5/base/goal.cpp index 71011b53d..7ba84b466 100644 --- a/libdnf5/base/goal.cpp +++ b/libdnf5/base/goal.cpp @@ -527,6 +527,10 @@ GoalProblem Goal::Impl::add_specs_to_goal(base::Transaction & transaction) { } break; case GoalAction::DISTRO_SYNC_ALL: { rpm::PackageQuery query(base); + // Since distro-sync uses SOLVER_TARGETED mode we cannot pass in installed packages because if we did + // updating only a subset of packages would be a valid solution. However in a distro-sync we want to + // ensure ALL packages are synchronized with the target repository. + query.filter_available(); libdnf5::solv::IdQueue upgrade_ids; for (auto package_id : *query.p_impl) { upgrade_ids.push_back(package_id);