dcavalca / rpms / dnf

Forked from rpms/dnf 2 years ago
Clone

Blame SOURCES/0036-Add-support-for-rollback-of-group-upgrade-rollback-R.patch

c115a0
From a32b2f7d596247124ad6ff5ab71bc83bf78f0518 Mon Sep 17 00:00:00 2001
c115a0
From: Jan Kolarik <jkolarik@redhat.com>
c115a0
Date: Tue, 13 Sep 2022 13:55:35 +0200
c115a0
Subject: [PATCH] Add support for rollback of group upgrade rollback
c115a0
 (RhBug:2016070)
c115a0
c115a0
= changelog =
c115a0
type: bugfix
c115a0
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2016070
c115a0
---
c115a0
 dnf/transaction_sr.py | 20 ++++++++++++--------
c115a0
 1 file changed, 12 insertions(+), 8 deletions(-)
c115a0
c115a0
diff --git a/dnf/transaction_sr.py b/dnf/transaction_sr.py
c115a0
index 5d403a3e..b389f152 100644
c115a0
--- a/dnf/transaction_sr.py
c115a0
+++ b/dnf/transaction_sr.py
c115a0
@@ -553,12 +553,14 @@ class TransactionReplay(object):
c115a0
 
c115a0
                 if action == "Install":
c115a0
                     self._swdb_group_install(group_id, pkg_types, group_data["packages"])
c115a0
-                elif action == "Upgrade":
c115a0
-                    self._swdb_group_upgrade(group_id, pkg_types, group_data["packages"])
c115a0
-                elif action == "Downgraded":
c115a0
-                    self._swdb_group_downgrade(group_id, pkg_types, group_data["packages"])
c115a0
                 elif action == "Removed":
c115a0
                     self._swdb_group_remove(group_id, pkg_types, group_data["packages"])
c115a0
+                # Groups are not versioned, but a reverse transaction could be applied,
c115a0
+                # therefore we treat both actions the same way
c115a0
+                elif action == "Upgrade" or action == "Upgraded":
c115a0
+                    self._swdb_group_upgrade(group_id, pkg_types, group_data["packages"])
c115a0
+                elif action == "Downgrade" or action == "Downgraded":
c115a0
+                    self._swdb_group_downgrade(group_id, pkg_types, group_data["packages"])
c115a0
                 else:
c115a0
                     errors.append(TransactionError(
c115a0
                         _('Unexpected value of group action "{action}" for group "{group}".')
c115a0
@@ -584,12 +586,14 @@ class TransactionReplay(object):
c115a0
 
c115a0
                 if action == "Install":
c115a0
                     self._swdb_environment_install(env_id, pkg_types, env_data["groups"])
c115a0
-                elif action == "Upgrade":
c115a0
-                    self._swdb_environment_upgrade(env_id, pkg_types, env_data["groups"])
c115a0
-                elif action == "Downgraded":
c115a0
-                    self._swdb_environment_downgrade(env_id, pkg_types, env_data["groups"])
c115a0
                 elif action == "Removed":
c115a0
                     self._swdb_environment_remove(env_id, pkg_types, env_data["groups"])
c115a0
+                # Environments are not versioned, but a reverse transaction could be applied,
c115a0
+                # therefore we treat both actions the same way
c115a0
+                elif action == "Upgrade" or action == "Upgraded":
c115a0
+                    self._swdb_environment_upgrade(env_id, pkg_types, env_data["groups"])
c115a0
+                elif action == "Downgrade" or action == "Downgraded":
c115a0
+                    self._swdb_environment_downgrade(env_id, pkg_types, env_data["groups"])
c115a0
                 else:
c115a0
                     errors.append(TransactionError(
c115a0
                         _('Unexpected value of environment action "{action}" for environment "{env}".')
c115a0
-- 
c115a0
2.37.3
c115a0