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

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