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

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