*/
#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"
#define MAXSOLVERRUNS 5
+using std::endl;
+using std::make_pair;
+
/////////////////////////////////////////////////////////////////////////
namespace zypp
{ ///////////////////////////////////////////////////////////////////////
namespace detail
{ ///////////////////////////////////////////////////////////////////
-using namespace std;
-
-IMPL_PTR_TYPE(Resolver);
-
+ //using namespace std;
//---------------------------------------------------------------------------
}
//---------------------------------------------------------------------------
+// forward flags too SATResolver
+#define ZOLV_FLAG_TRIBOOL( ZSETTER, ZGETTER, ZVARNAME, ZVARDEFAULT ) \
+ void Resolver::ZSETTER( TriBool state_r ) \
+ { _satResolver->ZVARNAME = indeterminate(state_r) ? ZVARDEFAULT : bool(state_r); } \
+ 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() )
+
+#undef ZOLV_FLAG_TRIBOOL
+//---------------------------------------------------------------------------
void Resolver::setAllowVendorChange( TriBool state_r )
{
{
UndoTransact resetting (ResStatus::APPL_HIGH);
- _DEBUG ("Resolver::verifySystem() ");
+ DBG << "Resolver::verifySystem()" << endl;
_verifying = true;
//----------------------------------------------------------------------------
// undo
-
void Resolver::undo()
{
UndoTransact info(ResStatus::APPL_LOW);
sat::Transaction Resolver::getTransaction()
{
- return sat::Transaction( sat::Transaction::loadFromPool );
+ // FIXME: That's an ugly way of pushing autoInstalled into the transaction.
+ sat::Transaction ret( sat::Transaction::loadFromPool );
+ ret.autoInstalled( _satResolver->autoInstalled() );
+ return ret;
}
void Resolver::applySolutions( const ProblemSolutionList & solutions )
{
- for_( iter, solutions.begin(), solutions.end() )
+ for ( ProblemSolution_Ptr solution : solutions )
+ {
+ if ( ! applySolution( *solution ) )
+ break;
+ }
+}
+
+bool Resolver::applySolution( const ProblemSolution & solution )
+{
+ bool ret = true;
+ DBG << "apply solution " << solution << endl;
+ for ( SolutionAction_Ptr action : solution.actions() )
{
- ProblemSolution_Ptr solution = *iter;
- if ( !solution->apply( *this ) )
+ if ( ! action->execute( *this ) )
+ {
+ WAR << "apply solution action failed: " << action << endl;
+ ret = false;
break;
+ }
}
+ return ret;
}
+//----------------------------------------------------------------------------
+
void Resolver::collectResolverInfo()
{
if ( _satResolver
&& !found) {
alreadySetForInstallation = true;
ItemCapKind capKind = pos->second;
- if (capKind.item == *instIter) found = true;
+ if (capKind.item() == *instIter) found = true;
pos++;
}
&& !found) {
alreadySetForInstallation = true;
ItemCapKind capKind = pos->second;
- if (capKind.item == *instIter) found = true;
+ if (capKind.item() == *instIter) found = true;
pos++;
}
&& !found) {
alreadySetForInstallation = true;
ItemCapKind capKind = pos->second;
- if (capKind.item == provider) found = true;
+ if (capKind.item() == provider) found = true;
pos++;
}