From: Stefan Schubert Date: Fri, 4 Apr 2008 15:05:04 +0000 (+0000) Subject: distinguish between keep and lock in the solver request X-Git-Tag: 6.6.0~1169 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ba92f4e1de1098047a6bd5c37aa4960d9b57aad4;p=platform%2Fupstream%2Flibzypp.git distinguish between keep and lock in the solver request --- diff --git a/zypp/sat/SATResolver.cc b/zypp/sat/SATResolver.cc index f38d7e0ec..292d71c08 100644 --- a/zypp/sat/SATResolver.cc +++ b/zypp/sat/SATResolver.cc @@ -215,6 +215,12 @@ SATResolver::addPoolItemToLock (PoolItem item) _items_to_lock.unique (); } +void +SATResolver::addPoolItemToKeep (PoolItem item) +{ + _items_to_keep.push_back (item); + _items_to_keep.unique (); +} //--------------------------------------------------------------------------- @@ -337,10 +343,13 @@ struct SATCollectTransact : public resfilter::PoolItemFilterFunctor resolver.addPoolItemToRemove(item); // -> remove ! } else if (status.isLocked() - || (status.isKept() - && !by_solver)) { - resolver.addPoolItemToLock (item); + && !by_solver) { + resolver.addPoolItemToLock (item); } + else if (status.isKept() + && !by_solver) { + resolver.addPoolItemToKeep (item); + } return true; } @@ -396,6 +405,7 @@ SATResolver::resolvePool(const CapabilitySet & requires_caps, _items_to_install.clear(); _items_to_remove.clear(); _items_to_lock.clear(); + _items_to_keep.clear(); invokeOnEach ( _pool.begin(), _pool.end(), functor::functorRef(info) ); @@ -444,6 +454,19 @@ SATResolver::resolvePool(const CapabilitySet & requires_caps, } } + for (PoolItemList::const_iterator iter = _items_to_keep.begin(); iter != _items_to_keep.end(); iter++) { + sat::detail::SolvableIdType ident( (*iter)->satSolvable().id() ); + if (iter->status().isInstalled()) { + MIL << "Keep installed item " << *iter << " with the string ID: " << ident << endl; + queue_push( &(_jobQueue), SOLVER_INSTALL_SOLVABLE | SOLVER_WEAK); + queue_push( &(_jobQueue), ident ); + } else { + MIL << "Keep NOT installed item " << *iter << " with the string ID: " << ident << endl; + queue_push( &(_jobQueue), SOLVER_ERASE_SOLVABLE | SOLVER_WEAK); + queue_push( &(_jobQueue), ident ); + } + } + _solv = solver_create( _SATPool, sat::Pool::instance().systemRepo().get() ); _solv->vendorCheckCb = &vendorCheck; _solv->fixsystem = _fixsystem; diff --git a/zypp/sat/SATResolver.h b/zypp/sat/SATResolver.h index 0ea8b0473..2ae148657 100644 --- a/zypp/sat/SATResolver.h +++ b/zypp/sat/SATResolver.h @@ -68,6 +68,7 @@ class SATResolver : public base::ReferenceCounted, private base::NonCopyable { PoolItemList _items_to_install; PoolItemList _items_to_remove; PoolItemList _items_to_lock; + PoolItemList _items_to_keep; bool _fixsystem; // repair errors in rpm dependency graph bool _allowdowngrade; // allow to downgrade installed solvable @@ -108,6 +109,7 @@ class SATResolver : public base::ReferenceCounted, private base::NonCopyable { void addPoolItemsToInstallFromList (PoolItemList & rl); void addPoolItemToLock (PoolItem item); + void addPoolItemToKeep (PoolItem item); void addPoolItemToRemove (PoolItem item); void addPoolItemsToRemoveFromList (PoolItemList & rl);