From b473d937cff5b3ddb350a266b053661975c6f959 Mon Sep 17 00:00:00 2001 From: Jaroslav Mracek Date: Wed, 17 Oct 2018 14:02:36 +0200 Subject: [PATCH] Backport 2 patches --- ...ision-to-report-cleaned-RhBug1486749.patch | 40 +++++++++++++++++++ ...rash-in-TransactionItemaddReplacedBy.patch | 25 ++++++++++++ libdnf.spec | 8 +++- 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 0001-Modify-solver_describe_decision-to-report-cleaned-RhBug1486749.patch create mode 100644 0002-history-Fix-crash-in-TransactionItemaddReplacedBy.patch diff --git a/0001-Modify-solver_describe_decision-to-report-cleaned-RhBug1486749.patch b/0001-Modify-solver_describe_decision-to-report-cleaned-RhBug1486749.patch new file mode 100644 index 0000000..9a99191 --- /dev/null +++ b/0001-Modify-solver_describe_decision-to-report-cleaned-RhBug1486749.patch @@ -0,0 +1,40 @@ +From 83a0b5f289fd9461b68b1afab525c0f4ca6015b1 Mon Sep 17 00:00:00 2001 +From: Jaroslav Mracek +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 + diff --git a/0002-history-Fix-crash-in-TransactionItemaddReplacedBy.patch b/0002-history-Fix-crash-in-TransactionItemaddReplacedBy.patch new file mode 100644 index 0000000..c8e4447 --- /dev/null +++ b/0002-history-Fix-crash-in-TransactionItemaddReplacedBy.patch @@ -0,0 +1,25 @@ +From cc7776ba7e33770ad5744a67d32b03aaece992f8 Mon Sep 17 00:00:00 2001 +From: Daniel Mach +Date: Wed, 17 Oct 2018 12:12:18 +0200 +Subject: [PATCH] [history] Fix crash in TransactionItem::addReplacedBy(). + +--- + libdnf/transaction/TransactionItem.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libdnf/transaction/TransactionItem.hpp b/libdnf/transaction/TransactionItem.hpp +index dc4e2c8..72684f7 100644 +--- a/libdnf/transaction/TransactionItem.hpp ++++ b/libdnf/transaction/TransactionItem.hpp +@@ -110,7 +110,7 @@ public: + // int64_t getTransactionId() const noexcept { return trans.getId(); } + + const std::vector< TransactionItemPtr > &getReplacedBy() const noexcept { return replacedBy; } +- void addReplacedBy(TransactionItemPtr value) { replacedBy.push_back(value); } ++ void addReplacedBy(TransactionItemPtr value) { if (value) replacedBy.push_back(value); } + + void save(); + void saveReplacedBy(); +-- +libgit2 0.26.6 + diff --git a/libdnf.spec b/libdnf.spec index 79486d8..c7008ce 100644 --- a/libdnf.spec +++ b/libdnf.spec @@ -31,11 +31,13 @@ Name: libdnf Version: 0.22.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Library providing simplified C and Python API to libsolv License: LGPLv2+ URL: https://github.com/rpm-software-management/libdnf Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz +Patch0001: 0001-Modify-solver_describe_decision-to-report-cleaned-RhBug1486749.patch +Patch0002: 0002-history-Fix-crash-in-TransactionItemaddReplacedBy.patch BuildRequires: cmake BuildRequires: gcc @@ -243,6 +245,10 @@ popd %endif %changelog +* Wed Oct 15 2018 Jaroslav Mracek - 0.22.0-2 +- backport Modify-solver_describe_decision-to-report-cleaned-RhBug1486749 +- backport history-Fix-crash-in-TransactionItemaddReplacedBy + * Mon Oct 15 2018 Jaroslav Mracek - 0.22.0-1 - Update to 0.22.0 - Fix segfault in repo_internalize_trigger (RhBug:1375895)