From 8e16fa3adc4ae1c3657956eef5eee5b40d1208c0 Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Tue, 18 Sep 2018 21:42:03 +0200 Subject: [PATCH] [transaction] Skip storing some obsoletes in the history database. --- libdnf/dnf-transaction.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libdnf/dnf-transaction.cpp b/libdnf/dnf-transaction.cpp index 28d15d803..638b0640a 100644 --- a/libdnf/dnf-transaction.cpp +++ b/libdnf/dnf-transaction.cpp @@ -1258,6 +1258,19 @@ dnf_transaction_commit(DnfTransaction *transaction, HyGoal goal, DnfState *state } } + if (swdbAction == libdnf::TransactionItemAction::OBSOLETED + && dnf_find_pkg_from_name(priv->install, pkg_tmp_name) != NULL + && g_strcmp0(pkg_name, pkg_tmp_name) != 0) { + // If a package is obsoleted and there's a package with the same name + // in the install set, skip recording the obsolete in the history db + // because the package upgrade prevails over the obsolete. + // + // Example: + // grub2-tools-efi obsoletes grub2-tools # skip as grub2-tools is also upgraded + // grub2-tools upgrades grub2-tools + continue; + } + // TODO SWDB add pkg_tmp replaced_by pkg _history_write_item(pkg_tmp, priv->swdb, swdbAction); }