Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use SOLVER_FLAG_FOCUS_NEW to install latests versions of deps #1582

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ option(WITH_MODULEMD "Build with modulemd modules support" ON)
option(WITH_ZCHUNK "Build with zchunk delta compression support" ON)
option(WITH_SYSTEMD "Build with systemd and D-Bus features" ON)
option(ENABLE_SOLV_URPMREORDER "Build with support for URPM-like solution reordering?" OFF)
option(ENABLE_SOLV_FOCUSNEW "Build with SOLVER_FLAG_FOCUS_NEW libsolv flag enabled to ensure new dependencies are installed in latests versions?" ON)

# build options - documentation
option(WITH_HTML "Build HTML documentation" ON)
Expand Down Expand Up @@ -106,6 +107,9 @@ add_definitions(-DPROJECT_VERSION_MICRO=${VERSION_MICRO})
if(ENABLE_SOLV_URPMREORDER)
add_definitions(-DLIBSOLV_FLAG_URPMREORDER=1)
endif()
if(ENABLE_SOLV_FOCUSNEW)
add_definitions(-DLIBSOLV_FLAG_FOCUSNEW=1)
endif()

if(WITH_SANITIZERS)
message(WARNING "Building with sanitizers enabled!")
Expand Down
15 changes: 14 additions & 1 deletion dnf5.spec
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ Provides: dnf5-command(versionlock)
%bcond_with performance_tests
%bcond_with dnf5daemon_tests

# Disable SOLVER_FLAG_FOCUS_NEW only for RHEL
%if 0%{?rhel} && 0%{?rhel} < 10
%bcond_with focus_new
%else
%bcond_without focus_new
%endif

%if %{with clang}
%global toolchain clang
%endif
Expand All @@ -116,7 +123,11 @@ Provides: dnf5-command(versionlock)

%global libmodulemd_version 2.5.0
%global librepo_version 1.18.0
%global libsolv_version 0.7.25
%if %{with focus_new}
%global libsolv_version 0.7.30
%else
%global libsolv_version 0.7.25
%endif
%global sqlite_version 3.35.0
%global swig_version 4
%global zchunk_version 0.9.11
Expand Down Expand Up @@ -769,6 +780,8 @@ automatically and regularly from systemd timers, cron jobs or similar.
-DPACKAGE_VERSION=%{version} \
-DPERL_INSTALLDIRS=vendor \
\
-DENABLE_SOLV_FOCUSNEW=%{?focus_new:ON}%{!?focus_new:OFF} \
\
-DWITH_DNF5DAEMON_CLIENT=%{?with_dnf5daemon_client:ON}%{!?with_dnf5daemon_client:OFF} \
-DWITH_DNF5DAEMON_SERVER=%{?with_dnf5daemon_server:ON}%{!?with_dnf5daemon_server:OFF} \
-DWITH_LIBDNF5_CLI=%{?with_libdnf_cli:ON}%{!?with_libdnf_cli:OFF} \
Expand Down
6 changes: 5 additions & 1 deletion libdnf5/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ if (WITH_MODULEMD)
target_link_libraries(libdnf5_static PRIVATE ${LIBMODULEMD_LIBRARIES})
endif()

pkg_check_modules(LIBSOLV REQUIRED libsolv>=0.7.25)
if (ENABLE_SOLV_FOCUSNEW)
pkg_check_modules(LIBSOLV REQUIRED libsolv>=0.7.30)
else()
pkg_check_modules(LIBSOLV REQUIRED libsolv>=0.7.25)
endif()
list(APPEND LIBDNF5_PC_REQUIRES "${LIBSOLV_MODULE_NAME}")
target_link_libraries(libdnf5 PRIVATE ${LIBSOLV_LIBRARIES})
target_link_libraries(libdnf5_static PRIVATE ${LIBSOLV_LIBRARIES})
Expand Down
6 changes: 6 additions & 0 deletions libdnf5/rpm/solv/goal_private.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,12 @@ 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);

#if defined(LIBSOLV_FLAG_FOCUSNEW)
// Ensure the solver tries to install the latest versions of dependencies, even if it results in a bigger transaction
// Available since libsolv-0.7.30
libsolv_solver.set_flag(SOLVER_FLAG_FOCUS_NEW, 1);
#endif

if (libsolv_solver.solve(job)) {
return libdnf5::GoalProblem::SOLVER_ERROR;
}
Expand Down
Loading