From 313bcd41808ae6a1a49cde0ccb7e9c875a31a1c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= Date: Mon, 15 Jul 2024 13:06:26 +0200 Subject: [PATCH] Use `SOLVER_FLAG_FOCUS_NEW` to install latests versions of deps This is a new flag in the recent 0.7.30 release. We previously tried to use `SOLVER_FLAG_FOCUS_BEST` but it turned out to be too strong, this new flag should update packages only if it is required for installing the latests versions of dependencies. We had several reports where users expect this behavior. This should properly resolve issue such as: https://bugzilla.redhat.com/show_bug.cgi?id=2150300 https://issues.redhat.com/browse/RHEL-1374 --- dnf5.spec | 2 +- libdnf5/CMakeLists.txt | 2 +- libdnf5/rpm/solv/goal_private.cpp | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dnf5.spec b/dnf5.spec index e822a98cd..16c752a6f 100644 --- a/dnf5.spec +++ b/dnf5.spec @@ -116,7 +116,7 @@ Provides: dnf5-command(versionlock) %global libmodulemd_version 2.5.0 %global librepo_version 1.18.0 -%global libsolv_version 0.7.25 +%global libsolv_version 0.7.30 %global sqlite_version 3.35.0 %global swig_version 4 %global zchunk_version 0.9.11 diff --git a/libdnf5/CMakeLists.txt b/libdnf5/CMakeLists.txt index 398725ebc..14ecdc239 100644 --- a/libdnf5/CMakeLists.txt +++ b/libdnf5/CMakeLists.txt @@ -78,7 +78,7 @@ if (WITH_MODULEMD) target_link_libraries(libdnf5_static PRIVATE ${LIBMODULEMD_LIBRARIES}) endif() -pkg_check_modules(LIBSOLV REQUIRED libsolv>=0.7.25) +pkg_check_modules(LIBSOLV REQUIRED libsolv>=0.7.30) list(APPEND LIBDNF5_PC_REQUIRES "${LIBSOLV_MODULE_NAME}") target_link_libraries(libdnf5 PRIVATE ${LIBSOLV_LIBRARIES}) target_link_libraries(libdnf5_static PRIVATE ${LIBSOLV_LIBRARIES}) diff --git a/libdnf5/rpm/solv/goal_private.cpp b/libdnf5/rpm/solv/goal_private.cpp index 3a8c16fa5..30531982b 100644 --- a/libdnf5/rpm/solv/goal_private.cpp +++ b/libdnf5/rpm/solv/goal_private.cpp @@ -412,6 +412,9 @@ libdnf5::GoalProblem GoalPrivate::resolve() { libsolv_solver.set_flag(SOLVER_FLAG_ALLOW_VENDORCHANGE, vendor_change); libsolv_solver.set_flag(SOLVER_FLAG_DUP_ALLOW_VENDORCHANGE, vendor_change); + // Ensure the solver tries to install the latest versions of dependencies, even if it results in a bigger transaction + libsolv_solver.set_flag(SOLVER_FLAG_FOCUS_NEW, 1); + if (libsolv_solver.solve(job)) { return libdnf5::GoalProblem::SOLVER_ERROR; }