Blame SOURCES/0004-Fix-detection-of-the-latest-module-RhBug1781769.patch

210fc6
From c8d79c0b9956aeeb8cd3a0422656b030d4656578 Mon Sep 17 00:00:00 2001
210fc6
From: Jaroslav Mracek <jmracek@redhat.com>
210fc6
Date: Mon, 9 Dec 2019 12:32:18 +0100
210fc6
Subject: [PATCH 1/2] Fix detection of the latest module (RhBug:1781769)
210fc6
210fc6
The code originally compared module version as a string, but it should
210fc6
be compared as a int.
210fc6
210fc6
https://bugzilla.redhat.com/show_bug.cgi?id=1781769
210fc6
210fc6
Closes: #1548
210fc6
Approved by: m-blaha
210fc6
---
210fc6
 dnf/module/module_base.py | 2 +-
210fc6
 1 file changed, 1 insertion(+), 1 deletion(-)
210fc6
210fc6
diff --git a/dnf/module/module_base.py b/dnf/module/module_base.py
210fc6
index 8093ab443..64bad84b6 100644
210fc6
--- a/dnf/module/module_base.py
210fc6
+++ b/dnf/module/module_base.py
210fc6
@@ -285,7 +285,7 @@ class ModuleBase(object):
210fc6
         if module_list:
210fc6
             latest = module_list[0]
210fc6
             for module in module_list[1:]:
210fc6
-                if module.getVersion() > latest.getVersion():
210fc6
+                if module.getVersionNum() > latest.getVersionNum():
210fc6
                     latest = module
210fc6
         return latest
210fc6
 
210fc6
-- 
210fc6
2.21.0
210fc6
210fc6
210fc6
From 44e9095404569dbf8a19726eb79be8e580bed60c Mon Sep 17 00:00:00 2001
210fc6
From: Jaroslav Mracek <jmracek@redhat.com>
210fc6
Date: Wed, 11 Dec 2019 09:52:16 +0100
210fc6
Subject: [PATCH 2/2] Improve transaction table formatting
210fc6
210fc6
It improves formatting of transaction table in case when terminal has
210fc6
unknown width.
210fc6
210fc6
Closes: #1548
210fc6
Approved by: m-blaha
210fc6
---
210fc6
 dnf/cli/output.py | 45 ++++++++++++++++++++++++---------------------
210fc6
 1 file changed, 24 insertions(+), 21 deletions(-)
210fc6
210fc6
diff --git a/dnf/cli/output.py b/dnf/cli/output.py
210fc6
index a03df610c..2ff41b625 100644
210fc6
--- a/dnf/cli/output.py
210fc6
+++ b/dnf/cli/output.py
210fc6
@@ -224,16 +224,32 @@ class Output(object):
210fc6
         if total_width is None:
210fc6
             total_width = self.term.real_columns
210fc6
 
210fc6
+        #  We start allocating 1 char to everything but the last column, and a
210fc6
+        # space between each (again, except for the last column). Because
210fc6
+        # at worst we are better with:
210fc6
+        # |one two three|
210fc6
+        # | four        |
210fc6
+        # ...than:
210fc6
+        # |one two three|
210fc6
+        # |            f|
210fc6
+        # |our          |
210fc6
+        # ...the later being what we get if we pre-allocate the last column, and
210fc6
+        # thus. the space, due to "three" overflowing it's column by 2 chars.
210fc6
+        if columns is None:
210fc6
+            columns = [1] * (cols - 1)
210fc6
+            columns.append(0)
210fc6
+
210fc6
         # i'm not able to get real terminal width so i'm probably
210fc6
         # running in non interactive terminal (pipe to grep, redirect to file...)
210fc6
         # avoid splitting lines to enable filtering output
210fc6
         if not total_width:
210fc6
             full_columns = []
210fc6
-            for col in data:
210fc6
+            for d in xrange(0, cols):
210fc6
+                col = data[d]
210fc6
                 if col:
