From 2d9df1c43b0b2f7027a6366dc1d64c0e646d1e2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= Date: Mon, 7 Aug 2023 09:25:32 +0200 Subject: [PATCH] Use focusbest: prefer latest deps versions over smaller transactions This requires `libsolv-0.7.25` because it contains a fix for weak deps issue that manifested when `focusbest` was used. --- 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 2db224d39..2a5183794 100644 --- a/dnf5.spec +++ b/dnf5.spec @@ -104,7 +104,7 @@ Provides: dnf5-command(makecache) %global libmodulemd_version 2.5.0 %global librepo_version 1.15.0 -%global libsolv_version 0.7.21 +%global libsolv_version 0.7.25 %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 5cbe7115a..ddcee4fa0 100644 --- a/libdnf5/CMakeLists.txt +++ b/libdnf5/CMakeLists.txt @@ -51,7 +51,7 @@ pkg_check_modules(LIBMODULEMD REQUIRED modulemd-2.0>=2.11.2) list(APPEND LIBDNF5_PC_REQUIRES "${LIBMODULEMD_MODULE_NAME}") target_link_libraries(libdnf5 PRIVATE ${LIBMODULEMD_LIBRARIES}) -pkg_check_modules(LIBSOLV REQUIRED libsolv>=0.7.21) +pkg_check_modules(LIBSOLV REQUIRED libsolv>=0.7.25) list(APPEND LIBDNF5_PC_REQUIRES "${LIBSOLV_MODULE_NAME}") target_link_libraries(libdnf5 PRIVATE ${LIBSOLV_LIBRARIES}) diff --git a/libdnf5/rpm/solv/goal_private.cpp b/libdnf5/rpm/solv/goal_private.cpp index 188087a5b..facf25cb8 100644 --- a/libdnf5/rpm/solv/goal_private.cpp +++ b/libdnf5/rpm/solv/goal_private.cpp @@ -407,6 +407,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 use the latest versions of dependencies, even if it results in a bigger transaction + libsolv_solver.set_flag(SOLVER_FLAG_FOCUS_BEST, 1); + if (libsolv_solver.solve(job)) { return libdnf5::GoalProblem::SOLVER_ERROR; }