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

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