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

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