[zypp-commit] r8355 - in /branches/tmp/ma/jump_sat/libzypp/zypp: ./ sat/ solver/detail/
Author: schubi2
Date: Thu Jan 24 10:06:37 2008
New Revision: 8355
URL: http://svn.opensuse.org/viewcvs/zypp?rev=8355&view=rev
Log:
- improved error messages
- activated lock/kepp requests
Modified:
branches/tmp/ma/jump_sat/libzypp/zypp/ResolverProblem.cc
branches/tmp/ma/jump_sat/libzypp/zypp/ResolverProblem.h
branches/tmp/ma/jump_sat/libzypp/zypp/sat/SATResolver.cc
branches/tmp/ma/jump_sat/libzypp/zypp/sat/SATResolver.h
branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/ProblemSolutionCombi.cc
branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/ProblemSolutionCombi.h
branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/Resolver.cc
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/ResolverProblem.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/ResolverProblem.cc?rev=8355&r1=8354&r2=8355&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/ResolverProblem.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/ResolverProblem.cc Thu Jan 24 10:06:37 2008
@@ -101,9 +101,14 @@
**/
void
-ResolverProblem::addSolution( ProblemSolution_Ptr solution )
+ResolverProblem::addSolution( ProblemSolution_Ptr solution,
+ bool inFront )
{
- _solutions.push_back (solution);
+ if (inFront) {
+ _solutions.push_front (solution);
+ } else {
+ _solutions.push_back (solution);
+ }
}
void
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/ResolverProblem.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/ResolverProblem.h?rev=8355&r1=8354&r2=8355&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/ResolverProblem.h (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/ResolverProblem.h Thu Jan 24 10:06:37 2008
@@ -97,7 +97,7 @@
* Add a solution to this problem. This class takes over ownership of
* the problem and will delete it when neccessary.
**/
- void addSolution( ProblemSolution_Ptr solution );
+ void addSolution( ProblemSolution_Ptr solution, bool inFront = false );
};
///////////////////////////////////////////////////////////////////////
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/sat/SATResolver.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/sat/SATResolver.cc?rev=8355&r1=8354&r2=8355&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/sat/SATResolver.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/sat/SATResolver.cc Thu Jan 24 10:06:37 2008
@@ -21,7 +21,7 @@
#include "zypp/solver/detail/Helper.h"
#include "zypp/base/String.h"
-#include "zypp/Capabilities.h"
+#include "zypp/Capability.h"
#include "zypp/ResStatus.h"
#include "zypp/base/Logger.h"
#include "zypp/base/String.h"
@@ -33,6 +33,7 @@
#include "zypp/sat/SATResolver.h"
#include "zypp/sat/Pool.h"
#include "zypp/solver/detail/ProblemSolutionCombi.h"
+#include "zypp/solver/detail/Testcase.h"
extern "C" {
#include "satsolver/repo_solv.h"
@@ -94,6 +95,8 @@
, _architecture( zypp_detail::defaultArchitecture() )
{
+ Testcase testcase("/var/log/YaST2/autotestcase");
+ testcase.createTestcasePool (pool); // dump pool to testcase
}
@@ -166,17 +169,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 +329,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;
}
@@ -357,8 +347,32 @@
//----------------------------------------------------------------------------
+class CheckIfUpdate : public resfilter::PoolItemFilterFunctor
+{
+ public:
+ bool is_updated;
+
+ CheckIfUpdate()
+ : is_updated( false )
+ {}
+
+ // check this item will be installed
+
+ bool operator()( PoolItem_Ref item )
+ {
+ if (item.status().isToBeInstalled())
+ {
+ is_updated = true;
+ return false;
+ }
+ return true;
+ }
+};
+
+
bool
-SATResolver::resolvePool()
+SATResolver::resolvePool(const CapabilitySet & requires_caps,
+ const CapabilitySet & conflict_caps)
{
SATCollectTransact info (*this);
MIL << "SATResolver::resolvePool()" << endl;
@@ -373,6 +387,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
@@ -404,6 +419,33 @@
queue_push( &(jobQueue), SOLVER_ERASE_SOLVABLE_NAME );
queue_push( &(jobQueue), s->name);
}
+
+ for (CapabilitySet::const_iterator iter = requires_caps.begin(); iter != requires_caps.end(); iter++) {
+ queue_push( &(jobQueue), SOLVER_INSTALL_SOLVABLE_PROVIDES );
+ queue_push( &(jobQueue), str2id( _SATPool, (iter->asString()).c_str(), 1 ) );
+ MIL << "Requires " << iter->asString() << endl;
+ }
+
+ for (CapabilitySet::const_iterator iter = conflict_caps.begin(); iter != conflict_caps.end(); iter++) {
+ queue_push( &(jobQueue), SOLVER_ERASE_SOLVABLE_PROVIDES);
+ 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();
sat::Pool::instance().prepare();
@@ -426,19 +468,6 @@
ERR << "Solverrun finished with an ERROR" << endl;
return false;
}
- /* solvables to be erased */
- for (int i = solv->installed->start; i < solv->installed->start + solv->installed->nsolvables; i++)
- {
- if (solv->decisionmap[i] > 0)
- continue;
-
- PoolItem_Ref poolItem = _pool.find (sat::Solvable(i));
- if (poolItem) {
- SATSolutionToPool (poolItem, ResStatus::toBeUninstalled, ResStatus::SOLVER);
- } else {
- ERR << "id " << i << " not found in ZYPP pool." << endl;
- }
- }
/* solvables to be installed */
for (int i = 0; i < solv->decisionq.count; i++)
@@ -458,6 +487,32 @@
}
}
+ /* solvables to be erased */
+ for (int i = solv->installed->start; i < solv->installed->start + solv->installed->nsolvables; i++)
+ {
+ if (solv->decisionmap[i] > 0)
+ continue;
+
+ PoolItem_Ref poolItem = _pool.find (sat::Solvable(i));
+ if (poolItem) {
+ // Check if this is an update
+ CheckIfUpdate info;
+ invokeOnEach( _pool.byNameBegin( poolItem->name() ),
+ _pool.byNameEnd( poolItem->name() ),
+ functor::chain (resfilter::ByUninstalled (), // ByUninstalled
+ resfilter::ByKind( poolItem->kind() ) ), // equal kind
+ functor::functorRef
participants (1)
-
schubi2@svn.opensuse.org