libzypp: zypp/Resolver.cc Source File

libzypp 17.38.14

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/solver/detail/Resolver.h>
18#include <zypp/solver/detail/Testcase.h>
19#include <zypp/solver/detail/ItemCapKind.h>
20#include <zypp/sat/Transaction.h>
21
22
24namespace 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 solver::detail::ResolverInternal(pool) )
38 {}
39
41 //
42 // METHOD NAME : Resolver::~Resolver
43 // METHOD TYPE : Dtor
44 //
45 Resolver::~Resolver()
46 {}
47
49 //
50 // Resolver interface forwarded to implementation
51 //
53 void Resolver::setDefaultSolverFlags( bool all_r )
54 { return _pimpl->setDefaultSolverFlags( all_r ); }
55
56 sat::detail::CSolver * Resolver::get() const
57 { return _pimpl->get(); }
58
59 bool Resolver::verifySystem ()
60 { return _pimpl->verifySystem(); }
61
62 bool Resolver::resolvePool ()
63 { return _pimpl->resolvePool(); }
64
65 bool Resolver::resolveQueue( solver::detail::SolverQueueItemList & queue )
66 { return _pimpl->resolveQueue(queue); }
67
68 void Resolver::undo()
69 { _pimpl->undo(); }
70
71 ResolverProblemList Resolver::problems ()
72 { return _pimpl->problems (); }
73
74 void Resolver::applySolutions( const ProblemSolutionList & solutions )
75 { _pimpl->applySolutions (solutions); }
76
77 sat::Transaction Resolver::getTransaction()
78 { return _pimpl->getTransaction(); }
79
80 bool Resolver::doUpgrade()
81 { return _pimpl->doUpgrade(); }
82
83 void Resolver::doUpdate()
84 { _pimpl->doUpdate(); }
85
86 void Resolver::setFocus( ResolverFocus focus_r ) { _pimpl->setFocus( focus_r ); }
87 ResolverFocus Resolver::focus() const { return _pimpl->focus(); }
88
89 void Resolver::setForceResolve( bool yesno_r ) { _pimpl->setForceResolve( yesno_r ); }
90 bool Resolver::forceResolve() const { return _pimpl->forceResolve(); }
91
92 void Resolver::setIgnoreAlreadyRecommended( bool yesno_r) { _pimpl->setIgnoreAlreadyRecommended( yesno_r ); }
93 bool Resolver::ignoreAlreadyRecommended() const { return _pimpl->ignoreAlreadyRecommended(); }
94
95 void Resolver::setOnlyRequires( bool yesno_r ) { _pimpl->setOnlyRequires( yesno_r ); }
96 void Resolver::resetOnlyRequires() { _pimpl->setOnlyRequires( indeterminate ); }
97 bool Resolver::onlyRequires() const { return _pimpl->onlyRequires(); }
98
99 void Resolver::setUpgradeMode( bool yesno_r ) { return _pimpl->setUpgradeMode( yesno_r ); }
100 bool Resolver::upgradeMode() const { return _pimpl->isUpgradeMode(); }
101
102 void Resolver::setUpdateMode( bool yesno_r ) { return _pimpl->setUpdateMode( yesno_r ); }
103 bool Resolver::updateMode() const { return _pimpl->isUpdateMode(); }
104
105 void Resolver::setRemoveOrphaned( bool yesno_r ) { return _pimpl->setRemoveOrphaned( yesno_r ); }
106 bool Resolver::removeOrphaned() const { return _pimpl->removeOrphaned(); }
107
108 void Resolver::setRemoveUnneeded( bool yesno_r ) { return _pimpl->setRemoveUnneeded( yesno_r ); }
109 bool Resolver::removeUnneeded() const { return _pimpl->removeUnneeded(); }
110
111 void Resolver::setSystemVerification( bool yesno_r ) { _pimpl->setVerifyingMode( yesno_r ); }
112 void Resolver::setDefaultSystemVerification() { _pimpl->setVerifyingMode( indeterminate ); }
113 bool Resolver::systemVerification() const { return _pimpl->isVerifyingMode(); }
114
115 void Resolver::setSolveSrcPackages( bool yesno_r ) { _pimpl->setSolveSrcPackages( yesno_r ); }
116 void Resolver::setDefaultSolveSrcPackages() { _pimpl->setSolveSrcPackages( indeterminate ); }
117 bool Resolver::solveSrcPackages() const { return _pimpl->solveSrcPackages(); }
118
119 void Resolver::setCleandepsOnRemove( bool yesno_r ) { _pimpl->setCleandepsOnRemove( yesno_r ); }
120 void Resolver::setDefaultCleandepsOnRemove() { _pimpl->setCleandepsOnRemove( indeterminate ); }
121 bool Resolver::cleandepsOnRemove() const { return _pimpl->cleandepsOnRemove(); }
122
123 void Resolver::setNoUpdateProvide( bool yesno_r ) { _pimpl->setNoUpdateProvide( yesno_r ); }
124 void Resolver::setDefaultNoUpdateProvide() { _pimpl->setNoUpdateProvide( indeterminate ); }
125 bool Resolver::noUpdateProvide() const { return _pimpl->noUpdateProvide(); }
126
127#define ZOLV_FLAG_BOOL( ZSETTER, ZGETTER ) \
128 void Resolver::ZSETTER( bool yesno_r ){ _pimpl->ZSETTER( yesno_r ); } \
129 bool Resolver::ZGETTER() const { return _pimpl->ZGETTER(); } \
130
131#define ZOLV_FLAG_TRIBOOL( ZSETTER, ZDEFAULT, ZGETTER ) \
132 ZOLV_FLAG_BOOL( ZSETTER , ZGETTER ) \
133 void Resolver::ZDEFAULT() { _pimpl->ZSETTER( indeterminate ); } \
134
135 ZOLV_FLAG_TRIBOOL( setAllowDowngrade, setDefaultAllowDowngrade, allowDowngrade )
136 ZOLV_FLAG_TRIBOOL( setAllowNameChange, setDefaultAllowNameChange, allowNameChange )
137 ZOLV_FLAG_TRIBOOL( setAllowArchChange, setDefaultAllowArchChange, allowArchChange )
138 ZOLV_FLAG_TRIBOOL( setAllowVendorChange, setDefaultAllowVendorChange, allowVendorChange )
139
140 ZOLV_FLAG_TRIBOOL( dupSetAllowDowngrade, dupSetDefaultAllowDowngrade, dupAllowDowngrade )
141 ZOLV_FLAG_TRIBOOL( dupSetAllowNameChange, dupSetDefaultAllowNameChange, dupAllowNameChange )
142 ZOLV_FLAG_TRIBOOL( dupSetAllowArchChange, dupSetDefaultAllowArchChange, dupAllowArchChange )
143 ZOLV_FLAG_TRIBOOL( dupSetAllowVendorChange, dupSetDefaultAllowVendorChange, dupAllowVendorChange )
144
145#undef ZOLV_FLAG_BOOL
146#undef ZOLV_FLAG_TRIBOOL
147
148 void Resolver::addUpgradeRepo( Repository repo_r ) { _pimpl->addUpgradeRepo( repo_r ); }
149 bool Resolver::upgradingRepos() const { return !_pimpl->upgradeRepos().empty(); }
150 bool Resolver::upgradingRepo( Repository repo_r ) const { return _pimpl->upgradingRepo( repo_r ); }
151 void Resolver::removeUpgradeRepo( Repository repo_r ) { _pimpl->removeUpgradeRepo( repo_r ); }
152 void Resolver::removeUpgradeRepos() { _pimpl->removeUpgradeRepos(); }
153
154 void Resolver::addRequire( const Capability & capability ) { _pimpl->addExtraRequire( capability ); }
155 void Resolver::addConflict( const Capability & capability ) { _pimpl->addExtraConflict( capability ); }
156 void Resolver::removeRequire( const Capability & capability ) { _pimpl->removeExtraRequire( capability ); }
157 void Resolver::removeConflict( const Capability & capability ){ _pimpl->removeExtraConflict( capability ); }
158
159 CapabilitySet Resolver::getRequire() const { return _pimpl->extraRequires(); }
160 CapabilitySet Resolver::getConflict() const { return _pimpl->extraConflicts(); }
161
162 std::list<PoolItem> Resolver::problematicUpdateItems() const
163 { return _pimpl->problematicUpdateItems(); }
164
165 bool Resolver::createSolverTestcase( const std::string & dumpPath, bool runSolver )
166 {
167 solver::detail::Testcase testcase (dumpPath);
168 return testcase.createTestcase(*_pimpl, true, runSolver);
169 }
170
171 solver::detail::ItemCapKindList Resolver::isInstalledBy( const PoolItem & item )
172 { return _pimpl->isInstalledBy (item); }
173
174 solver::detail::ItemCapKindList Resolver::installs( const PoolItem & item )
175 { return _pimpl->installs (item); }
176
177 solver::detail::ItemCapKindList Resolver::satifiedByInstalled( const PoolItem & item )
178 { return _pimpl->satifiedByInstalled (item); }
179
180 solver::detail::ItemCapKindList Resolver::installedSatisfied( const PoolItem & item )
181 { return _pimpl->installedSatisfied (item); }
182
183 void Resolver::reset()
184 { _pimpl->reset( false ); /* Do not keep extra requires/conflicts */ }
185
186 std::ostream & operator<<( std::ostream & str, const Resolver & obj )
187 { return str << *obj._pimpl; }
188
190} // namespace zypp
ItemCapKind.h
ZOLV_FLAG_TRIBOOL
#define ZOLV_FLAG_TRIBOOL(ZSETTER, ZDEFAULT, ZGETTER)
Definition Resolver.cc:131
Resolver.h
Testcase.h
Transaction.h
zypp::Capability
A sat capability.
Definition Capability.h:63
zypp::PoolItem
Combining sat::Solvable and ResStatus.
Definition PoolItem.h:51
zypp::Repository
Definition Repository.h:40
zypp::ResPool
Global ResObject pool.
Definition ResPool.h:62
zypp::Resolver
Dependency resolver interface.
Definition Resolver.h:45
zypp::Resolver::setDefaultCleandepsOnRemove
void setDefaultCleandepsOnRemove()
Definition Resolver.cc:120
zypp::Resolver::setSolveSrcPackages
void setSolveSrcPackages(bool yesno_r)
Set whether to solve source packages build dependencies per default.
Definition Resolver.cc:115
zypp::Resolver::cleandepsOnRemove
bool cleandepsOnRemove() const
Definition Resolver.cc:121
zypp::Resolver::resolveQueue
bool resolveQueue(solver::detail::SolverQueueItemList &queue)
Resolve package dependencies:
Definition Resolver.cc:65
zypp::Resolver::get
sat::detail::CSolver * get() const
Expert backdoor.
Definition Resolver.cc:56
zypp::Resolver::setCleandepsOnRemove
void setCleandepsOnRemove(bool yesno_r)
Cleanup when deleting packages.
Definition Resolver.cc:119
zypp::Resolver::setRemoveOrphaned
void setRemoveOrphaned(bool yesno_r)
Set whether to remove unused orphans in 'upgrade' mode.
Definition Resolver.cc:105
zypp::Resolver::setDefaultSolverFlags
void setDefaultSolverFlags(bool all_r=true)
Reset all solver flags to the systems default (e.g.
Definition Resolver.cc:53
zypp::Resolver::problems
ResolverProblemList problems()
Return the dependency problems found by the last call to resolveDependencies().
Definition Resolver.cc:71
zypp::Resolver::forceResolve
bool forceResolve() const
Definition Resolver.cc:90
zypp::Resolver::setOnlyRequires
void setOnlyRequires(bool yesno_r)
Setting whether required packages are installed ONLY So recommended packages, language packages and p...
Definition Resolver.cc:95
zypp::Resolver::getTransaction
sat::Transaction getTransaction()
Return the Transaction computed by the last solver run.
Definition Resolver.cc:77
zypp::Resolver::addRequire
void addRequire(const Capability &capability)
Adding additional requirement.
Definition Resolver.cc:154
zypp::Resolver::operator<<
friend std::ostream & operator<<(std::ostream &str, const Resolver &obj)
relates: Resolver Stream output
Definition Resolver.cc:186
zypp::Resolver::doUpdate
void doUpdate()
Update to newest package.
Definition Resolver.cc:83
zypp::Resolver::addUpgradeRepo
void addUpgradeRepo(Repository repo_r)
Adding request to perform a dist upgrade restricted to this repository.
Definition Resolver.cc:148
zypp::Resolver::problematicUpdateItems
std::list< PoolItem > problematicUpdateItems() const
Unmaintained packages which does not fit to the updated system (broken dependencies) will be deleted.
Definition Resolver.cc:162
zypp::Resolver::upgradingRepo
bool upgradingRepo(Repository repo_r) const
Whether there is an UpgradeRepo request pending for this repo.
Definition Resolver.cc:150
zypp::Resolver::applySolutions
void applySolutions(const ProblemSolutionList &solutions)
Apply problem solutions.
Definition Resolver.cc:74
zypp::Resolver::Resolver
Resolver(const ResPool &pool)
Ctor.
Definition Resolver.cc:36
zypp::Resolver::setDefaultNoUpdateProvide
void setDefaultNoUpdateProvide()
Definition Resolver.cc:124
zypp::Resolver::isInstalledBy
solver::detail::ItemCapKindList isInstalledBy(const PoolItem &item)
Gives information about WHO has pused an installation of an given item.
Definition Resolver.cc:171
zypp::Resolver::ignoreAlreadyRecommended
bool ignoreAlreadyRecommended() const
Definition Resolver.cc:93
zypp::Resolver::installs
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:174
zypp::Resolver::resolvePool
bool resolvePool()
Resolve package dependencies:
Definition Resolver.cc:62
zypp::Resolver::setFocus
void setFocus(ResolverFocus focus_r)
Define the resolver's general attitude when resolving jobs.
Definition Resolver.cc:86
zypp::Resolver::resetOnlyRequires
void resetOnlyRequires()
Definition Resolver.cc:96
zypp::Resolver::removeUpgradeRepos
void removeUpgradeRepos()
Remove all upgrade repo requests.
Definition Resolver.cc:152
zypp::Resolver::noUpdateProvide
bool noUpdateProvide() const
Definition Resolver.cc:125
zypp::Resolver::upgradeMode
bool upgradeMode() const
Definition Resolver.cc:100
zypp::Resolver::setRemoveUnneeded
void setRemoveUnneeded(bool yesno_r)
File weak remove jobs for unneeded installed packages.
Definition Resolver.cc:108
zypp::Resolver::removeOrphaned
bool removeOrphaned() const
Definition Resolver.cc:106
zypp::Resolver::systemVerification
bool systemVerification() const
Definition Resolver.cc:113
zypp::Resolver::setNoUpdateProvide
void setNoUpdateProvide(bool yesno_r)
Do not prefer update candidates also providing the old package.
Definition Resolver.cc:123
zypp::Resolver::verifySystem
bool verifySystem()
Resolve package dependencies:
Definition Resolver.cc:59
zypp::Resolver::getConflict
CapabilitySet getConflict() const
Get all the additional conflicts set by addConflict(Capability).
Definition Resolver.cc:160
zypp::Resolver::removeUpgradeRepo
void removeUpgradeRepo(Repository repo_r)
Remove an upgrade request for this repo.
Definition Resolver.cc:151
zypp::Resolver::~Resolver
~Resolver() override
Dtor.
Definition Resolver.cc:45
zypp::Resolver::setIgnoreAlreadyRecommended
void setIgnoreAlreadyRecommended(bool yesno_r)
Ignore recommended packages that were already recommended by the installed packages.
Definition Resolver.cc:92
zypp::Resolver::solveSrcPackages
bool solveSrcPackages() const
Definition Resolver.cc:117
zypp::Resolver::createSolverTestcase
bool createSolverTestcase(const std::string &dumpPath="/var/log/YaST2/solverTestcase", bool runSolver=true)
Generates a solver Testcase of the current state.
Definition Resolver.cc:165
zypp::Resolver::addConflict
void addConflict(const Capability &capability)
Adding additional conflict.
Definition Resolver.cc:155
zypp::Resolver::doUpgrade
bool doUpgrade()
Do an distribution upgrade (DUP).
Definition Resolver.cc:80
zypp::Resolver::setForceResolve
void setForceResolve(bool force)
Remove resolvables which are conflicts with others or have unfulfilled requirements.
Definition Resolver.cc:89
zypp::Resolver::removeRequire
void removeRequire(const Capability &capability)
Remove the additional requirement set by addRequire(Capability).
Definition Resolver.cc:156
zypp::Resolver::removeConflict
void removeConflict(const Capability &capability)
Remove the additional conflict set by addConflict(Capability).
Definition Resolver.cc:157
zypp::Resolver::upgradingRepos
bool upgradingRepos() const
Whether there is at least one UpgradeRepo request pending.
Definition Resolver.cc:149
zypp::Resolver::focus
ResolverFocus focus() const
Definition Resolver.cc:87
zypp::Resolver::reset
void reset()
Definition Resolver.cc:183
zypp::Resolver::undo
void undo()
Definition Resolver.cc:68
zypp::Resolver::removeUnneeded
bool removeUnneeded() const
Definition Resolver.cc:109
zypp::Resolver::updateMode
bool updateMode() const
Definition Resolver.cc:103
zypp::Resolver::installedSatisfied
solver::detail::ItemCapKindList installedSatisfied(const PoolItem &item)
Gives information about WHICH items require an already installed item.
Definition Resolver.cc:180
zypp::Resolver::setDefaultSolveSrcPackages
void setDefaultSolveSrcPackages()
Definition Resolver.cc:116
zypp::Resolver::_pimpl
zypp::RW_pointer< solver::detail::ResolverInternal > _pimpl
Definition Resolver.h:502
zypp::Resolver::setUpgradeMode
void setUpgradeMode(bool yesno_r)
Setting whether the solver should perform in 'upgrade' mode or not.
Definition Resolver.cc:99
zypp::Resolver::getRequire
CapabilitySet getRequire() const
Get all the additional requirements set by addRequire(Capability).
Definition Resolver.cc:159
zypp::Resolver::setDefaultSystemVerification
void setDefaultSystemVerification()
Definition Resolver.cc:112
zypp::Resolver::setUpdateMode
void setUpdateMode(bool yesno_r)
Setting whether the solver should perform in 'update' mode or not.
Definition Resolver.cc:102
zypp::Resolver::satifiedByInstalled
solver::detail::ItemCapKindList satifiedByInstalled(const PoolItem &item)
Gives information about WHICH installed items are requested by the installation of an item.
Definition Resolver.cc:177
zypp::Resolver::onlyRequires
bool onlyRequires() const
Definition Resolver.cc:97
zypp::Resolver::setSystemVerification
void setSystemVerification(bool yesno_r)
System verification mode also monitors and repairs dependencies of already installed packages.
Definition Resolver.cc:111
zypp::sat::Transaction
Libsolv transaction wrapper.
Definition Transaction.h:52
str
String related utilities and Regular expression matching.
zypp::pool
Definition ByIdent.h:24
zypp::sat::detail::CSolver
::s_Solver CSolver
Wrapped libsolv C data type exposed as backdoor.
Definition PoolDefines.h:38
zypp::solver::detail
Definition PoolImpl.h:110
zypp::solver::detail::SolverQueueItemList
std::list< SolverQueueItem_Ptr > SolverQueueItemList
Definition Types.h:45
zypp::solver::detail::ItemCapKindList
std::list< ItemCapKind > ItemCapKindList
Definition Types.h:42
zypp::solver
Definition PoolImpl.h:109
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::ProblemSolutionList
std::list< ProblemSolution_Ptr > ProblemSolutionList
Definition ProblemTypes.h:43
zypp::ResolverFocus
ResolverFocus
The resolver's general attitude.
Definition ResolverFocus.h:24
zypp::ResolverProblemList
std::list< ResolverProblem_Ptr > ResolverProblemList
Definition ProblemTypes.h:46
zypp::CapabilitySet
std::unordered_set< Capability > CapabilitySet
Definition Capability.h:35
zypp::IMPL_PTR_TYPE
IMPL_PTR_TYPE(Application)
Resolver.h