Skip to content
Open
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
8 changes: 1 addition & 7 deletions dnf5-plugins/repoclosure_plugin/repoclosure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,11 @@ void RepoclosureCommand::run() {
for (const auto & pkg : to_check_query) {
std::vector<std::string> 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;
Expand Down
6 changes: 1 addition & 5 deletions dnf5.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions include/libdnf5/rpm/package_query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,10 @@ class LIBDNF_API PackageQuery : public PackageSet {
std::pair<bool, libdnf5::rpm::Nevra> 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.2.16
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`.
Expand Down
6 changes: 1 addition & 5 deletions libdnf5/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
6 changes: 6 additions & 0 deletions libdnf5/rpm/package_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool, libdnf5::rpm::Nevra> PackageQuery::resolve_pkg_spec(
const std::string & pkg_spec, const ResolveSpecSettings & settings, bool with_src) {
auto & pool = get_rpm_pool(p_impl->base);
Expand Down
4 changes: 4 additions & 0 deletions libdnf5/solv/pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down