[yum-commits] Branch 'yum-3_2_X' - yum/rpmtrans.py

skvidal at osuosl.org skvidal at osuosl.org
Fri Mar 6 17:47:13 UTC 2009


 yum/rpmtrans.py |   24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

New commits:
commit f77b72758c4698f04dc939a640c03706a26bca43
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Fri Mar 6 12:43:47 2009 -0500

    scripterrors can happen in cleanups, too.
    this is a fix for bug #488994

diff --git a/yum/rpmtrans.py b/yum/rpmtrans.py
index 9844e2f..edda96a 100644
--- a/yum/rpmtrans.py
+++ b/yum/rpmtrans.py
@@ -507,19 +507,31 @@ class RPMTransaction:
                 
     def _scriptError(self, bytes, total, h):
         hdr, rpmloc = h[0], h[1]
-        pkgtup = self._dopkgtup(hdr)
-        txmbrs = self.base.tsInfo.getMembers(pkgtup=pkgtup)
-        for txmbr in txmbrs:
+        remove_hdr = False # if we're in a clean up/remove then hdr will not be an rpm.hdr
+        if not isinstance(hdr, rpm.hdr):
+            txmbrs = [hdr]
+            remove_hdr = True
+        else:
+            pkgtup = self._dopkgtup(hdr)
+            txmbrs = self.base.tsInfo.getMembers(pkgtup=pkgtup)
+            
+        for pkg in txmbrs:
             # "bytes" carries the failed scriptlet tag,
             # "total" carries fatal/non-fatal status
             scriptlet_name = rpm.tagnames.get(bytes, "<unknown>")
+            if remove_hdr:
+                package_name = pkg
+            else:
+                package_name = txmbr.po
+                
             if total:
                 msg = ("Error in %s scriptlet in rpm package %s" % 
-                        (scriptlet_name, txmbr.po))
-                txmbr.output_state = TS_FAILED
+                        (scriptlet_name, package_name))
+                if not remove_hdr:        
+                    txmbr.output_state = TS_FAILED
             else:
                 msg = ("Non-fatal %s scriptlet failure in rpm package %s" % 
-                       (scriptlet_name, txmbr.po))
+                       (scriptlet_name, package_name))
             self.display.errorlog(msg)
             # FIXME - what else should we do here? raise a failure and abort?
     


More information about the Yum-commits mailing list