Collect and execute %posttrans scripts delayed (Fate#313506)
authorMichael Andres <ma@suse.de>
Sat, 25 Jan 2014 13:05:39 +0000 (14:05 +0100)
committerMichael Andres <ma@suse.de>
Sat, 25 Jan 2014 13:05:39 +0000 (14:05 +0100)
zypp/target/TargetImpl.cc

index d698c0e..d1fe711 100644 (file)
@@ -45,6 +45,7 @@
 #include "zypp/target/TargetCallbackReceiver.h"
 #include "zypp/target/rpm/librpmDb.h"
 #include "zypp/target/CommitPackageCache.h"
+#include "zypp/target/RpmPostTransCollector.h"
 
 #include "zypp/parser/ProductFileReader.h"
 
@@ -1487,6 +1488,7 @@ namespace zypp
       MIL << "TargetImpl::commit(<list>" << policy_r << ")" << steps.size() << endl;
 
       bool abort = false;
+      RpmPostTransCollector postTransCollector( _root );
       std::vector<sat::Solvable> successfullyInstalledPackages;
       TargetImpl::PoolItemList remaining;
 
@@ -1563,6 +1565,8 @@ namespace zypp
             try
             {
               progress.tryLevel( target::rpm::InstallResolvableReport::RPM_NODEPS_FORCE );
+             if ( postTransCollector.collectScriptFromPackage( localfile ) )
+               flags |= rpm::RPMINST_NOPOSTTRANS;
              rpm().installPackage( localfile, flags );
               HistoryLog().install(citem);
 
@@ -1707,6 +1711,12 @@ namespace zypp
 
       } // for
 
+      // process all remembered posttrans scripts.
+      if ( !abort )
+       postTransCollector.executeScripts();
+      else
+       postTransCollector.discardScripts();
+
       // Check presence of update scripts/messages. If aborting,
       // at least log omitted scripts.
       if ( ! successfullyInstalledPackages.empty() )