|
|
4f4af9 |
From df64fd36d7fefe39a96fea3f41e35785bebd37ec Mon Sep 17 00:00:00 2001
|
|
|
4f4af9 |
From: Marek Blaha <mblaha@redhat.com>
|
|
|
4f4af9 |
Date: Wed, 2 Dec 2020 16:33:26 +0100
|
|
|
4f4af9 |
Subject: [PATCH 1/2] Log scriptlets output also for API users (RhBug:1847340)
|
|
|
4f4af9 |
|
|
|
4f4af9 |
Messages logged into /var/log/dnf.rpm.log are now the same for both
|
|
|
4f4af9 |
command line and API usage.
|
|
|
4f4af9 |
|
|
|
4f4af9 |
https://bugzilla.redhat.com/show_bug.cgi?id=1847340
|
|
|
4f4af9 |
---
|
|
|
4f4af9 |
dnf/cli/output.py | 7 +------
|
|
|
4f4af9 |
dnf/yum/rpmtrans.py | 9 ++++++++-
|
|
|
4f4af9 |
2 files changed, 9 insertions(+), 7 deletions(-)
|
|
|
4f4af9 |
|
|
|
4f4af9 |
diff --git a/dnf/cli/output.py b/dnf/cli/output.py
|
|
|
4f4af9 |
index 51d6829ca6..86260661fc 100644
|
|
|
4f4af9 |
--- a/dnf/cli/output.py
|
|
|
4f4af9 |
+++ b/dnf/cli/output.py
|
|
|
4f4af9 |
@@ -2151,12 +2151,7 @@ def error(self, message):
|
|
|
4f4af9 |
pass
|
|
|
4f4af9 |
|
|
|
4f4af9 |
def scriptout(self, msgs):
|
|
|
4f4af9 |
- """Print messages originating from a package script.
|
|
|
4f4af9 |
-
|
|
|
4f4af9 |
- :param msgs: the messages coming from the script
|
|
|
4f4af9 |
- """
|
|
|
4f4af9 |
- if msgs:
|
|
|
4f4af9 |
- self.rpm_logger.info(ucd(msgs))
|
|
|
4f4af9 |
+ pass
|
|
|
4f4af9 |
|
|
|
4f4af9 |
def _makefmt(self, percent, ts_done, ts_total, progress=True,
|
|
|
4f4af9 |
pkgname=None, wid1=15):
|
|
|
4f4af9 |
diff --git a/dnf/yum/rpmtrans.py b/dnf/yum/rpmtrans.py
|
|
|
4f4af9 |
index 447639a476..d6c549d2ed 100644
|
|
|
4f4af9 |
--- a/dnf/yum/rpmtrans.py
|
|
|
4f4af9 |
+++ b/dnf/yum/rpmtrans.py
|
|
|
4f4af9 |
@@ -113,7 +113,10 @@ def progress(self, package, action, ti_done, ti_total, ts_done, ts_total):
|
|
|
4f4af9 |
pass
|
|
|
4f4af9 |
|
|
|
4f4af9 |
def scriptout(self, msgs):
|
|
|
4f4af9 |
- """msgs is the messages that were output (if any)."""
|
|
|
4f4af9 |
+ """Hook for reporting an rpm scriptlet output.
|
|
|
4f4af9 |
+
|
|
|
4f4af9 |
+ :param msgs: the scriptlet output
|
|
|
4f4af9 |
+ """
|
|
|
4f4af9 |
pass
|
|
|
4f4af9 |
|
|
|
4f4af9 |
def error(self, message):
|
|
|
4f4af9 |
@@ -156,6 +159,10 @@ def filelog(self, package, action):
|
|
|
4f4af9 |
msg = '%s: %s' % (action_str, package)
|
|
|
4f4af9 |
self.rpm_logger.log(dnf.logging.SUBDEBUG, msg)
|
|
|
4f4af9 |
|
|
|
4f4af9 |
+ def scriptout(self, msgs):
|
|
|
4f4af9 |
+ if msgs:
|
|
|
4f4af9 |
+ self.rpm_logger.info(ucd(msgs))
|
|
|
4f4af9 |
+
|
|
|
4f4af9 |
|
|
|
4f4af9 |
class RPMTransaction(object):
|
|
|
4f4af9 |
def __init__(self, base, test=False, displays=()):
|
|
|
4f4af9 |
|
|
|
4f4af9 |
From ee6ffcf640180b2b08d2db50b4b81d2bdefb1f2f Mon Sep 17 00:00:00 2001
|
|
|
4f4af9 |
From: Marek Blaha <mblaha@redhat.com>
|
|
|
4f4af9 |
Date: Thu, 3 Dec 2020 10:08:09 +0100
|
|
|
4f4af9 |
Subject: [PATCH 2/2] Straighten inheritance of *Display classes
|
|
|
4f4af9 |
|
|
|
4f4af9 |
---
|
|
|
4f4af9 |
dnf/cli/output.py | 15 +++------------
|
|
|
4f4af9 |
dnf/yum/rpmtrans.py | 2 +-
|
|
|
4f4af9 |
2 files changed, 4 insertions(+), 13 deletions(-)
|
|
|
4f4af9 |
|
|
|
4f4af9 |
diff --git a/dnf/cli/output.py b/dnf/cli/output.py
|
|
|
4f4af9 |
index 86260661fc..de188ffbd1 100644
|
|
|
4f4af9 |
--- a/dnf/cli/output.py
|
|
|
4f4af9 |
+++ b/dnf/cli/output.py
|
|
|
4f4af9 |
@@ -37,7 +37,7 @@
|
|
|
4f4af9 |
from dnf.cli.format import format_number, format_time
|
|
|
4f4af9 |
from dnf.i18n import _, C_, P_, ucd, fill_exact_width, textwrap_fill, exact_width, select_short_long
|
|
|
4f4af9 |
from dnf.pycomp import xrange, basestring, long, unicode, sys_maxsize
|
|
|
4f4af9 |
-from dnf.yum.rpmtrans import LoggingTransactionDisplay
|
|
|
4f4af9 |
+from dnf.yum.rpmtrans import TransactionDisplay
|
|
|
4f4af9 |
from dnf.db.history import MergedTransactionWrapper
|
|
|
4f4af9 |
import dnf.base
|
|
|
4f4af9 |
import dnf.callback
|
|
|
4f4af9 |
@@ -2071,7 +2071,7 @@ def short_id(id):
|
|
|
4f4af9 |
return self.output.userconfirm()
|
|
|
4f4af9 |
|
|
|
4f4af9 |
|
|
|
4f4af9 |
-class CliTransactionDisplay(LoggingTransactionDisplay):
|
|
|
4f4af9 |
+class CliTransactionDisplay(TransactionDisplay):
|
|
|
4f4af9 |
"""A YUM specific callback class for RPM operations."""
|
|
|
4f4af9 |
|
|
|
4f4af9 |
width = property(lambda self: dnf.cli.term._term_width())
|
|
|
4f4af9 |
@@ -2093,7 +2093,7 @@ def progress(self, package, action, ti_done, ti_total, ts_done, ts_total):
|
|
|
4f4af9 |
:param package: the package involved in the event
|
|
|
4f4af9 |
:param action: the type of action that is taking place. Valid
|
|
|
4f4af9 |
values are given by
|
|
|
4f4af9 |
- :func:`rpmtrans.LoggingTransactionDisplay.action.keys()`
|
|
|
4f4af9 |
+ :func:`rpmtrans.TransactionDisplay.action.keys()`
|
|
|
4f4af9 |
:param ti_done: a number representing the amount of work
|
|
|
4f4af9 |
already done in the current transaction
|
|
|
4f4af9 |
:param ti_total: a number representing the total amount of work
|
|
|
4f4af9 |
@@ -2144,15 +2144,6 @@ def _out_progress(self, ti_done, ti_total, ts_done, ts_total,
|
|
|
4f4af9 |
if ti_done == ti_total:
|
|
|
4f4af9 |
print(" ")
|
|
|
4f4af9 |
|
|
|
4f4af9 |
- def filelog(self, package, action):
|
|
|
4f4af9 |
- pass
|
|
|
4f4af9 |
-
|
|
|
4f4af9 |
- def error(self, message):
|
|
|
4f4af9 |
- pass
|
|
|
4f4af9 |
-
|
|
|
4f4af9 |
- def scriptout(self, msgs):
|
|
|
4f4af9 |
- pass
|
|
|
4f4af9 |
-
|
|
|
4f4af9 |
def _makefmt(self, percent, ts_done, ts_total, progress=True,
|
|
|
4f4af9 |
pkgname=None, wid1=15):
|
|
|
4f4af9 |
l = len(str(ts_total))
|
|
|
4f4af9 |
diff --git a/dnf/yum/rpmtrans.py b/dnf/yum/rpmtrans.py
|
|
|
4f4af9 |
index d6c549d2ed..51fa921d3e 100644
|
|
|
4f4af9 |
--- a/dnf/yum/rpmtrans.py
|
|
|
4f4af9 |
+++ b/dnf/yum/rpmtrans.py
|
|
|
4f4af9 |
@@ -143,7 +143,7 @@ def error(self, message):
|
|
|
4f4af9 |
dnf.util._terminal_messenger('print', message, sys.stderr)
|
|
|
4f4af9 |
|
|
|
4f4af9 |
|
|
|
4f4af9 |
-class LoggingTransactionDisplay(ErrorTransactionDisplay):
|
|
|
4f4af9 |
+class LoggingTransactionDisplay(TransactionDisplay):
|
|
|
4f4af9 |
'''
|
|
|
4f4af9 |
Base class for a RPMTransaction display callback class
|
|
|
4f4af9 |
'''
|