libzypp  17.23.5
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>
20 #include <zypp/sat/Transaction.h>
21 
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 solver::detail::ResolverInternal(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::setFocus( ResolverFocus focus_r ) { _pimpl->setFocus( focus_r ); }
81  ResolverFocus Resolver::focus() const { return _pimpl->focus(); }
82 
83  void Resolver::setForceResolve( bool yesno_r ) { _pimpl->setForceResolve( yesno_r ); }
84  bool Resolver::forceResolve() const { return _pimpl->forceResolve(); }
85 
86  void Resolver::setIgnoreAlreadyRecommended( bool yesno_r) { _pimpl->setIgnoreAlreadyRecommended( yesno_r ); }
87  bool Resolver::ignoreAlreadyRecommended() const { return _pimpl->ignoreAlreadyRecommended(); }
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 ); }
104  void Resolver::setDefaultSolveSrcPackages() { _pimpl->setSolveSrcPackages( indeterminate ); }
105  bool Resolver::solveSrcPackages() const { return _pimpl->solveSrcPackages(); }
106 
107  void Resolver::setCleandepsOnRemove( bool yesno_r ) { _pimpl->setCleandepsOnRemove( yesno_r ); }
108  void Resolver::setDefaultCleandepsOnRemove() { _pimpl->setCleandepsOnRemove( indeterminate ); }
109  bool Resolver::cleandepsOnRemove() const { return _pimpl->cleandepsOnRemove(); }
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 
132  void Resolver::addUpgradeRepo( Repository repo_r ) { _pimpl->addUpgradeRepo( repo_r ); }
133  bool Resolver::upgradingRepos() const { return !_pimpl->upgradeRepos().empty(); }
134  bool Resolver::upgradingRepo( Repository repo_r ) const { return _pimpl->upgradingRepo( repo_r ); }
135  void Resolver::removeUpgradeRepo( Repository repo_r ) { _pimpl->removeUpgradeRepo( repo_r ); }
136  void Resolver::removeUpgradeRepos() { _pimpl->removeUpgradeRepos(); }
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
zypp::Resolver::removeRequire
void removeRequire(const Capability &capability)
Remove the additional requirement set by addRequire(Capability).
Definition: Resolver.cc:140
zypp::PoolItem
Combining sat::Solvable and ResStatus.
Definition: PoolItem.h:50
zypp::solver::detail::dupAllowDowngrade
dupAllowDowngrade
Definition: Resolver.cc:120
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:149
zypp::Resolver::_pimpl
zypp::RW_pointer< solver::detail::ResolverInternal > _pimpl
Definition: Resolver.h:443
Resolver.h
zypp::Resolver::setDefaultSystemVerification
void setDefaultSystemVerification()
Definition: Resolver.cc:100
zypp::Resolver::doUpdate
void doUpdate()
Update to newest package.
Definition: Resolver.cc:77
Transaction.h
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:89
zypp::Resolver::undo
void undo()
Definition: Resolver.cc:62
zypp::Resolver::setSolveSrcPackages
void setSolveSrcPackages(bool yesno_r)
Set whether to solve source packages build dependencies per default.
Definition: Resolver.cc:103
ZOLV_FLAG_TRIBOOL
#define ZOLV_FLAG_TRIBOOL(ZSETTER, ZDEFAULT, ZGETTER)
Definition: Resolver.cc:115
zypp::Resolver::Resolver
Resolver(const ResPool &pool)
Ctor.
Definition: Resolver.cc:36
zypp::Resolver::systemVerification
bool systemVerification() const
Definition: Resolver.cc:101
zypp::Resolver::setUpdateMode
void setUpdateMode(bool yesno_r)
Setting whether the solver should perform in 'update' mode or not.
Definition: Resolver.cc:96
zypp::Resolver::addUpgradeRepo
void addUpgradeRepo(Repository repo_r)
Adding request to perform a dist upgrade restricted to this repository.
Definition: Resolver.cc:132
zypp::Resolver::doUpgrade
bool doUpgrade()
Do an distribution upgrade (DUP)
Definition: Resolver.cc:74
zypp::Resolver::getConflict
CapabilitySet getConflict() const
Get all the additional conflicts set by addConflict(Capability).
Definition: Resolver.cc:144
zypp::Resolver::setDefaultSolveSrcPackages
void setDefaultSolveSrcPackages()
Definition: Resolver.cc:104
zypp::solver::detail::allowVendorChange
allowVendorChange
Definition: Resolver.cc:118
zypp::Resolver::ignoreAlreadyRecommended
bool ignoreAlreadyRecommended() const
Definition: Resolver.cc:87
zypp::Resolver::removeUpgradeRepo
void removeUpgradeRepo(Repository repo_r)
Remove an upgrade request for this repo.
Definition: Resolver.cc:135
zypp::Resolver::getRequire
CapabilitySet getRequire() const
Get all the additional requirements set by addRequire(Capability).
Definition: Resolver.cc:143
zypp::ProblemSolutionList
std::list< ProblemSolution_Ptr > ProblemSolutionList
Definition: ProblemTypes.h:43
zypp::Resolver::solveSrcPackages
bool solveSrcPackages() const
Definition: Resolver.cc:105
zypp::ResolverFocus
ResolverFocus
The resolvers general attitude.
Definition: ResolverFocus.h:21
zypp::sat::Transaction
Libsolv transaction wrapper.
Definition: Transaction.h:51
zypp::Resolver::forceResolve
bool forceResolve() const
Definition: Resolver.cc:84
zypp::Resolver::setCleandepsOnRemove
void setCleandepsOnRemove(bool yesno_r)
Cleanup when deleting packages.
Definition: Resolver.cc:107
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:155
Resolver.h
zypp::Resolver::resolveQueue
bool resolveQueue(solver::detail::SolverQueueItemList &queue)
Resolve package dependencies:
Definition: Resolver.cc:59
zypp::Resolver::addConflict
void addConflict(const Capability &capability)
Adding additional conflict.
Definition: Resolver.cc:139
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:146
zypp::CapabilitySet
std::unordered_set< Capability > CapabilitySet
Definition: Capability.h:33
zypp::Resolver::installedSatisfied
solver::detail::ItemCapKindList installedSatisfied(const PoolItem &item)
Gives information about WHICH items require an already installed item.
Definition: Resolver.cc:164
zypp::Resolver::problems
ResolverProblemList problems()
Return the dependency problems found by the last call to resolveDependencies().
Definition: Resolver.cc:65
zypp::solver::detail::SolverQueueItemList
std::list< SolverQueueItem_Ptr > SolverQueueItemList
Definition: Types.h:45
zypp::Resolver::applySolutions
void applySolutions(const ProblemSolutionList &solutions)
Apply problem solutions.
Definition: Resolver.cc:68
zypp::Resolver
Dependency resolver interface.
Definition: Resolver.h:44
zypp::Resolver::cleandepsOnRemove
bool cleandepsOnRemove() const
Definition: Resolver.cc:109
zypp::Resolver::updateMode
bool updateMode() const
Definition: Resolver.cc:97
ItemCapKind.h
zypp::Resolver::resetOnlyRequires
void resetOnlyRequires()
Definition: Resolver.cc:90
zypp::Resolver::setUpgradeMode
void setUpgradeMode(bool yesno_r)
Setting whether the solver should perform in 'upgrade' mode or not.
Definition: Resolver.cc:93
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:161
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
zypp::Resolver::setSystemVerification
void setSystemVerification(bool yesno_r)
System verification mode also monitors and repairs dependencies of already installed packages.
Definition: Resolver.cc:99
zypp::Resolver::setDefaultCleandepsOnRemove
void setDefaultCleandepsOnRemove()
Definition: Resolver.cc:108
zypp::solver::detail::dupAllowArchChange
dupAllowArchChange
Definition: Resolver.cc:122
zypp::IMPL_PTR_TYPE
IMPL_PTR_TYPE(Application)
zypp::Resolver::addRequire
void addRequire(const Capability &capability)
Adding additional requirement.
Definition: Resolver.cc:138
zypp::Resolver::~Resolver
virtual ~Resolver()
Dtor.
Definition: Resolver.cc:45
zypp::Resolver::focus
ResolverFocus focus() const
Definition: Resolver.cc:81
zypp::ResolverProblemList
std::list< ResolverProblem_Ptr > ResolverProblemList
Definition: ProblemTypes.h:46
zypp::Resolver::reset
void reset()
Definition: Resolver.cc:167
zypp::ResPool
Global ResObject pool.
Definition: ResPool.h:60
zypp::Resolver::setIgnoreAlreadyRecommended
void setIgnoreAlreadyRecommended(bool yesno_r)
Ignore recommended packages that were already recommended by the installed packages.
Definition: Resolver.cc:86
zypp::Resolver::setForceResolve
void setForceResolve(bool force)
Remove resolvables which are conflicts with others or have unfulfilled requirements.
Definition: Resolver.cc:83
zypp::Capability
A sat capability.
Definition: Capability.h:59
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:147
zypp::Resolver::onlyRequires
bool onlyRequires() const
Definition: Resolver.cc:91
zypp::Resolver::upgradeMode
bool upgradeMode() const
Definition: Resolver.cc:94
zypp::Resolver::upgradingRepo
bool upgradingRepo(Repository repo_r) const
Whether there is an UpgradeRepo request pending for this repo.
Definition: Resolver.cc:134
zypp::Resolver::verifySystem
bool verifySystem()
Resolve package dependencies:
Definition: Resolver.cc:53
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:158
zypp::solver::detail::ResolverInternal
Resolver ResolverInternal
Preferred name in API.
Definition: Types.h:38
str
String related utilities and Regular expression matching.
Testcase.h
zypp::solver::detail::ItemCapKindList
std::list< ItemCapKind > ItemCapKindList
Definition: Types.h:41
zypp::Resolver::resolvePool
bool resolvePool()
Resolve package dependencies:
Definition: Resolver.cc:56
zypp::Resolver::removeUpgradeRepos
void removeUpgradeRepos()
Remove all upgrade repo requests.
Definition: Resolver.cc:136
zypp::Resolver::upgradingRepos
bool upgradingRepos() const
Whether there is at least one UpgradeRepo request pending.
Definition: Resolver.cc:133
zypp::solver::detail::dupAllowNameChange
dupAllowNameChange
Definition: Resolver.cc:121
zypp::Resolver::removeConflict
void removeConflict(const Capability &capability)
Remove the additional conflict set by addConflict(Capability).
Definition: Resolver.cc:141
zypp::solver::detail::dupAllowVendorChange
dupAllowVendorChange
Definition: Resolver.cc:123
zypp::Repository
Definition: Repository.h:39
zypp::Resolver::getTransaction
sat::Transaction getTransaction()
Return the Transaction computed by the last solver run.
Definition: Resolver.cc:71
zypp::Resolver::setFocus
void setFocus(ResolverFocus focus_r)
Define the resolvers general attitude when resolving jobs.
Definition: Resolver.cc:80