[Yum-devel] [PATCH] If verifyTransaction detects that an install or removal was not successful, it will now set the output_state of the pkg to TS_FAILED. BZ 661962

Nick Jacek njacek at redhat.com
Thu Jun 16 14:09:43 UTC 2011


For the case of a removal, since the output_state will be TS_FAILED
rather than just remaining TS_ERASE, yum will now correctly say that
the removal failed instead of saying that the package was removed.
---
 yum/__init__.py |    2 ++
 yum/rpmtrans.py |    3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index a0c6b9d..d879c51 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1589,6 +1589,7 @@ class YumBase(depsolve.Depsolve):
                     # but raising an exception is not going to do any good
                     self.logger.critical(_('%s was supposed to be installed' \
                                            ' but is not!' % txmbr.po))
+                    txmbr.output_state = TS_FAILED
                     continue
                 po = self.getInstalledPackageObject(txmbr.pkgtup)
                 rpo = txmbr.po
@@ -1650,6 +1651,7 @@ class YumBase(depsolve.Depsolve):
                         # but raising an exception is not going to do any good
                         self.logger.critical(_('%s was supposed to be removed' \
                                                ' but is not!' % txmbr.po))
+                        txmbr.output_state = TS_FAILED
                         continue
                 yumdb_item = self.rpmdb.yumdb.get_package(po=txmbr.po)
                 yumdb_item.clean()
diff --git a/yum/rpmtrans.py b/yum/rpmtrans.py
index 6687080..43f9634 100644
--- a/yum/rpmtrans.py
+++ b/yum/rpmtrans.py
@@ -545,6 +545,7 @@ class RPMTransaction:
         
     def _cpioError(self, bytes, total, h):
         name, txmbr = self._getTxmbr(h)
+        # In the case of a remove, we only have a name, not a txmbr
         if txmbr is not None:
             msg = "Error in cpio payload of rpm package %s" % txmbr.po
             txmbr.output_state = TS_FAILED
@@ -553,6 +554,7 @@ class RPMTransaction:
     
     def _unpackError(self, bytes, total, h):
         name, txmbr = self._getTxmbr(h)
+        # In the case of a remove, we only have a name, not a txmbr
         if txmbr is not None:
             txmbr.output_state = TS_FAILED
             msg = "Error unpacking rpm package %s" % txmbr.po
@@ -574,6 +576,7 @@ class RPMTransaction:
         if total:
             msg = ("Error in %s scriptlet in rpm package %s" % 
                     (scriptlet_name, package_name))
+            # In the case of a remove, we only have a name, not a txmbr
             if txmbr is not None:        
                 txmbr.output_state = TS_FAILED
         else:
-- 
1.7.5.2



More information about the Yum-devel mailing list