libdnf/0001-Modify-solver_describe_decision-to-report-cleaned-RhBug1486749.patch

41 lines
1.3 KiB
Diff
Raw Normal View History

2018-10-17 12:02:36 +00:00
From 83a0b5f289fd9461b68b1afab525c0f4ca6015b1 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Mon, 15 Oct 2018 21:27:15 +0200
Subject: [PATCH] Modify solver_describe_decision to report cleaned (RhBug:1486749)
---
libdnf/goal/Goal.cpp | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/libdnf/goal/Goal.cpp b/libdnf/goal/Goal.cpp
index 50fef5c..7d17a49 100644
--- a/libdnf/goal/Goal.cpp
+++ b/libdnf/goal/Goal.cpp
@@ -647,7 +647,8 @@ Goal::getReason(DnfPackage *pkg)
if (!pImpl->solv)
return HY_REASON_USER;
Id info;
- int reason = solver_describe_decision(pImpl->solv, dnf_package_get_id(pkg), &info);
+ const Id pkgID = dnf_package_get_id(pkg);
+ int reason = solver_describe_decision(pImpl->solv, pkgID, &info);
if ((reason == SOLVER_REASON_UNIT_RULE ||
reason == SOLVER_REASON_RESOLVE_JOB) &&
@@ -658,6 +659,13 @@ Goal::getReason(DnfPackage *pkg)
return HY_REASON_CLEAN;
if (reason == SOLVER_REASON_WEAKDEP)
return HY_REASON_WEAKDEP;
+ IdQueue cleanDepsQueue;
+ solver_get_cleandeps(pImpl->solv, cleanDepsQueue.getQueue());
+ for (int i = 0; i < cleanDepsQueue.size(); ++i) {
+ if (cleanDepsQueue[i] == pkgID) {
+ return HY_REASON_CLEAN;
+ }
+ }
return HY_REASON_DEP;
}
--
libgit2 0.26.6