Blame SOURCES/0018-Allow-stream-switching-if-option-enabled.patch

4f4af9
From 9ceb74f77479910f7844a9a87d4b7623687076be Mon Sep 17 00:00:00 2001
4f4af9
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
4f4af9
Date: Fri, 24 Jul 2020 07:59:38 +0200
4f4af9
Subject: [PATCH] Allow stream switching if option enabled
4f4af9
4f4af9
= changelog =
4f4af9
msg: New config option module_allow_stream_switch allows switching enabled streams
4f4af9
type: enhancement
4f4af9
---
4f4af9
 dnf.spec       |  2 +-
4f4af9
 dnf/cli/cli.py | 19 ++++++++++---------
4f4af9
 2 files changed, 11 insertions(+), 10 deletions(-)
4f4af9
4f4af9
diff --git a/dnf.spec b/dnf.spec
4f4af9
index 0e63b2b422..04f6f104c7 100644
4f4af9
--- a/dnf.spec
4f4af9
+++ b/dnf.spec
4f4af9
@@ -2,7 +2,7 @@
4f4af9
 %undefine __cmake_in_source_build
4f4af9
 
4f4af9
 # default dependencies
4f4af9
-%global hawkey_version 0.54.4
4f4af9
+%global hawkey_version 0.55.0
4f4af9
 %global libcomps_version 0.1.8
4f4af9
 %global libmodulemd_version 1.4.0
4f4af9
 %global rpm_version 4.14.0
4f4af9
diff --git a/dnf/cli/cli.py b/dnf/cli/cli.py
4f4af9
index be737ed3b7..29d7373fa3 100644
4f4af9
--- a/dnf/cli/cli.py
4f4af9
+++ b/dnf/cli/cli.py
4f4af9
@@ -166,15 +166,16 @@ def do_transaction(self, display=()):
4f4af9
         :return: history database transaction ID or None
4f4af9
         """
4f4af9
         if dnf.base.WITH_MODULES:
4f4af9
-            switchedModules = dict(self._moduleContainer.getSwitchedStreams())
4f4af9
-            if switchedModules:
4f4af9
-                report_module_switch(switchedModules)
4f4af9
-                msg = _("It is not possible to switch enabled streams of a module.\n"
4f4af9
-                        "It is recommended to remove all installed content from the module, and "
4f4af9
-                        "reset the module using '{prog} module reset <module_name>' command. After "
4f4af9
-                        "you reset the module, you can install the other stream.").format(
4f4af9
-                    prog=dnf.util.MAIN_PROG)
4f4af9
-                raise dnf.exceptions.Error(msg)
4f4af9
+            if not self.conf.module_stream_switch:
4f4af9
+                switchedModules = dict(self._moduleContainer.getSwitchedStreams())
4f4af9
+                if switchedModules:
4f4af9
+                    report_module_switch(switchedModules)
4f4af9
+                    msg = _("It is not possible to switch enabled streams of a module.\n"
4f4af9
+                            "It is recommended to remove all installed content from the module, and "
4f4af9
+                            "reset the module using '{prog} module reset <module_name>' command. After "
4f4af9
+                            "you reset the module, you can install the other stream.").format(
4f4af9
+                        prog=dnf.util.MAIN_PROG)
4f4af9
+                    raise dnf.exceptions.Error(msg)
4f4af9
 
4f4af9
         trans = self.transaction
4f4af9
         pkg_str = self.output.list_transaction(trans)