From: Michael Andres Date: Mon, 28 Apr 2014 10:11:59 +0000 (+0200) Subject: Transaction: remember resolvers list of autoinstalled solvables X-Git-Tag: upstream/14.27.0~57 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c2c82bf03e56661a24cf9a92dec3547e76bfcf72;p=platform%2Fupstream%2Flibzypp.git Transaction: remember resolvers list of autoinstalled solvables --- diff --git a/zypp/sat/Transaction.cc b/zypp/sat/Transaction.cc index 18d86fe..537a8f3 100644 --- a/zypp/sat/Transaction.cc +++ b/zypp/sat/Transaction.cc @@ -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 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; } diff --git a/zypp/sat/Transaction.h b/zypp/sat/Transaction.h index e41f726..fcb843f 100644 --- a/zypp/sat/Transaction.h +++ b/zypp/sat/Transaction.h @@ -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; diff --git a/zypp/solver/detail/Resolver.cc b/zypp/solver/detail/Resolver.cc index 5911f7a..1658e88 100644 --- a/zypp/solver/detail/Resolver.cc +++ b/zypp/solver/detail/Resolver.cc @@ -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; } diff --git a/zypp/solver/detail/SATResolver.cc b/zypp/solver/detail/SATResolver.cc index 6fdb55c..a34b3f2 100644 --- a/zypp/solver/detail/SATResolver.cc +++ b/zypp/solver/detail/SATResolver.cc @@ -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 diff --git a/zypp/solver/detail/SATResolver.h b/zypp/solver/detail/SATResolver.h index 7aaef03..2d645da 100644 --- a/zypp/solver/detail/SATResolver.h +++ b/zypp/solver/detail/SATResolver.h @@ -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; }; ///////////////////////////////////////////////////////////////////