Author: schubi2 Date: Thu Jan 17 16:23:46 2008 New Revision: 8315 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8315&view=rev Log: enabled locking in SAT solver Modified: trunk/libzypp/zypp/sat/SATResolver.cc trunk/libzypp/zypp/sat/SATResolver.h Modified: trunk/libzypp/zypp/sat/SATResolver.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SATResolver.cc?rev=8315&r1=8314&r2=8315&view=diff ============================================================================== --- trunk/libzypp/zypp/sat/SATResolver.cc (original) +++ trunk/libzypp/zypp/sat/SATResolver.cc Thu Jan 17 16:23:46 2008 @@ -166,17 +166,10 @@ } void -SATResolver::addPoolItemToLockUninstalled (PoolItem_Ref item) +SATResolver::addPoolItemToLock (PoolItem_Ref item) { - _items_to_lockUninstalled.push_back (item); - _items_to_lockUninstalled.unique (); -} - -void -SATResolver::addPoolItemToKepp (PoolItem_Ref item) -{ - _items_to_keep.push_back (item); - _items_to_keep.unique (); + _items_to_lock.push_back (item); + _items_to_lock.unique (); } @@ -333,17 +326,11 @@ } if (status.isLocked() - && status.isUninstalled()) { - // This item could be selected by solver in a former run. Now it - // is locked. So we will have to evaluate a new solver run. - resolver.addPoolItemToLockUninstalled (item); + || (status.isKept() + && !by_solver)) { + resolver.addPoolItemToLock (item); } - if (status.isKept() - && !by_solver) { - // collecting all keep states - resolver.addPoolItemToKepp (item); - } return true; } @@ -397,6 +384,7 @@ queue_init( &jobQueue ); _items_to_install.clear(); _items_to_remove.clear(); + _items_to_lock.clear(); invokeOnEach ( _pool.begin(), _pool.end(), resfilter::ByTransact( ), // collect transacts from Pool to resolver queue @@ -440,6 +428,20 @@ queue_push( &(jobQueue), str2id( _SATPool, (iter->asString()).c_str(), 1 )); MIL << "Conflicts " << iter->asString() << endl; } + + for (PoolItemList::const_iterator iter = _items_to_lock.begin(); iter != _items_to_lock.end(); iter++) { + Solvable *s = _SATPool->solvables + iter->satSolvable().id(); + Id id = iter->satSolvable().id(); + if (iter->status().isInstalled()) { + MIL << "Lock installed item " << *iter << " with the string ID: " << s->name << endl; + queue_push( &(jobQueue), SOLVER_INSTALL_SOLVABLE ); + queue_push( &(jobQueue), id ); + } else { + MIL << "Lock NOT installed item " << *iter << " with the string ID: " << s->name << endl; + queue_push( &(jobQueue), SOLVER_ERASE_SOLVABLE ); + queue_push( &(jobQueue), id ); + } + } solv = solver_create( _SATPool, sat::Pool::instance().systemRepo().get() ); sat::Pool::instance().setDirty(); Modified: trunk/libzypp/zypp/sat/SATResolver.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SATResolver.h?rev=8315&r1=8314&r2=8315&view=diff ============================================================================== --- trunk/libzypp/zypp/sat/SATResolver.h (original) +++ trunk/libzypp/zypp/sat/SATResolver.h Thu Jan 17 16:23:46 2008 @@ -74,8 +74,7 @@ // list populated by calls to addPoolItemTo*() PoolItemList _items_to_install; PoolItemList _items_to_remove; - PoolItemList _items_to_lockUninstalled; - PoolItemList _items_to_keep; + PoolItemList _items_to_lock; // ---------------------------------- methods std::string SATprobleminfoString (Id problem); @@ -114,8 +113,7 @@ void addPoolItemToInstall (PoolItem_Ref item); void addPoolItemsToInstallFromList (PoolItemList & rl); - void addPoolItemToLockUninstalled (PoolItem_Ref item); - void addPoolItemToKepp (PoolItem_Ref item); + void addPoolItemToLock (PoolItem_Ref item); void addPoolItemToRemove (PoolItem_Ref item); void addPoolItemsToRemoveFromList (PoolItemList & rl); -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org