diff --git a/dnf5-plugins/repoclosure_plugin/repoclosure.cpp b/dnf5-plugins/repoclosure_plugin/repoclosure.cpp index 19954f176..dc7fa66b4 100644 --- a/dnf5-plugins/repoclosure_plugin/repoclosure.cpp +++ b/dnf5-plugins/repoclosure_plugin/repoclosure.cpp @@ -170,17 +170,11 @@ void RepoclosureCommand::run() { for (const auto & pkg : to_check_query) { std::vector unsatisfied; for (const auto & reldep : pkg.get_requires()) { - if (libdnf5::rpm::Reldep::is_rich_dependency(reldep.to_string())) { - // Rich dependencies are skipped because they are too complicated to provide correct result - continue; - }; int reldep_id = reldep.get_id().id; auto resolved_it = resolved.find(reldep_id); bool satisfied; if (resolved_it == resolved.end()) { - libdnf5::rpm::PackageQuery reldep_q(available_query); - reldep_q.filter_provides(reldep); - satisfied = !reldep_q.empty(); + satisfied = available_query.is_dep_satisfied(reldep); resolved.emplace(reldep_id, satisfied); } else { satisfied = resolved_it->second; diff --git a/dnf5.spec b/dnf5.spec index fa6028f9a..685d4755c 100644 --- a/dnf5.spec +++ b/dnf5.spec @@ -125,11 +125,7 @@ Provides: dnf5-command(versionlock) %global libmodulemd_version 2.5.0 %global librepo_version 1.20.0 -%if %{with focus_new} - %global libsolv_version 0.7.30 -%else - %global libsolv_version 0.7.25 -%endif +%global libsolv_version 0.7.35 %global sqlite_version 3.35.0 %global swig_version 4 diff --git a/include/libdnf5/rpm/package_query.hpp b/include/libdnf5/rpm/package_query.hpp index 75c6ec450..0d2aca858 100644 --- a/include/libdnf5/rpm/package_query.hpp +++ b/include/libdnf5/rpm/package_query.hpp @@ -988,6 +988,10 @@ class LIBDNF_API PackageQuery : public PackageSet { std::pair resolve_pkg_spec( const std::string & pkg_spec, const libdnf5::ResolveSpecSettings & settings, bool with_src); + /// Returns `true` if the dependency `reldep` is satisfied by the packages in query, otherwise `false` is returned. + /// @since 5.3.0.1 + bool is_dep_satisfied(const Reldep & reldep); + void swap(PackageQuery & other) noexcept; /// Filter packages to keep only duplicates of installed packages. Packages are duplicate if they have the same `name` and `arch` but different `evr`. diff --git a/libdnf5/CMakeLists.txt b/libdnf5/CMakeLists.txt index fa4c9d142..c8665247c 100644 --- a/libdnf5/CMakeLists.txt +++ b/libdnf5/CMakeLists.txt @@ -81,11 +81,7 @@ if (WITH_MODULEMD) target_link_libraries(libdnf5_iface INTERFACE ${LIBMODULEMD_LIBRARIES}) endif() -if (ENABLE_SOLV_FOCUSNEW) - pkg_check_modules(LIBSOLV REQUIRED libsolv>=0.7.30) -else() - pkg_check_modules(LIBSOLV REQUIRED libsolv>=0.7.25) -endif() +pkg_check_modules(LIBSOLV REQUIRED libsolv>=0.7.35) list(APPEND LIBDNF5_PC_REQUIRES "${LIBSOLV_MODULE_NAME}") target_link_libraries(libdnf5 PRIVATE ${LIBSOLV_LIBRARIES}) target_link_libraries(libdnf5_iface INTERFACE ${LIBSOLV_LIBRARIES}) diff --git a/libdnf5/rpm/package_query.cpp b/libdnf5/rpm/package_query.cpp index 3e6e612e6..f95b1c711 100644 --- a/libdnf5/rpm/package_query.cpp +++ b/libdnf5/rpm/package_query.cpp @@ -2635,6 +2635,12 @@ void PackageQuery::filter_priority() { } } +bool PackageQuery::is_dep_satisfied(const Reldep & reldep) { + p_impl->base->get_rpm_package_sack()->p_impl->make_provides_ready(); + auto & pool = get_rpm_pool(p_impl->base); + return pool.is_dep_satisfied_in_map(reldep.get_id().id, *p_impl); +} + std::pair PackageQuery::resolve_pkg_spec( const std::string & pkg_spec, const ResolveSpecSettings & settings, bool with_src) { auto & pool = get_rpm_pool(p_impl->base); diff --git a/libdnf5/solv/pool.hpp b/libdnf5/solv/pool.hpp index 495932fc7..102412f79 100644 --- a/libdnf5/solv/pool.hpp +++ b/libdnf5/solv/pool.hpp @@ -253,6 +253,10 @@ class Pool { int set_flag(int flag, int value) { return pool_set_flag(pool, flag, value); } + /// Returns `1` if the dependency `dep` is satisfied by the packages specified + /// in `map`, otherwise `0` is returned. + int is_dep_satisfied_in_map(Id dep, SolvMap & map) { return pool_satisfieddep_map(pool, &map.get_map(), dep); } + protected: SolvMap considered; // owner of the considered map, `pool->considered` is only a raw pointer ::Pool * pool;