diff --git a/VERSION.cmake b/VERSION.cmake index 19de133a8e..4dcc11052a 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -1,5 +1,5 @@ set (DEFAULT_LIBDNF_MAJOR_VERSION 0) -set (DEFAULT_LIBDNF_MINOR_VERSION 64) +set (DEFAULT_LIBDNF_MINOR_VERSION 65) set (DEFAULT_LIBDNF_MICRO_VERSION 0) if(DEFINED LIBDNF_MAJOR_VERSION) diff --git a/libdnf.spec b/libdnf.spec index 4fe3b58412..697911f0b9 100644 --- a/libdnf.spec +++ b/libdnf.spec @@ -4,7 +4,7 @@ %global dnf_conflict 4.3.0 %global swig_version 3.0.12 %global libdnf_major_version 0 -%global libdnf_minor_version 64 +%global libdnf_minor_version 65 %global libdnf_micro_version 0 %define __cmake_in_source_build 1 diff --git a/libdnf/dnf-goal.cpp b/libdnf/dnf-goal.cpp index b877eacade..89fbae0c10 100644 --- a/libdnf/dnf-goal.cpp +++ b/libdnf/dnf-goal.cpp @@ -48,6 +48,26 @@ #include +static void set_excludes_from_weak_to_goal(HyGoal goal) +{ + DnfSack * sack = hy_goal_get_sack(goal); + + goal->reset_exclude_from_weak(); + + const auto & exclude_from_weak_autodetect = libdnf::getGlobalMainConfig().exclude_from_weak_autodetect().getValue(); + if (exclude_from_weak_autodetect) { + goal->exclude_from_weak_autodetect(); + } + + const auto & exclude_from_weak = libdnf::getGlobalMainConfig().exclude_from_weak().getValue(); + + for (auto & exclude : exclude_from_weak) { + libdnf::Query query(sack); + auto ret = query.filterSubject(exclude.c_str(), nullptr, false, true, false, false); + goal->add_exclude_from_weak(*query.getResultPset()); + } +} + /** * dnf_goal_depsolve: * @goal: a #HyGoal. @@ -80,6 +100,8 @@ dnf_goal_depsolve(HyGoal goal, DnfGoalActions flags, GError **error) try auto pkgset = *query.runSet(); goal->addProtected(pkgset); + set_excludes_from_weak_to_goal(goal); + rc = hy_goal_run_flags(goal, flags); if (rc) { string = g_string_new(_("Could not depsolve transaction; ")); diff --git a/libdnf/sack/query.hpp b/libdnf/sack/query.hpp index 9e49761cdd..306b24e30a 100644 --- a/libdnf/sack/query.hpp +++ b/libdnf/sack/query.hpp @@ -26,6 +26,7 @@ #include "../hy-types.h" #include "../hy-query.h" #include "../hy-subject.h" +#include "../nevra.hpp" #include "../repo/solvable/Dependency.hpp" #include "../repo/solvable/DependencyContainer.hpp" #include "../transaction/Swdb.hpp"