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/solver/detail/Resolver.h"
18 #include "zypp/solver/detail/Testcase.h"
22 ///////////////////////////////////////////////////////////////////
24 { /////////////////////////////////////////////////////////////////
26 using namespace solver;
28 IMPL_PTR_TYPE(Resolver);
30 ///////////////////////////////////////////////////////////////////
32 // METHOD NAME : Resolver::Resolver
35 Resolver::Resolver( const ResPool & pool )
36 : _pimpl( new Impl(pool) )
39 ///////////////////////////////////////////////////////////////////
41 // METHOD NAME : Resolver::~Resolver
47 ///////////////////////////////////////////////////////////////////
49 // Resolver interface forwarded to implementation
51 ///////////////////////////////////////////////////////////////////
52 bool Resolver::verifySystem ()
53 { return _pimpl->verifySystem(); }
55 bool Resolver::resolvePool ()
56 { return _pimpl->resolvePool(); }
58 bool Resolver::resolveQueue( solver::detail::SolverQueueItemList & queue )
59 { return _pimpl->resolveQueue(queue); }
64 ResolverProblemList Resolver::problems ()
65 { return _pimpl->problems (); }
67 void Resolver::applySolutions( const ProblemSolutionList & solutions )
68 { _pimpl->applySolutions (solutions); }
70 bool Resolver::doUpgrade()
71 { return _pimpl->doUpgrade(); }
73 void Resolver::doUpdate()
74 { _pimpl->doUpdate(); }
76 void Resolver::setForceResolve( bool yesno_r ) { _pimpl->setForceResolve( yesno_r ); }
77 bool Resolver::forceResolve() const { return _pimpl->forceResolve(); }
79 void Resolver::setIgnoreAlreadyRecommended( bool yesno_r) { _pimpl->setIgnoreAlreadyRecommended( yesno_r ); }
80 bool Resolver::ignoreAlreadyRecommended() const { return _pimpl->ignoreAlreadyRecommended(); }
82 void Resolver::setOnlyRequires( bool yesno_r ) { _pimpl->setOnlyRequires( yesno_r ); }
83 void Resolver::resetOnlyRequires() { _pimpl->setOnlyRequires( indeterminate ); }
84 bool Resolver::onlyRequires() const { return _pimpl->onlyRequires(); }
86 bool Resolver::upgradeMode() const { return _pimpl->isUpgradeMode(); }
88 void Resolver::setAllowVendorChange( bool yesno_r ) { _pimpl->setAllowVendorChange( yesno_r ); }
89 void Resolver::setDefaultAllowVendorChange() { _pimpl->setAllowVendorChange( indeterminate ); }
90 bool Resolver::allowVendorChange() const { return _pimpl->allowVendorChange(); }
92 void Resolver::setSystemVerification( bool yesno_r ) { _pimpl->setVerifyingMode( yesno_r ); }
93 void Resolver::setDefaultSystemVerification() { _pimpl->setVerifyingMode( indeterminate ); }
94 bool Resolver::systemVerification() const { return _pimpl->isVerifyingMode(); }
96 void Resolver::setSolveSrcPackages( bool yesno_r ) { _pimpl->setSolveSrcPackages( yesno_r ); }
97 void Resolver::setDefaultSolveSrcPackages() { _pimpl->setSolveSrcPackages( indeterminate ); }
98 bool Resolver::solveSrcPackages() const { return _pimpl->solveSrcPackages(); }
100 void Resolver::setCleandepsOnRemove( bool yesno_r ) { _pimpl->setCleandepsOnRemove( yesno_r ); }
101 void Resolver::setDefaultCleandepsOnRemove() { _pimpl->setCleandepsOnRemove( indeterminate ); }
102 bool Resolver::cleandepsOnRemove() const { return _pimpl->cleandepsOnRemove(); }
104 void Resolver::addUpgradeRepo( Repository repo_r ) { _pimpl->addUpgradeRepo( repo_r ); }
105 bool Resolver::upgradingRepo( Repository repo_r ) const { return _pimpl->upgradingRepo( repo_r ); }
106 void Resolver::removeUpgradeRepo( Repository repo_r ) { _pimpl->removeUpgradeRepo( repo_r ); }
107 void Resolver::removeUpgradeRepos() { _pimpl->removeUpgradeRepos(); }
109 void Resolver::addRequire( const Capability & capability ) { _pimpl->addExtraRequire( capability ); }
110 void Resolver::addConflict( const Capability & capability ) { _pimpl->addExtraConflict( capability ); }
111 void Resolver::removeRequire( const Capability & capability ) { _pimpl->removeExtraRequire( capability ); }
112 void Resolver::removeConflict( const Capability & capability ){ _pimpl->removeExtraConflict( capability ); }
114 CapabilitySet Resolver::getRequire() const { return _pimpl->extraRequires(); }
115 CapabilitySet Resolver::getConflict() const { return _pimpl->extraConflicts(); }
117 std::list<PoolItem> Resolver::problematicUpdateItems() const
118 { return _pimpl->problematicUpdateItems(); }
120 bool Resolver::createSolverTestcase( const std::string & dumpPath, bool runSolver )
122 solver::detail::Testcase testcase (dumpPath);
123 return testcase.createTestcase(*_pimpl, true, runSolver);
126 solver::detail::ItemCapKindList Resolver::isInstalledBy( const PoolItem & item )
127 { return _pimpl->isInstalledBy (item); }
129 solver::detail::ItemCapKindList Resolver::installs( const PoolItem & item )
130 { return _pimpl->installs (item); }
132 solver::detail::ItemCapKindList Resolver::satifiedByInstalled( const PoolItem & item )
133 { return _pimpl->satifiedByInstalled (item); }
135 solver::detail::ItemCapKindList Resolver::installedSatisfied( const PoolItem & item )
136 { return _pimpl->installedSatisfied (item); }
138 void Resolver::reset()
139 { _pimpl->reset( false ); /* Do not keep extra requires/conflicts */ }
141 std::ostream & operator<<( std::ostream & str, const Resolver & obj )
142 { return str << *obj._pimpl; }
144 /////////////////////////////////////////////////////////////////
146 ///////////////////////////////////////////////////////////////////