|
|
52b19a |
From fe87499e6745795b1dc6225fa102a1242eb9ffc8 Mon Sep 17 00:00:00 2001
|
|
|
52b19a |
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hr=C3=A1zk=C3=BD?= <lhrazky@redhat.com>
|
|
|
52b19a |
Date: Thu, 17 Feb 2022 18:46:22 +0100
|
|
|
52b19a |
Subject: [PATCH] cli/commands/history: Fix history undo on a Reason Change
|
|
|
52b19a |
|
|
|
52b19a |
The previous reason needs to be fetched from the history db. It's
|
|
|
52b19a |
inefficient to parse the nevra after it was serialized in a previous
|
|
|
52b19a |
step, but that would need bigger code restructuring.
|
|
|
52b19a |
|
|
|
52b19a |
= changelog =
|
|
|
52b19a |
msg: Fix history undo on a Reason Change
|
|
|
52b19a |
type: bugfix
|
|
|
52b19a |
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2053014
|
|
|
52b19a |
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2010259
|
|
|
52b19a |
---
|
|
|
52b19a |
dnf.spec | 2 +-
|
|
|
52b19a |
dnf/cli/commands/history.py | 11 +++++++++++
|
|
|
52b19a |
2 files changed, 12 insertions(+), 1 deletion(-)
|
|
|
52b19a |
|
|
|
52b19a |
diff --git a/dnf.spec b/dnf.spec
|
|
|
52b19a |
index 02c8b577..36c3932e 100644
|
|
|
52b19a |
--- a/dnf.spec
|
|
|
52b19a |
+++ b/dnf.spec
|
|
|
52b19a |
@@ -2,7 +2,7 @@
|
|
|
52b19a |
%define __cmake_in_source_build 1
|
|
|
52b19a |
|
|
|
52b19a |
# default dependencies
|
|
|
52b19a |
-%global hawkey_version 0.61.1
|
|
|
52b19a |
+%global hawkey_version 0.66.0
|
|
|
52b19a |
%global libcomps_version 0.1.8
|
|
|
52b19a |
%global libmodulemd_version 2.9.3
|
|
|
52b19a |
%global rpm_version 4.14.0
|
|
|
52b19a |
diff --git a/dnf/cli/commands/history.py b/dnf/cli/commands/history.py
|
|
|
52b19a |
index 293d93fc..21d04a1a 100644
|
|
|
52b19a |
--- a/dnf/cli/commands/history.py
|
|
|
52b19a |
+++ b/dnf/cli/commands/history.py
|
|
|
52b19a |
@@ -223,6 +223,7 @@ class HistoryCommand(commands.Command):
|
|
|
52b19a |
"Reinstall": "Reinstalled",
|
|
|
52b19a |
"Obsoleted": "Install",
|
|
|
52b19a |
"Obsolete": "Obsoleted",
|
|
|
52b19a |
+ "Reason Change": "Reason Change",
|
|
|
52b19a |
}
|
|
|
52b19a |
|
|
|
52b19a |
data = serialize_transaction(trans)
|
|
|
52b19a |
@@ -235,6 +236,16 @@ class HistoryCommand(commands.Command):
|
|
|
52b19a |
if ti["action"] == "Install" and ti.get("reason", None) == "clean":
|
|
|
52b19a |
ti["reason"] = "dependency"
|
|
|
52b19a |
|
|
|
52b19a |
+ if ti["action"] == "Reason Change" and "nevra" in ti:
|
|
|
52b19a |
+ subj = hawkey.Subject(ti["nevra"])
|
|
|
52b19a |
+ nevra = subj.get_nevra_possibilities(forms=[hawkey.FORM_NEVRA])[0]
|
|
|
52b19a |
+ reason = self.output.history.swdb.resolveRPMTransactionItemReason(
|
|
|
52b19a |
+ nevra.name,
|
|
|
52b19a |
+ nevra.arch,
|
|
|
52b19a |
+ trans.tids()[0] - 1
|
|
|
52b19a |
+ )
|
|
|
52b19a |
+ ti["reason"] = libdnf.transaction.TransactionItemReasonToString(reason)
|
|
|
52b19a |
+
|
|
|
52b19a |
if ti.get("repo_id") == hawkey.SYSTEM_REPO_NAME:
|
|
|
52b19a |
# erase repo_id, because it's not possible to perform forward actions from the @System repo
|
|
|
52b19a |
ti["repo_id"] = None
|
|
|
52b19a |
--
|
|
|
52b19a |
2.35.1
|
|
|
52b19a |
|