Deprecate old GetResolvablesToInsDel
authorMichael Andres <ma@suse.de>
Tue, 12 Apr 2011 14:00:36 +0000 (16:00 +0200)
committerMichael Andres <ma@suse.de>
Tue, 31 May 2011 10:42:08 +0000 (12:42 +0200)
zypp/pool/GetResolvablesToInsDel.cc
zypp/pool/GetResolvablesToInsDel.h

index 2389382..a6d799c 100644 (file)
 #include <set>
 
 #include "zypp/base/LogTools.h"
+#include "zypp/base/LogControl.h"
 #include "zypp/sat/Solvable.h"
 #include "zypp/sat/WhatObsoletes.h"
 #include "zypp/pool/GetResolvablesToInsDel.h"
 #include "zypp/pool/PoolStats.h"
 #include "zypp/solver/detail/InstallOrder.h"
 
+#include "zypp/Resolver.h"
+#include "zypp/sat/Transaction.h"
+
 using std::endl;
 using zypp::solver::detail::InstallOrder;
 
@@ -69,6 +73,7 @@ namespace zypp
     //
     GetResolvablesToInsDel::GetResolvablesToInsDel( ResPool pool_r, Order order_r )
     {
+      zypp::base::LogControl::TmpLineWriter shutUp;
       typedef std::set<PoolItem> PoolItemSet;
 
       PoolItemList & dellist_r( _toDelete );
@@ -302,6 +307,42 @@ namespace zypp
 
     }
 
+    void GetResolvablesToInsDel::debugDiffTransaction() const
+    {
+      SEC << "START debugDiffTransaction" << endl;
+      sat::Transaction trans( ResPool::instance().resolver().getTransaction() );
+
+      {
+       const PoolItemList & clist( _toDelete );
+       for_( it, clist.begin(), clist.end() )
+       {
+         sat::Transaction::const_iterator ci( trans.find( *it ) );
+         if ( ci == trans.end() )
+           ERR << "Missing to del in NEW trans: " << *it << endl;
+       }
+      }
+      {
+       const PoolItemList & clist( _toInstall );
+       for_( it, clist.begin(), clist.end() )
+       {
+         sat::Transaction::const_iterator ci( trans.find( *it ) );
+         if ( ci == trans.end() )
+           ERR << "Missing to ins in NEW trans: " << *it << endl;
+       }
+      }
+      {
+       const PoolItemList & clist( _toSrcinstall );
+       for_( it, clist.begin(), clist.end() )
+       {
+         sat::Transaction::const_iterator ci( trans.find( *it ) );
+         if ( ci == trans.end() )
+           ERR << "Missing srcins in NEW trans: " << *it << endl;
+       }
+      }
+
+      SEC << "END debugDiffTransaction" << endl;
+    }
+
     /******************************************************************
      **
      **        FUNCTION NAME : operator<<
index ca19dc0..98ff5c3 100644 (file)
@@ -16,6 +16,7 @@
 #include <list>
 
 #include "zypp/ResPool.h"
+#include "zypp/base/Deprecated.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -31,10 +32,10 @@ namespace zypp
     /** Collect transacting items and sort according to prereqs and
      *  media access.
      *
-     * \todo Replace \c enum \c Order and take a functor that
-     * that determines how to group the resolvables.
+     * \deprecated Use class \ref sat::Transaction which does a better job
+     *             esp. when packages are to be deleted.
      */
-    struct GetResolvablesToInsDel
+    struct ZYPP_DEPRECATED GetResolvablesToInsDel
     {
       typedef std::list<PoolItem> PoolItemList;
 
@@ -51,6 +52,9 @@ namespace zypp
       GetResolvablesToInsDel( ResPool pool_r,
                               Order order_r = ORDER_BY_SOURCE );
 
+      /** Diff with new style \ref Transacrion and write result to log. */
+      void debugDiffTransaction() const;
+
       PoolItemList _toDelete;
       PoolItemList _toInstall;
       PoolItemList _toSrcinstall;