Imported Upstream version 16.3.2
[platform/upstream/libzypp.git] / zypp / sat / Transaction.cc
index 67502ec..2f01f90 100644 (file)
@@ -18,7 +18,7 @@ extern "C"
 #include "zypp/base/SerialNumber.h"
 #include "zypp/base/DefaultIntegral.h"
 #include "zypp/base/NonCopyable.h"
-#include "zypp/base/Tr1hash.h"
+#include "zypp/base/Hash.h"
 
 #include "zypp/sat/detail/PoolImpl.h"
 #include "zypp/sat/Transaction.h"
@@ -50,8 +50,8 @@ namespace zypp
       friend std::ostream & operator<<( std::ostream & str, const Impl & obj );
 
       public:
-       typedef std::tr1::unordered_set<detail::IdType> set_type;
-       typedef std::tr1::unordered_map<detail::IdType,detail::IdType> map_type;
+       typedef std::unordered_set<detail::IdType> set_type;
+       typedef std::unordered_map<detail::IdType,detail::IdType> map_type;
 
        struct PostMortem
        {
@@ -67,30 +67,29 @@ namespace zypp
          Edition  _edition;
          Arch     _arch;
        };
-       typedef std::tr1::unordered_map<detail::IdType,PostMortem> pmmap_type;
+       typedef std::unordered_map<detail::IdType,PostMortem> pmmap_type;
 
       public:
        Impl()
          : _trans( ::transaction_create( nullptr ) )
-       { memset( _trans, 0, sizeof(_trans) ); }
+       { memset( _trans, 0, sizeof(*_trans) ); }
 
-       Impl( Default )
+       Impl( LoadFromPoolType )
          : _watcher( myPool().serial() )
          , _trans( nullptr )
        {
          Queue decisionq;
-         for_( it, ResPool::instance().begin(), ResPool::instance().end() )
+         for ( const PoolItem & pi : ResPool::instance() )
          {
-           if ( ! (*it).status().transacts() )
+           if ( ! pi.status().transacts() )
              continue;
-           sat::Solvable solv( (*it).satSolvable() );
-           decisionq.push( solv.isSystem() ? -solv.id() : solv.id() );
+           decisionq.push( pi.isSystem() ? -pi.id() : pi.id() );
          }
          Queue noobsq;
-         for_( it, sat::Pool::instance().multiversionBegin(), sat::Pool::instance().multiversionEnd() )
+         for ( const Solvable & solv : myPool().multiversionList() )
          {
-           noobsq.push( SOLVER_NOOBSOLETES | SOLVABLE_NAME );
-           noobsq.push( it->id() );
+           noobsq.push( SOLVER_NOOBSOLETES | SOLVER_SOLVABLE );
+           noobsq.push( solv.id() );
          }
          Map noobsmap;
          ::solver_calculate_noobsmap( myPool().getPool(), noobsq, noobsmap );
@@ -186,6 +185,16 @@ namespace zypp
        { detail::IdType * it( _find( solv_r ) ); return it ? iterator( self_r, it ) : end( self_r ); }
 
       public:
+       int installedResult( Queue & result_r ) const
+       { return ::transaction_installedresult( _trans, result_r ); }
+
+       StringQueue autoInstalled() const
+       { return _autoInstalled; }
+
+       void autoInstalled( const StringQueue & queue_r )
+       { _autoInstalled = queue_r; }
+
+      public:
        StepType stepType( Solvable solv_r ) const
        {
          if ( ! solv_r )
@@ -277,6 +286,8 @@ namespace zypp
        set_type        _systemErase;   // @System packages to be eased (otherse are TRANSACTION_IGNORE)
        pmmap_type      _pmMap;         // Post mortem data of deleted @System solvables
 
+       StringQueue     _autoInstalled; // ident strings of all packages that would be auto-installed after the transaction is run.
+
       public:
         /** Offer default Impl. */
         static shared_ptr<Impl> nullimpl()
@@ -302,8 +313,8 @@ namespace zypp
       : _pimpl( Impl::nullimpl() )
     {}
 
-    Transaction::Transaction( Default )
-      : _pimpl( new Impl( Default() ) )
+    Transaction::Transaction( LoadFromPoolType )
+      : _pimpl( new Impl( loadFromPool ) )
     {}
 
     Transaction::~Transaction()
@@ -339,6 +350,15 @@ namespace zypp
     Transaction::iterator Transaction::find( const sat::Solvable & solv_r )
     { return _pimpl->find( _pimpl, solv_r ); }
 
+    int Transaction::installedResult( Queue & result_r ) const
+    { return _pimpl->installedResult( result_r ); }
+
+    StringQueue Transaction::autoInstalled() const
+    { return _pimpl->autoInstalled(); }
+
+    void Transaction::autoInstalled( const StringQueue & queue_r )
+    { _pimpl->autoInstalled( queue_r ); }
+
     std::ostream & operator<<( std::ostream & str, const Transaction & obj )
     { return str << *obj._pimpl; }