210fc6
                     full_columns.append(col[-1][0])
210fc6
                 else:
210fc6
-                    full_columns.append(0)
210fc6
+                    full_columns.append(columns[d] + 1)
210fc6
             full_columns[0] += len(indent)
210fc6
             # if possible, try to keep default width (usually 80 columns)
210fc6
             default_width = self.term.columns
210fc6
@@ -241,20 +257,6 @@ class Output(object):
210fc6
                 return full_columns
210fc6
             total_width = default_width
210fc6
 
210fc6
-        #  We start allocating 1 char to everything but the last column, and a
210fc6
-        # space between each (again, except for the last column). Because
210fc6
-        # at worst we are better with:
210fc6
-        # |one two three|
210fc6
-        # | four        |
210fc6
-        # ...than:
210fc6
-        # |one two three|
210fc6
-        # |            f|
210fc6
-        # |our          |
210fc6
-        # ...the later being what we get if we pre-allocate the last column, and
210fc6
-        # thus. the space, due to "three" overflowing it's column by 2 chars.
210fc6
-        if columns is None:
210fc6
-            columns = [1] * (cols - 1)
210fc6
-            columns.append(0)
210fc6
 
210fc6
         total_width -= (sum(columns) + (cols - 1) + exact_width(indent))
210fc6
         if not columns[-1]:
210fc6
@@ -1273,7 +1275,7 @@ class Output(object):
210fc6
                 skip_str = skip_str % _(" or part of a group")
210fc6
 
210fc6
             pkglist_lines.append((skip_str, lines))
210fc6
-
210fc6
+        output_width = self.term.columns
210fc6
         if not data['n'] and not self.base._moduleContainer.isChanged() and not \
210fc6
                 (self.base._history and (self.base._history.group or self.base._history.env)):
210fc6
             return u''
210fc6
@@ -1283,6 +1285,8 @@ class Output(object):
210fc6
             columns = self.calcColumns(data, indent="  ", columns=columns,
210fc6
                                        remainder_column=2, total_width=total_width)
210fc6
             (n_wid, a_wid, v_wid, r_wid, s_wid) = columns
210fc6
+            real_width = sum(columns) + 5
210fc6
+            output_width = output_width if output_width >= real_width else real_width
210fc6
 
210fc6
             # Do not use 'Package' without context. Using context resolves
210fc6
             # RhBug 1302935 as a side effect.
210fc6
@@ -1325,13 +1329,13 @@ class Output(object):
210fc6
             # Translators: This is the full (unabbreviated) term 'Size'.
210fc6
                                          C_('long', 'Size'))
210fc6
 
210fc6
-            out = [u"%s\n%s\n%s\n" % ('=' * self.term.columns,
210fc6
+            out = [u"%s\n%s\n%s\n" % ('=' * output_width,
210fc6
                                       self.fmtColumns(((msg_package, -n_wid),
210fc6
                                                        (msg_arch, -a_wid),
210fc6
                                                        (msg_version, -v_wid),
210fc6
                                                        (msg_repository, -r_wid),
210fc6
                                                        (msg_size, s_wid)), u" "),
210fc6
-                                      '=' * self.term.columns)]
210fc6
+                                      '=' * output_width)]
210fc6
 
210fc6
         for (action, lines) in pkglist_lines:
210fc6
             if lines:
210fc6
@@ -1349,11 +1353,10 @@ class Output(object):
210fc6
 
210fc6
             if lines:
210fc6
                 out.append(totalmsg)
210fc6
-
210fc6
         out.append(_("""
210fc6
 Transaction Summary
210fc6
 %s
210fc6
-""") % ('=' * self.term.columns))
210fc6
+""") % ('=' * output_width))
210fc6
         summary_data = (
210fc6
             (_('Install'), len(list_bunch.installed) +
210fc6
              len(list_bunch.installed_group) +
210fc6
-- 
210fc6
2.21.0
210fc6