|
|
dd22ad |
From f1fbef17862e033bf9518bd318339b405f2664dd Mon Sep 17 00:00:00 2001
|
|
|
dd22ad |
From: Nicola Sella <nsella@redhat.com>
|
|
|
dd22ad |
Date: Mon, 22 Mar 2021 17:37:51 +0100
|
|
|
dd22ad |
Subject: [PATCH 1/2] Better explain traceback of rpm.error with dnf
|
|
|
dd22ad |
|
|
|
dd22ad |
=changelog=
|
|
|
dd22ad |
msg: Add dnf.error message to explain rpm.error traceback when package not found after resolving a transaction
|
|
|
dd22ad |
type: bugfix
|
|
|
dd22ad |
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1815327
|
|
|
dd22ad |
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1887293
|
|
|
dd22ad |
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1909845
|
|
|
dd22ad |
---
|
|
|
dd22ad |
dnf/db/group.py | 78 ++++++++++++++++++++++++++-----------------------
|
|
|
dd22ad |
1 file changed, 41 insertions(+), 37 deletions(-)
|
|
|
dd22ad |
|
|
|
dd22ad |
diff --git a/dnf/db/group.py b/dnf/db/group.py
|
|
|
dd22ad |
index 312e3b98..3a17019a 100644
|
|
|
dd22ad |
--- a/dnf/db/group.py
|
|
|
dd22ad |
+++ b/dnf/db/group.py
|
|
|
dd22ad |
@@ -26,6 +26,7 @@ import dnf.exceptions
|
|
|
dd22ad |
from dnf.i18n import _
|
|
|
dd22ad |
from dnf.util import logger
|
|
|
dd22ad |
|
|
|
dd22ad |
+import rpm
|
|
|
dd22ad |
|
|
|
dd22ad |
class PersistorBase(object):
|
|
|
dd22ad |
def __init__(self, history):
|
|
|
dd22ad |
@@ -316,43 +317,46 @@ class RPMTransaction(object):
|
|
|
dd22ad |
modular_problems = 0
|
|
|
dd22ad |
|
|
|
dd22ad |
for tsi in self:
|
|
|
dd22ad |
- if tsi.action == libdnf.transaction.TransactionItemAction_DOWNGRADE:
|
|
|
dd22ad |
- hdr = tsi.pkg._header
|
|
|
dd22ad |
- modular_problems += self._test_fail_safe(hdr, tsi.pkg)
|
|
|
dd22ad |
- ts.addInstall(hdr, tsi, 'u')
|
|
|
dd22ad |
- elif tsi.action == libdnf.transaction.TransactionItemAction_DOWNGRADED:
|
|
|
dd22ad |
- ts.addErase(tsi.pkg.idx)
|
|
|
dd22ad |
- elif tsi.action == libdnf.transaction.TransactionItemAction_INSTALL:
|
|
|
dd22ad |
- hdr = tsi.pkg._header
|
|
|
dd22ad |
- modular_problems += self._test_fail_safe(hdr, tsi.pkg)
|
|
|
dd22ad |
- ts.addInstall(hdr, tsi, 'i')
|
|
|
dd22ad |
- elif tsi.action == libdnf.transaction.TransactionItemAction_OBSOLETE:
|
|
|
dd22ad |
- hdr = tsi.pkg._header
|
|
|
dd22ad |
- modular_problems += self._test_fail_safe(hdr, tsi.pkg)
|
|
|
dd22ad |
- ts.addInstall(hdr, tsi, 'u')
|
|
|
dd22ad |
- elif tsi.action == libdnf.transaction.TransactionItemAction_OBSOLETED:
|
|
|
dd22ad |
- ts.addErase(tsi.pkg.idx)
|
|
|
dd22ad |
- elif tsi.action == libdnf.transaction.TransactionItemAction_REINSTALL:
|
|
|
dd22ad |
- # note: in rpm 4.12 there should not be set
|
|
|
dd22ad |
- # rpm.RPMPROB_FILTER_REPLACEPKG to work
|
|
|
dd22ad |
- hdr = tsi.pkg._header
|
|
|
dd22ad |
- modular_problems += self._test_fail_safe(hdr, tsi.pkg)
|
|
|
dd22ad |
- ts.addReinstall(hdr, tsi)
|
|
|
dd22ad |
- elif tsi.action == libdnf.transaction.TransactionItemAction_REINSTALLED:
|
|
|
dd22ad |
- # Required when multiple packages with the same NEVRA marked as installed
|
|
|
dd22ad |
- ts.addErase(tsi.pkg.idx)
|
|
|
dd22ad |
- elif tsi.action == libdnf.transaction.TransactionItemAction_REMOVE:
|
|
|
dd22ad |
- ts.addErase(tsi.pkg.idx)
|
|
|
dd22ad |
- elif tsi.action == libdnf.transaction.TransactionItemAction_UPGRADE:
|
|
|
dd22ad |
- hdr = tsi.pkg._header
|
|
|
dd22ad |
- modular_problems += self._test_fail_safe(hdr, tsi.pkg)
|
|
|
dd22ad |
- ts.addInstall(hdr, tsi, 'u')
|
|
|
dd22ad |
- elif tsi.action == libdnf.transaction.TransactionItemAction_UPGRADED:
|
|
|
dd22ad |
- ts.addErase(tsi.pkg.idx)
|
|
|
dd22ad |
- elif tsi.action == libdnf.transaction.TransactionItemAction_REASON_CHANGE:
|
|
|
dd22ad |
- pass
|
|
|
dd22ad |
- else:
|
|
|
dd22ad |
- raise RuntimeError("TransactionItemAction not handled: %s" % tsi.action)
|
|
|
dd22ad |
+ try:
|
|
|
dd22ad |
+ if tsi.action == libdnf.transaction.TransactionItemAction_DOWNGRADE:
|
|
|
dd22ad |
+ hdr = tsi.pkg._header
|
|
|
dd22ad |
+ modular_problems += self._test_fail_safe(hdr, tsi.pkg)
|
|
|
dd22ad |
+ ts.addInstall(hdr, tsi, 'u')
|
|
|
dd22ad |
+ elif tsi.action == libdnf.transaction.TransactionItemAction_DOWNGRADED:
|
|
|
dd22ad |
+ ts.addErase(tsi.pkg.idx)
|
|
|
dd22ad |
+ elif tsi.action == libdnf.transaction.TransactionItemAction_INSTALL:
|
|
|
dd22ad |
+ hdr = tsi.pkg._header
|
|
|
dd22ad |
+ modular_problems += self._test_fail_safe(hdr, tsi.pkg)
|
|
|
dd22ad |
+ ts.addInstall(hdr, tsi, 'i')
|
|
|
dd22ad |
+ elif tsi.action == libdnf.transaction.TransactionItemAction_OBSOLETE:
|
|
|
dd22ad |
+ hdr = tsi.pkg._header
|
|
|
dd22ad |
+ modular_problems += self._test_fail_safe(hdr, tsi.pkg)
|
|
|
dd22ad |
+ ts.addInstall(hdr, tsi, 'u')
|
|
|
dd22ad |
+ elif tsi.action == libdnf.transaction.TransactionItemAction_OBSOLETED:
|
|
|
dd22ad |
+ ts.addErase(tsi.pkg.idx)
|
|
|
dd22ad |
+ elif tsi.action == libdnf.transaction.TransactionItemAction_REINSTALL:
|
|
|
dd22ad |
+ # note: in rpm 4.12 there should not be set
|
|
|
dd22ad |
+ # rpm.RPMPROB_FILTER_REPLACEPKG to work
|
|
|
dd22ad |
+ hdr = tsi.pkg._header
|
|
|
dd22ad |
+ modular_problems += self._test_fail_safe(hdr, tsi.pkg)
|
|
|
dd22ad |
+ ts.addReinstall(hdr, tsi)
|
|
|
dd22ad |
+ elif tsi.action == libdnf.transaction.TransactionItemAction_REINSTALLED:
|
|
|
dd22ad |
+ # Required when multiple packages with the same NEVRA marked as installed
|
|
|
dd22ad |
+ ts.addErase(tsi.pkg.idx)
|
|
|
dd22ad |
+ elif tsi.action == libdnf.transaction.TransactionItemAction_REMOVE:
|
|
|
dd22ad |
+ ts.addErase(tsi.pkg.idx)
|
|
|
dd22ad |
+ elif tsi.action == libdnf.transaction.TransactionItemAction_UPGRADE:
|
|
|
dd22ad |
+ hdr = tsi.pkg._header
|
|
|
dd22ad |
+ modular_problems += self._test_fail_safe(hdr, tsi.pkg)
|
|
|
dd22ad |
+ ts.addInstall(hdr, tsi, 'u')
|
|
|
dd22ad |
+ elif tsi.action == libdnf.transaction.TransactionItemAction_UPGRADED:
|
|
|
dd22ad |
+ ts.addErase(tsi.pkg.idx)
|
|
|
dd22ad |
+ elif tsi.action == libdnf.transaction.TransactionItemAction_REASON_CHANGE:
|
|
|
dd22ad |
+ pass
|
|
|
dd22ad |
+ else:
|
|
|
dd22ad |
+ raise RuntimeError("TransactionItemAction not handled: %s" % tsi.action)
|
|
|
dd22ad |
+ except rpm.error as e:
|
|
|
dd22ad |
+ raise dnf.exceptions.Error(_("An rpm exception occurred: %s" % e))
|
|
|
dd22ad |
if modular_problems:
|
|
|
dd22ad |
raise dnf.exceptions.Error(_("No available modular metadata for modular package"))
|
|
|
dd22ad |
|
|
|
dd22ad |
--
|
|
|
dd22ad |
2.39.0
|
|
|
dd22ad |
|