Transaction: remember resolvers list of autoinstalled solvables
authorMichael Andres <ma@suse.de>
Mon, 28 Apr 2014 10:11:59 +0000 (12:11 +0200)
committerMichael Andres <ma@suse.de>
Mon, 28 Apr 2014 10:11:59 +0000 (12:11 +0200)
zypp/sat/Transaction.cc
zypp/sat/Transaction.h
zypp/solver/detail/Resolver.cc
zypp/solver/detail/SATResolver.cc
zypp/solver/detail/SATResolver.h

index 18d86fe..537a8f3 100644 (file)
@@ -189,6 +189,12 @@ namespace zypp
        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
        {
@@ -281,6 +287,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()
@@ -346,6 +354,11 @@ namespace zypp
     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; }
index e41f726..fcb843f 100644 (file)
@@ -24,6 +24,7 @@ extern "C"
 
 #include "zypp/sat/SolvIterMixin.h"
 #include "zypp/sat/Solvable.h"
+#include "zypp/sat/Queue.h"
 
 #include "zypp/PoolItem.h"
 
@@ -34,8 +35,6 @@ namespace zypp
   namespace sat
   { /////////////////////////////////////////////////////////////////
 
-    class Queue;
-
     namespace detail
     {
       /** Needs to be outside \ref Transaction in order to be usable in SolvIterMixin. */
@@ -178,6 +177,12 @@ namespace zypp
         * packages is returned. (wraps libsolv::transaction_installedresult) */
        int installedResult( Queue & result_r ) const;
 
+       /** Return the ident strings of all packages that would be auto-installed after the transaction is run. */
+       StringQueue autoInstalled() const;
+
+       /** Set the ident strings of all packages that would be auto-installed after the transaction is run. */
+       void autoInstalled( const StringQueue & queue_r );
+
       public:
         /** Implementation  */
         class Impl;
index 5911f7a..1658e88 100644 (file)
@@ -361,7 +361,10 @@ bool Resolver::resolveQueue( solver::detail::SolverQueueItemList & queue )
 
 sat::Transaction Resolver::getTransaction()
 {
-  return sat::Transaction( sat::Transaction::loadFromPool );
+  // FIXME: That's an ugly way of pushing autoInstalled into the transaction.
+  sat::Transaction ret( sat::Transaction::loadFromPool );
+  ret.autoInstalled( _satResolver->autoInstalled() );
+  return ret;
 }
 
 
index 6fdb55c..a34b3f2 100644 (file)
@@ -1483,6 +1483,22 @@ void SATResolver::setSystemRequirements()
     }
 }
 
+sat::StringQueue SATResolver::autoInstalled() const
+{
+  sat::StringQueue ret;
+  if ( _solv )
+    ::solver_get_userinstalled( _solv, ret, GET_USERINSTALLED_NAMES|GET_USERINSTALLED_INVERTED );
+  return ret;
+}
+
+sat::StringQueue SATResolver::userInstalled() const
+{
+  sat::StringQueue ret;
+  if ( _solv )
+    ::solver_get_userinstalled( _solv, ret, GET_USERINSTALLED_NAMES );
+  return ret;
+}
+
 
 ///////////////////////////////////////////////////////////////////
 };// namespace detail
index 7aaef03..2d645da 100644 (file)
@@ -216,6 +216,8 @@ class SATResolver : public base::ReferenceCounted, private base::NonCopyable {
     PoolItemList resultItemsToRemove () { return _result_items_to_remove; }
     PoolItemList problematicUpdateItems() { return _problem_items; }
 
+    sat::StringQueue autoInstalled() const;
+    sat::StringQueue userInstalled() const;
 };
 
 ///////////////////////////////////////////////////////////////////