Blame SOURCES/BZ-1127782-post-transaction-action.patch

74e468
commit d317fd0d8f56eb352c7dbb78bc283c208da9a561
74e468
Author: Zdenek Pavlas <zpavlas@redhat.com>
74e468
Date:   Tue Jan 14 12:08:43 2014 +0100
74e468
74e468
    post-transaction-actions: fix filename matching. BZ 1045494
74e468
    
74e468
    I believe the code now works as origanally intended. When installing
74e468
    packages, txmbr.po is AvailablePackage instance and .filelist access
74e468
    may trigger filelist metadata download.
74e468
    
74e468
    Since this runs after the transaction, we may look the package up
74e468
    in rpmdb instead.  On removals, thispo is RPMInstalledPackage already.
74e468
    Thanks to Robert Tomczyk <robert.x.tomczyk@gmail.com> for reporting
74e468
    and testing this.
74e468
74e468
diff --git a/plugins/post-transaction-actions/post-transaction-actions.py b/plugins/post-transaction-actions/post-transaction-actions.py
74e468
index b4da1ce..804af9c 100644
74e468
--- a/plugins/post-transaction-actions/post-transaction-actions.py
74e468
+++ b/plugins/post-transaction-actions/post-transaction-actions.py
74e468
@@ -129,8 +129,10 @@ def posttrans_hook(conduit):
74e468
 
74e468
             for txmbr in pkgset:
74e468
                 matched = False
74e468
-                #print '%s - %s' % txmbr.name, txmbr.ts_state
74e468
-                if txmbr.po.state in TS_INSTALL_STATES:
74e468
+                thispo = txmbr.po
74e468
+                if txmbr.output_state in TS_INSTALL_STATES:
74e468
+                    # thispo is AvailablePackage; filelist access could trigger download
74e468
+                    # of the filelist.  Since it's installed now, use rpmdb data instead.
74e468
                     thispo = _get_installed_po(rpmdb, txmbr.pkgtup)
74e468
         
74e468
                 if not yum.misc.re_glob(a_k):
74e468
commit 78cfff9b48608ad246a8898d002937d9b6ffcc5d
74e468
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
74e468
Date:   Wed Aug 20 17:31:16 2014 +0200
74e468
74e468
    post-transaction-actions: preload filelists for packages to be removed. BZ 1127782
74e468
74e468
diff --git a/plugins/post-transaction-actions/post-transaction-actions.py b/plugins/post-transaction-actions/post-transaction-actions.py
74e468
index 804af9c..4d015c1 100644
74e468
--- a/plugins/post-transaction-actions/post-transaction-actions.py
74e468
+++ b/plugins/post-transaction-actions/post-transaction-actions.py
74e468
@@ -93,6 +93,17 @@ def _convert_vars(txmbr, command):
74e468
     result = varReplace(command, vardict)
74e468
     return result
74e468
             
74e468
+
74e468
+def pretrans_hook(conduit):
74e468
+    # Prefetch filelist for packages to be removed,
74e468
+    # otherwise for updated packages headers will not be available
74e468
+    ts = conduit.getTsInfo()
74e468
+    removes = ts.getMembersWithState(output_states=TS_REMOVE_STATES)
74e468
+
74e468
+    for txmbr in removes:
74e468
+        txmbr.po.filelist
74e468
+
74e468
+
74e468
 def posttrans_hook(conduit):
74e468
     # we have provides/requires for everything
74e468
     # we do not have filelists for erasures