errormessage enabled for SAT solver
authorStefan Schubert <schubi@suse.de>
Thu, 29 Nov 2007 17:33:37 +0000 (17:33 +0000)
committerStefan Schubert <schubi@suse.de>
Thu, 29 Nov 2007 17:33:37 +0000 (17:33 +0000)
zypp/sat/SATResolver.cc
zypp/solver/detail/Resolver.cc
zypp/solver/detail/Resolver.h
zypp/solver/detail/Resolver_problems.cc

index 1d8acee3e75c29942dbc031080cae272f76011f1..1f7c866a4ffc4f516202e2c7f1178ad46f79b325 100644 (file)
@@ -411,6 +411,11 @@ SATResolver::resolvePool()
     // copying solution back to zypp pool
     //-----------------------------------------
 
+    if (solv->problems.count > 0 )
+    {
+       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++)
     {
index 736732dfd4d838a3d3100bb66e3c9c7444bbda3b..a66a18d3e6756bdf4e2664d6ca8e8e5232b4a6ac 100644 (file)
@@ -110,6 +110,7 @@ void assertSystemResObjectInPool()
 
 Resolver::Resolver (const ResPool & pool)
     : _pool (pool)
+    , _satResolver (NULL)
     , _poolchanged( _pool.serial() )
     , _timeout_seconds (0)
     , _maxSolverPasses (0)
@@ -1284,11 +1285,14 @@ Resolver::resolvePool( bool tryAllPossibilities )
 {
 
     // Solving with the satsolver
-    if ( getenv("ZYPP_SAT_SOLVER") ) {
-       MIL << "-------------- Calling SAT Solver -------------------" << endl; 
-       // syncing with sat pool
-       sat::Pool satPool( sat::Pool::instance() );
-       _pool.satSync();
+    if ( getenv("ZYPP_SAT_SOLVER")) {
+       MIL << "-------------- Calling SAT Solver -------------------" << endl;
+       if ( !_satResolver ) { 
+           // syncing with sat pool
+           sat::Pool satPool( sat::Pool::instance() );
+           _pool.satSync();
+           _satResolver = new SATResolver(_pool, satPool.get());
+       }
 #if 0
        MIL << "------SAT-Pool------" << endl;
        for (sat::Pool::SolvableIterator i = satPool.solvablesBegin();
@@ -1297,9 +1301,7 @@ Resolver::resolvePool( bool tryAllPossibilities )
        }
        MIL << "------SAT-Pool end------" << endl;
 #endif
-       
-       SATResolver satResolver(_pool, satPool.get());
-       return satResolver.resolvePool();
+       return _satResolver->resolvePool();
     }
     
     ResolverContext_Ptr saveContext = _best_context;
index 3a92e631e5a4a75ea674108a8d1151870d9d9529..00fdf2088fde670edc16431630a0f589a83538cf 100644 (file)
@@ -42,7 +42,6 @@
 #include "zypp/ResolverProblem.h"
 #include "zypp/ProblemSolution.h"
 #include "zypp/UpgradeStatistics.h"
-
 #include "zypp/CapSet.h"
 
 
@@ -56,6 +55,10 @@ namespace zypp
     namespace detail
     { ///////////////////////////////////////////////////////////////////
 
+    class SATResolver;
+
+
+       
     ///////////////////////////////////////////////////////////////////
     //
     // CLASS NAME : ItemCapKind
@@ -89,6 +92,7 @@ class Resolver : public base::ReferenceCounted, private base::NonCopyable {
 
   private:
     ResPool _pool;
+    SATResolver *_satResolver;
     SerialNumberWatcher _poolchanged;
 
     unsigned _timeout_seconds;
index d534042f74e866ebe42ebb66e70d8966fab568b5..2613861fecc5c207b51de7efe00dfc17d10eb547 100644 (file)
@@ -42,6 +42,7 @@
 #include "zypp/solver/detail/ResolverInfoMissingReq.h"
 #include "zypp/solver/detail/ResolverInfoNeededBy.h"
 #include "zypp/solver/detail/ResolverInfoObsoletes.h"
+#include "zypp/sat/SATResolver.h"
 
 #include "zypp/base/String.h"
 #include "zypp/base/Logger.h"
@@ -345,6 +346,9 @@ moreDetails( ResolverContext_Ptr context, PoolItem_Ref item )
 ResolverProblemList
 Resolver::problems (const bool ignoreValidSolution) const
 {
+    if ( getenv("ZYPP_SAT_SOLVER") && _satResolver )
+       return _satResolver->problems();
+           
     ResolverProblemList problems;
 
     MIL << "Resolver::problems(" << (ignoreValidSolution ? "ignoreValidSolution": "") << ")" << endl;