libzypp  13.10.6
Resolver.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #include <iostream>
13 
14 #include "zypp/Resolver.h"
15 #include "zypp/ZConfig.h"
16 #include "zypp/TriBool.h"
19 #include "zypp/sat/Transaction.h"
20 
21 using namespace std;
22 
24 namespace zypp
25 {
26 
27  using namespace solver;
28 
29  IMPL_PTR_TYPE(Resolver);
30 
32  //
33  // METHOD NAME : Resolver::Resolver
34  // METHOD TYPE : Ctor
35  //
36  Resolver::Resolver( const ResPool & pool )
37  : _pimpl( new Impl(pool) )
38  {}
39 
41  //
42  // METHOD NAME : Resolver::~Resolver
43  // METHOD TYPE : Dtor
44  //
46  {}
47 
49  //
50  // Resolver interface forwarded to implementation
51  //
54  { return _pimpl->verifySystem(); }
55 
57  { return _pimpl->resolvePool(); }
58 
60  { return _pimpl->resolveQueue(queue); }
61 
63  { _pimpl->undo(); }
64 
66  { return _pimpl->problems (); }
67 
69  { _pimpl->applySolutions (solutions); }
70 
72  { return _pimpl->getTransaction(); }
73 
75  { return _pimpl->doUpgrade(); }
76 
78  { _pimpl->doUpdate(); }
79 
80  void Resolver::setForceResolve( bool yesno_r ) { _pimpl->setForceResolve( yesno_r ); }
81  bool Resolver::forceResolve() const { return _pimpl->forceResolve(); }
82 
83  void Resolver::setIgnoreAlreadyRecommended( bool yesno_r) { _pimpl->setIgnoreAlreadyRecommended( yesno_r ); }
84  bool Resolver::ignoreAlreadyRecommended() const { return _pimpl->ignoreAlreadyRecommended(); }
85 
86  void Resolver::setOnlyRequires( bool yesno_r ) { _pimpl->setOnlyRequires( yesno_r ); }
87  void Resolver::resetOnlyRequires() { _pimpl->setOnlyRequires( indeterminate ); }
88  bool Resolver::onlyRequires() const { return _pimpl->onlyRequires(); }
89 
90  void Resolver::setUpgradeMode( bool yesno_r ) { return _pimpl->setUpgradeMode( yesno_r ); }
91  bool Resolver::upgradeMode() const { return _pimpl->isUpgradeMode(); }
92 
93  void Resolver::setAllowVendorChange( bool yesno_r ) { _pimpl->setAllowVendorChange( yesno_r ); }
94  void Resolver::setDefaultAllowVendorChange() { _pimpl->setAllowVendorChange( indeterminate ); }
95  bool Resolver::allowVendorChange() const { return _pimpl->allowVendorChange(); }
96 
97  void Resolver::setSystemVerification( bool yesno_r ) { _pimpl->setVerifyingMode( yesno_r ); }
98  void Resolver::setDefaultSystemVerification() { _pimpl->setVerifyingMode( indeterminate ); }
99  bool Resolver::systemVerification() const { return _pimpl->isVerifyingMode(); }
100 
101  void Resolver::setSolveSrcPackages( bool yesno_r ) { _pimpl->setSolveSrcPackages( yesno_r ); }
102  void Resolver::setDefaultSolveSrcPackages() { _pimpl->setSolveSrcPackages( indeterminate ); }
103  bool Resolver::solveSrcPackages() const { return _pimpl->solveSrcPackages(); }
104 
105  void Resolver::setCleandepsOnRemove( bool yesno_r ) { _pimpl->setCleandepsOnRemove( yesno_r ); }
106  void Resolver::setDefaultCleandepsOnRemove() { _pimpl->setCleandepsOnRemove( indeterminate ); }
107  bool Resolver::cleandepsOnRemove() const { return _pimpl->cleandepsOnRemove(); }
108 
109  void Resolver::addUpgradeRepo( Repository repo_r ) { _pimpl->addUpgradeRepo( repo_r ); }
110  bool Resolver::upgradingRepo( Repository repo_r ) const { return _pimpl->upgradingRepo( repo_r ); }
111  void Resolver::removeUpgradeRepo( Repository repo_r ) { _pimpl->removeUpgradeRepo( repo_r ); }
112  void Resolver::removeUpgradeRepos() { _pimpl->removeUpgradeRepos(); }
113 
114  void Resolver::addRequire( const Capability & capability ) { _pimpl->addExtraRequire( capability ); }
115  void Resolver::addConflict( const Capability & capability ) { _pimpl->addExtraConflict( capability ); }
116  void Resolver::removeRequire( const Capability & capability ) { _pimpl->removeExtraRequire( capability ); }
117  void Resolver::removeConflict( const Capability & capability ){ _pimpl->removeExtraConflict( capability ); }
118 
119  CapabilitySet Resolver::getRequire() const { return _pimpl->extraRequires(); }
120  CapabilitySet Resolver::getConflict() const { return _pimpl->extraConflicts(); }
121 
122  std::list<PoolItem> Resolver::problematicUpdateItems() const
123  { return _pimpl->problematicUpdateItems(); }
124 
125  bool Resolver::createSolverTestcase( const std::string & dumpPath, bool runSolver )
126  {
127  solver::detail::Testcase testcase (dumpPath);
128  return testcase.createTestcase(*_pimpl, true, runSolver);
129  }
130 
132  { return _pimpl->isInstalledBy (item); }
133 
135  { return _pimpl->installs (item); }
136 
138  { return _pimpl->satifiedByInstalled (item); }
139 
141  { return _pimpl->installedSatisfied (item); }
142 
144  { _pimpl->reset( false ); /* Do not keep extra requires/conflicts */ }
145 
146  std::ostream & operator<<( std::ostream & str, const Resolver & obj )
147  { return str << *obj._pimpl; }
148 
150 } // namespace zypp
std::list< ProblemSolution_Ptr > ProblemSolutionList
Definition: ProblemTypes.h:42
solver::detail::ItemCapKindList installs(const PoolItem &item)
Gives information about WHICH additional items will be installed due the installation of an item...
Definition: Resolver.cc:134
void addUpgradeRepo(Repository repo_r)
Adding request to perform a dist upgrade restricted to this repository.
Definition: Resolver.cc:109
void setDefaultAllowVendorChange()
Definition: Resolver.cc:94
bool createSolverTestcase(const std::string &dumpPath="/var/log/YaST2/solverTestcase", bool runSolver=true)
Generates a solver Testcase of the current state.
Definition: Resolver.cc:125
bool allowVendorChange() const
Definition: Resolver.cc:95
void setDefaultSolveSrcPackages()
Definition: Resolver.cc:102
void removeRequire(const Capability &capability)
Remove the additional requirement set by addRequire(Capability).
Definition: Resolver.cc:116
void setCleandepsOnRemove(bool yesno_r)
Cleanup when deleting packages.
Definition: Resolver.cc:105
void setAllowVendorChange(bool yesno_r)
Setting whether the solver should allow or disallow vendor changes.
Definition: Resolver.cc:93
std::list< PoolItem > problematicUpdateItems() const
Unmaintained packages which does not fit to the updated system (broken dependencies) will be deleted...
Definition: Resolver.cc:122
void setOnlyRequires(bool yesno_r)
Setting whether required packages are installed ONLY So recommended packages, language packages and p...
Definition: Resolver.cc:86
ResolverProblemList problems()
Return the dependency problems found by the last call to resolveDependencies().
Definition: Resolver.cc:65
Libsolv transaction wrapper.
Definition: Transaction.h:54
bool upgradingRepo(Repository repo_r) const
Whether there is an UpgradeRepo request pending for this repo.
Definition: Resolver.cc:110
Generating a testcase of the current pool and solver state.
Definition: Testcase.h:35
std::list< SolverQueueItem_Ptr > SolverQueueItemList
bool ignoreAlreadyRecommended() const
Definition: Resolver.cc:84
std::tr1::unordered_set< Capability > CapabilitySet
Definition: Capability.h:33
bool solveSrcPackages() const
Definition: Resolver.cc:103
solver::detail::ItemCapKindList satifiedByInstalled(const PoolItem &item)
Gives information about WHICH installed items are requested by the installation of an item...
Definition: Resolver.cc:137
bool doUpgrade()
Do an distribution upgrade.
Definition: Resolver.cc:74
void removeUpgradeRepo(Repository repo_r)
Remove an upgrade request for this repo.
Definition: Resolver.cc:111
void reset()
Definition: Resolver.cc:143
void setUpgradeMode(bool yesno_r)
Setting whether the solver should perform in &#39;upgrade&#39; mode or not.
Definition: Resolver.cc:90
A mid layer class we should remove.
Definition: Resolver.h:101
bool systemVerification() const
Definition: Resolver.cc:99
void setDefaultCleandepsOnRemove()
Definition: Resolver.cc:106
std::list< ResolverProblem_Ptr > ResolverProblemList
Definition: ProblemTypes.h:46
Dependency resolver interface.
Definition: Resolver.h:47
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:120
void resetOnlyRequires()
Definition: Resolver.cc:87
bool cleandepsOnRemove() const
Definition: Resolver.cc:107
bool verifySystem()
Resolve package dependencies:
Definition: Resolver.cc:53
CapabilitySet getConflict() const
Get all the additional conflicts set by addConflict(Capability).
Definition: Resolver.cc:120
CapabilitySet getRequire() const
Get all the additional requirements set by addRequire(Capability).
Definition: Resolver.cc:119
virtual ~Resolver()
Dtor.
Definition: Resolver.cc:45
void undo()
Definition: Resolver.cc:62
bool forceResolve() const
Definition: Resolver.cc:81
void addConflict(const Capability &capability)
Adding additional conflict.
Definition: Resolver.cc:115
sat::Transaction getTransaction()
Return the Transaction computed by the last solver run.
Definition: Resolver.cc:71
void setSystemVerification(bool yesno_r)
System verification mode also monitors and repairs dependencies of already installed packages...
Definition: Resolver.cc:97
void applySolutions(const ProblemSolutionList &solutions)
Apply problem solutions.
Definition: Resolver.cc:68
Global ResObject pool.
Definition: ResPool.h:48
bool resolvePool()
Resolve package dependencies:
Definition: Resolver.cc:56
void addRequire(const Capability &capability)
Adding additional requirement.
Definition: Resolver.cc:114
std::list< ItemCapKind > ItemCapKindList
Definition: Resolver.h:88
bool createTestcase(Resolver &resolver, bool dumpPool=true, bool runSolver=true)
Definition: Testcase.cc:475
A sat capability.
Definition: Capability.h:59
void removeConflict(const Capability &capability)
Remove the additional conflict set by addConflict(Capability).
Definition: Resolver.cc:117
void setForceResolve(bool force)
Remove resolvables which are conflicts with others or have unfulfilled requirements.
Definition: Resolver.cc:80
void doUpdate()
Update to newest package.
Definition: Resolver.cc:77
Reference to a PoolItem connecting ResObject and ResStatus.
Definition: PoolItem.h:50
bool upgradeMode() const
Definition: Resolver.cc:91
solver::detail::ItemCapKindList installedSatisfied(const PoolItem &item)
Gives information about WHICH items require an already installed item.
Definition: Resolver.cc:140
void setIgnoreAlreadyRecommended(bool yesno_r)
Ignore recommended packages that were already recommended by the installed packages.
Definition: Resolver.cc:83
bool onlyRequires() const
Definition: Resolver.cc:88
void setDefaultSystemVerification()
Definition: Resolver.cc:98
solver::detail::ItemCapKindList isInstalledBy(const PoolItem &item)
Gives information about WHO has pused an installation of an given item.
Definition: Resolver.cc:131
void removeUpgradeRepos()
Remove all upgrade repo requests.
Definition: Resolver.cc:112
zypp::RW_pointer< Impl, rw_pointer::Intrusive< Impl > > _pimpl
Definition: Resolver.h:386
#define IMPL_PTR_TYPE(NAME)
bool resolveQueue(solver::detail::SolverQueueItemList &queue)
Resolve package dependencies:
Definition: Resolver.cc:59
void setSolveSrcPackages(bool yesno_r)
Set whether to solve source packages build dependencies per default.
Definition: Resolver.cc:101