Imported Upstream version 14.45.0
[platform/upstream/libzypp.git] / zypp / solver / detail / Resolver.cc
index 7801a50..8fd3f31 100644 (file)
  */
 #include <boost/static_assert.hpp>
 
-#define ZYPP_USE_RESOLVER_INTERNALS
-
 #include "zypp/solver/detail/Resolver.h"
+#include "zypp/solver/detail/Helper.h"
 #include "zypp/solver/detail/Testcase.h"
 #include "zypp/solver/detail/SATResolver.h"
-#include "zypp/solver/detail/ItemCapKind.h"
-#include "zypp/solver/detail/SolutionAction.h"
-#include "zypp/solver/detail/SolverQueueItem.h"
 
 #include "zypp/Capabilities.h"
 #include "zypp/ZConfig.h"
@@ -44,9 +40,6 @@
 
 #define MAXSOLVERRUNS 5
 
-using std::endl;
-using std::make_pair;
-
 /////////////////////////////////////////////////////////////////////////
 namespace zypp
 { ///////////////////////////////////////////////////////////////////////
@@ -57,7 +50,10 @@ namespace zypp
     namespace detail
     { ///////////////////////////////////////////////////////////////////
 
-      //using namespace std;
+using namespace std;
+
+IMPL_PTR_TYPE(Resolver);
+
 
 //---------------------------------------------------------------------------
 
@@ -115,10 +111,10 @@ Resolver::~Resolver()
     bool Resolver::ZGETTER() const                                                     \
     { return _satResolver->ZVARNAME; }                                                 \
 
-ZOLV_FLAG_TRIBOOL( dupSetAllowDowngrade,       dupAllowDowngrade,      _dup_allowdowngrade,    ZConfig::instance().solver_dupAllowDowngrade() )
-ZOLV_FLAG_TRIBOOL( dupSetAllowNameChange,      dupAllowNameChange,     _dup_allownamechange,   ZConfig::instance().solver_dupAllowNameChange() )
-ZOLV_FLAG_TRIBOOL( dupSetAllowArchChange,      dupAllowArchChange,     _dup_allowarchchange,   ZConfig::instance().solver_dupAllowArchChange() )
-ZOLV_FLAG_TRIBOOL( dupSetAllowVendorChange,    dupAllowVendorChange,   _dup_allowvendorchange, ZConfig::instance().solver_dupAllowVendorChange() )
+ZOLV_FLAG_TRIBOOL( dupSetAllowDowngrade,       dupAllowDowngrade,      _dup_allowdowngrade,    true )
+ZOLV_FLAG_TRIBOOL( dupSetAllowNameChange,      dupAllowNameChange,     _dup_allownamechange,   true )
+ZOLV_FLAG_TRIBOOL( dupSetAllowArchChange,      dupAllowArchChange,     _dup_allowarchchange,   true )
+ZOLV_FLAG_TRIBOOL( dupSetAllowVendorChange,    dupAllowVendorChange,   _dup_allowvendorchange, true )
 
 #undef ZOLV_FLAG_TRIBOOL
 //---------------------------------------------------------------------------
@@ -259,7 +255,7 @@ bool Resolver::verifySystem()
 {
     UndoTransact resetting (ResStatus::APPL_HIGH);
 
-    DBG << "Resolver::verifySystem()" << endl;
+    _DEBUG ("Resolver::verifySystem() ");
 
     _verifying = true;
 
@@ -396,31 +392,14 @@ ResolverProblemList Resolver::problems() const
 
 void Resolver::applySolutions( const ProblemSolutionList & solutions )
 {
-  for ( ProblemSolution_Ptr solution : solutions )
+  for_( iter, solutions.begin(), solutions.end() )
   {
-    if ( ! applySolution( *solution ) )
+    ProblemSolution_Ptr solution = *iter;
+    if ( !solution->apply( *this ) )
       break;
   }
 }
 
-bool Resolver::applySolution( const ProblemSolution & solution )
-{
-  bool ret = true;
-  DBG << "apply solution " << solution << endl;
-  for ( SolutionAction_Ptr action : solution.actions() )
-  {
-    if ( ! action->execute( *this ) )
-    {
-      WAR << "apply solution action failed: " << action << endl;
-      ret = false;
-      break;
-    }
-  }
-  return ret;
-}
-
-//----------------------------------------------------------------------------
-
 void Resolver::collectResolverInfo()
 {
     if ( _satResolver
@@ -448,7 +427,7 @@ void Resolver::collectResolverInfo()
                           && !found) {
                        alreadySetForInstallation = true;
                        ItemCapKind capKind = pos->second;
-                       if (capKind.item() == *instIter)  found = true;
+                       if (capKind.item == *instIter)  found = true;
                        pos++;
                    }
 
@@ -493,7 +472,7 @@ void Resolver::collectResolverInfo()
                               && !found) {
                            alreadySetForInstallation = true;
                            ItemCapKind capKind = pos->second;
-                           if (capKind.item() == *instIter)  found = true;
+                           if (capKind.item == *instIter)  found = true;
                            pos++;
                        }
 
@@ -536,7 +515,7 @@ void Resolver::collectResolverInfo()
                               && !found) {
                            alreadySetForInstallation = true;
                            ItemCapKind capKind = pos->second;
-                           if (capKind.item() == provider)  found = true;
+                           if (capKind.item == provider)  found = true;
                            pos++;
                        }