libzypp  17.14.0
Resolver.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #include <iostream>
13 
14 #define ZYPP_USE_RESOLVER_INTERNALS
15 
16 #include "zypp/Resolver.h"
17 #include "zypp/ZConfig.h"
18 #include "zypp/TriBool.h"
22 #include "zypp/sat/Transaction.h"
23 
24 using namespace std;
25 
27 namespace zypp
28 {
29 
30  using namespace solver;
31 
32  IMPL_PTR_TYPE(Resolver);
33 
35  //
36  // METHOD NAME : Resolver::Resolver
37  // METHOD TYPE : Ctor
38  //
39  Resolver::Resolver( const ResPool & pool )
40  : _pimpl( new solver::detail::ResolverInternal(pool) )
41  {}
42 
44  //
45  // METHOD NAME : Resolver::~Resolver
46  // METHOD TYPE : Dtor
47  //
49  {}
50 
52  //
53  // Resolver interface forwarded to implementation
54  //
57  { return _pimpl->verifySystem(); }
58 
60  { return _pimpl->resolvePool(); }
61 
63  { return _pimpl->resolveQueue(queue); }
64 
66  { _pimpl->undo(); }
67 
69  { return _pimpl->problems (); }
70 
72  { _pimpl->applySolutions (solutions); }
73 
75  { return _pimpl->getTransaction(); }
76 
78  { return _pimpl->doUpgrade(); }
79 
81  { _pimpl->doUpdate(); }
82 
83  void Resolver::setForceResolve( bool yesno_r ) { _pimpl->setForceResolve( yesno_r ); }
84  bool Resolver::forceResolve() const { return _pimpl->forceResolve(); }
85 
88 
89  void Resolver::setOnlyRequires( bool yesno_r ) { _pimpl->setOnlyRequires( yesno_r ); }
90  void Resolver::resetOnlyRequires() { _pimpl->setOnlyRequires( indeterminate ); }
91  bool Resolver::onlyRequires() const { return _pimpl->onlyRequires(); }
92 
93  void Resolver::setUpgradeMode( bool yesno_r ) { return _pimpl->setUpgradeMode( yesno_r ); }
94  bool Resolver::upgradeMode() const { return _pimpl->isUpgradeMode(); }
95 
96  void Resolver::setUpdateMode( bool yesno_r ) { return _pimpl->setUpdateMode( yesno_r ); }
97  bool Resolver::updateMode() const { return _pimpl->isUpdateMode(); }
98 
99  void Resolver::setSystemVerification( bool yesno_r ) { _pimpl->setVerifyingMode( yesno_r ); }
100  void Resolver::setDefaultSystemVerification() { _pimpl->setVerifyingMode( indeterminate ); }
101  bool Resolver::systemVerification() const { return _pimpl->isVerifyingMode(); }
102 
103  void Resolver::setSolveSrcPackages( bool yesno_r ) { _pimpl->setSolveSrcPackages( yesno_r ); }
106 
107  void Resolver::setCleandepsOnRemove( bool yesno_r ) { _pimpl->setCleandepsOnRemove( yesno_r ); }
110 
111 #define ZOLV_FLAG_BOOL( ZSETTER, ZGETTER ) \
112  void Resolver::ZSETTER( bool yesno_r ){ _pimpl->ZSETTER( yesno_r ); } \
113  bool Resolver::ZGETTER() const { return _pimpl->ZGETTER(); } \
114 
115 #define ZOLV_FLAG_TRIBOOL( ZSETTER, ZDEFAULT, ZGETTER ) \
116  ZOLV_FLAG_BOOL( ZSETTER , ZGETTER ) \
117  void Resolver::ZDEFAULT() { _pimpl->ZSETTER( indeterminate ); } \
118 
119  ZOLV_FLAG_TRIBOOL( setAllowDowngrade, setDefaultAllowDowngrade, allowDowngrade )
120  ZOLV_FLAG_TRIBOOL( setAllowNameChange, setDefaultAllowNameChange, allowNameChange )
121  ZOLV_FLAG_TRIBOOL( setAllowArchChange, setDefaultAllowArchChange, allowArchChange )
122  ZOLV_FLAG_TRIBOOL( setAllowVendorChange, setDefaultAllowVendorChange, allowVendorChange )
123 
124  ZOLV_FLAG_TRIBOOL( dupSetAllowDowngrade, dupSetDefaultAllowDowngrade, dupAllowDowngrade )
125  ZOLV_FLAG_TRIBOOL( dupSetAllowNameChange, dupSetDefaultAllowNameChange, dupAllowNameChange )
126  ZOLV_FLAG_TRIBOOL( dupSetAllowArchChange, dupSetDefaultAllowArchChange, dupAllowArchChange )
127  ZOLV_FLAG_TRIBOOL( dupSetAllowVendorChange, dupSetDefaultAllowVendorChange, dupAllowVendorChange )
128 
129 #undef ZOLV_FLAG_BOOL
130 #undef ZOLV_FLAG_TRIBOOL
131 
133  bool Resolver::upgradingRepos() const { return !_pimpl->upgradeRepos().empty(); }
134  bool Resolver::upgradingRepo( Repository repo_r ) const { return _pimpl->upgradingRepo( repo_r ); }
137 
138  void Resolver::addRequire( const Capability & capability ) { _pimpl->addExtraRequire( capability ); }
139  void Resolver::addConflict( const Capability & capability ) { _pimpl->addExtraConflict( capability ); }
140  void Resolver::removeRequire( const Capability & capability ) { _pimpl->removeExtraRequire( capability ); }
141  void Resolver::removeConflict( const Capability & capability ){ _pimpl->removeExtraConflict( capability ); }
142 
143  CapabilitySet Resolver::getRequire() const { return _pimpl->extraRequires(); }
144  CapabilitySet Resolver::getConflict() const { return _pimpl->extraConflicts(); }
145 
146  std::list<PoolItem> Resolver::problematicUpdateItems() const
147  { return _pimpl->problematicUpdateItems(); }
148 
149  bool Resolver::createSolverTestcase( const std::string & dumpPath, bool runSolver )
150  {
151  solver::detail::Testcase testcase (dumpPath);
152  return testcase.createTestcase(*_pimpl, true, runSolver);
153  }
154 
156  { return _pimpl->isInstalledBy (item); }
157 
159  { return _pimpl->installs (item); }
160 
162  { return _pimpl->satifiedByInstalled (item); }
163 
165  { return _pimpl->installedSatisfied (item); }
166 
168  { _pimpl->reset( false ); /* Do not keep extra requires/conflicts */ }
169 
170  std::ostream & operator<<( std::ostream & str, const Resolver & obj )
171  { return str << *obj._pimpl; }
172 
174 } // namespace zypp