1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/Resolver.cc
14 #include "zypp/Resolver.h"
15 #include "zypp/ZConfig.h"
16 #include "zypp/TriBool.h"
17 #include "zypp/UpgradeStatistics.h"
18 #include "zypp/solver/detail/Resolver.h"
19 #include "zypp/solver/detail/Testcase.h"
23 ///////////////////////////////////////////////////////////////////
25 { /////////////////////////////////////////////////////////////////
27 using namespace solver;
29 IMPL_PTR_TYPE(Resolver);
31 Resolver_Ptr Resolver::_resolver = NULL;
32 Resolver_Ptr Resolver::resolver()
34 if (_resolver == NULL) {
35 _resolver = new Resolver();
40 ///////////////////////////////////////////////////////////////////
42 // METHOD NAME : Resolver::Resolver
45 Resolver::Resolver( const ResPool & pool )
47 _pimpl = new solver::detail::Resolver(pool);
50 ///////////////////////////////////////////////////////////////////
52 // METHOD NAME : Resolver::~Resolver
58 ///////////////////////////////////////////////////////////////////
60 // Resolver interface forwarded to implementation
62 ///////////////////////////////////////////////////////////////////
63 bool Resolver::verifySystem ()
64 { return _pimpl->verifySystem(); }
65 bool Resolver::resolvePool ()
66 { return _pimpl->resolvePool(); }
67 bool Resolver::resolveQueue (zypp::solver::detail::SolverQueueItemList & queue)
68 { return _pimpl->resolveQueue(queue); }
71 ResolverProblemList Resolver::problems ()
72 { return _pimpl->problems (); }
73 void Resolver::applySolutions( const ProblemSolutionList & solutions )
74 { _pimpl->applySolutions (solutions); }
75 bool Resolver::doUpgrade( UpgradeStatistics & opt_stats_r )
76 { return _pimpl->doUpgrade(opt_stats_r); }
77 void Resolver::doUpdate()
78 { _pimpl->doUpdate(); }
79 void Resolver::setForceResolve( const bool force )
80 { _pimpl->setForceResolve( force ); }
81 bool Resolver::forceResolve()
82 { return _pimpl->forceResolve(); }
83 void Resolver::setOnlyRequires( const bool onlyRequires )
84 { onlyRequires ? _pimpl->setOnlyRequires( true ) : _pimpl->setOnlyRequires( false ); }
85 void Resolver::resetOnlyRequires()
86 { _pimpl->setOnlyRequires( indeterminate ); }
87 bool Resolver::onlyRequires()
89 if (_pimpl->onlyRequires() == indeterminate)
90 return ZConfig::instance().solver_onlyRequires();
92 return _pimpl->onlyRequires();
95 void Resolver::addRequire (const Capability & capability)
96 { _pimpl->addExtraRequire( capability ); }
97 void Resolver::addConflict (const Capability & capability)
98 { _pimpl->addExtraConflict( capability ); }
99 void Resolver::removeRequire (const Capability & capability)
100 { _pimpl->removeExtraRequire( capability ); }
101 void Resolver::removeConflict (const Capability & capability)
102 { _pimpl->removeExtraConflict( capability ); }
103 const CapabilitySet Resolver::getRequire ()
104 { return _pimpl->extraRequires();}
105 const CapabilitySet Resolver::getConflict ()
106 { return _pimpl->extraConflicts();}
107 std::list<PoolItem> Resolver::problematicUpdateItems( void ) const
108 { return _pimpl->problematicUpdateItems(); }
109 bool Resolver::createSolverTestcase (const std::string & dumpPath)
110 { solver::detail::Testcase testcase (dumpPath);
111 return testcase.createTestcase(*_pimpl);}
114 /////////////////////////////////////////////////////////////////
116 ///////////////////////////////////////////////////////////////////