libzypp 17.37.10

Resolver.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_RESOLVER_H
13#define ZYPP_RESOLVER_H
14
15#include <iosfwd>
16#include <functional>
17
18#include <zypp/base/ReferenceCounted.h>
19
20#include <zypp/solver/Types.h>
21#include <zypp/solver/detail/Types.h>
22
24 namespace zypp
25{
26
27 namespace sat
28 {
29 class Transaction;
30 }
31
33 //
34 // CLASS NAME : Resolver
35 //
44 class ZYPP_API Resolver : public base::ReferenceCounted, private base::NonCopyable
45 {
46 public:
47
49 Resolver( const ResPool & pool );
51 ~Resolver() override;
52
64 void setDefaultSolverFlags( bool all_r = true );
65
74 bool verifySystem();
75
76
91 bool resolvePool();
92
93
111 bool resolveQueue( solver::detail::SolverQueueItemList & queue );
112
113 /*
114 * Undo solver changes done in resolvePool()
115 * Throwing away all ignored dependencies.
116 */
117 void undo();
118
119 /*
120 * Resets solver information and verify option.
121 */
122 void reset();
123
124
138 bool doUpgrade();
139
149 void doUpdate( );
150
158 std::list<PoolItem> problematicUpdateItems() const;
159
165 ResolverProblemList problems();
166
167
172 void applySolutions( const ProblemSolutionList & solutions );
173
177 sat::Transaction getTransaction();
178
183 void setFocus( ResolverFocus focus_r );
184 ResolverFocus focus() const;
185
191 void setForceResolve( bool force );
192 bool forceResolve() const;
193
198 void setIgnoreAlreadyRecommended( bool yesno_r );
199 bool ignoreAlreadyRecommended() const;
200
206 void setOnlyRequires( bool yesno_r );
207 void resetOnlyRequires(); // set back to default (described in zypp.conf)
208 bool onlyRequires() const;
209
215 void setUpgradeMode( bool yesno_r );
216 bool upgradeMode() const;
217
223 void setUpdateMode( bool yesno_r );
224 bool updateMode() const;
225
240 void setRemoveOrphaned( bool yesno_r );
241 bool removeOrphaned() const;
242
256 void setRemoveUnneeded( bool yesno_r );
257 bool removeUnneeded() const;
258
263
264 void setAllowDowngrade( bool yesno_r );
265 void setDefaultAllowDowngrade(); // Set back to default
266 bool allowDowngrade() const;
267
269 void setAllowNameChange( bool yesno_r );
270 void setDefaultAllowNameChange(); // Set back to default
271 bool allowNameChange() const;
272
274 void setAllowArchChange( bool yesno_r );
275 void setDefaultAllowArchChange(); // Set back to default
276 bool allowArchChange() const;
277
281 void setAllowVendorChange( bool yesno_r );
282 void setDefaultAllowVendorChange(); // Set back to default
283 bool allowVendorChange() const;
285
291 void setSystemVerification( bool yesno_r );
292 void setDefaultSystemVerification();
293 bool systemVerification() const;
294
304 void setSolveSrcPackages( bool yesno_r );
305 void setDefaultSolveSrcPackages();
306 bool solveSrcPackages() const;
307
312 void setCleandepsOnRemove( bool yesno_r );
313 void setDefaultCleandepsOnRemove(); // set back to default (in zypp.conf)
314 bool cleandepsOnRemove() const;
315
321
322 void dupSetAllowDowngrade( bool yesno_r );
323 void dupSetDefaultAllowDowngrade(); // Set back to default (in zypp.conf)
324 bool dupAllowDowngrade() const;
325
327 void dupSetAllowNameChange( bool yesno_r );
328 void dupSetDefaultAllowNameChange(); // Set back to default (in zypp.conf)
329 bool dupAllowNameChange() const;
330
332 void dupSetAllowArchChange( bool yesno_r );
333 void dupSetDefaultAllowArchChange(); // Set back to default (in zypp.conf)
334 bool dupAllowArchChange() const;
335
337 void dupSetAllowVendorChange( bool yesno_r );
338 void dupSetDefaultAllowVendorChange(); // Set back to default (in zypp.conf)
339 bool dupAllowVendorChange() const;
341
347
353 void addUpgradeRepo( Repository repo_r );
354
358 bool upgradingRepos() const;
359
363 bool upgradingRepo( Repository repo_r ) const;
364
368 void removeUpgradeRepo( Repository repo_r );
369
373 void removeUpgradeRepos();
375
380 void addRequire( const Capability & capability );
381
386 void addConflict( const Capability & capability );
387
392 void removeRequire( const Capability & capability );
393
398 void removeConflict( const Capability & capability );
399
404 CapabilitySet getRequire() const;
405
410 CapabilitySet getConflict() const;
411
418 bool createSolverTestcase( const std::string & dumpPath = "/var/log/YaST2/solverTestcase", bool runSolver = true );
419
434 solver::detail::ItemCapKindList isInstalledBy( const PoolItem & item );
435
450 solver::detail::ItemCapKindList installs( const PoolItem & item );
451
466 solver::detail::ItemCapKindList satifiedByInstalled( const PoolItem & item );
467
468
483 solver::detail::ItemCapKindList installedSatisfied( const PoolItem & item );
484
485 public:
487 sat::detail::CSolver * get() const;
488
489 private:
490 friend std::ostream & operator<<( std::ostream & str, const Resolver & obj );
491 zypp::RW_pointer<solver::detail::ResolverInternal> _pimpl;
492 };
493
494
496 std::ostream & operator<<( std::ostream & str, const Resolver & obj );
497
499} // namespace zypp
501#endif // ZYPP_RESOLVER_H
Types.h
Common types used in the Resolver public API and need to be passed down to the details tree.
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::setDefaultAllowVendorChange
void setDefaultAllowVendorChange()
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::setAllowNameChange
void setAllowNameChange(bool yesno_r)
Whether to allow one to change name of installed solvable.
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::dupSetAllowNameChange
void dupSetAllowNameChange(bool yesno_r)
dup mode: allow one to change name of installed solvable
zypp::Resolver::addRequire
void addRequire(const Capability &capability)
Adding additional requirement.
Definition Resolver.cc:150
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:144
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:158
zypp::Resolver::upgradingRepo
bool upgradingRepo(Repository repo_r) const
Whether there is an UpgradeRepo request pending for this repo.
Definition Resolver.cc:146
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::dupSetAllowVendorChange
void dupSetAllowVendorChange(bool yesno_r)
dup mode: allow one to change vendor of installed solvables
zypp::Resolver::dupAllowDowngrade
bool dupAllowDowngrade() const
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:167
zypp::Resolver::setDefaultAllowArchChange
void setDefaultAllowArchChange()
zypp::Resolver::ignoreAlreadyRecommended
bool ignoreAlreadyRecommended() const
Definition Resolver.cc:93
zypp::Resolver::dupSetDefaultAllowVendorChange
void dupSetDefaultAllowVendorChange()
zypp::Resolver::allowNameChange
bool allowNameChange() const
zypp::Resolver::reset
void reset()
Definition Resolver.cc:179
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:170
zypp::Resolver::dupSetDefaultAllowNameChange
void dupSetDefaultAllowNameChange()
zypp::Resolver::allowDowngrade
bool allowDowngrade() const
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:148
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::setDefaultAllowNameChange
void setDefaultAllowNameChange()
zypp::Resolver::dupSetDefaultAllowDowngrade
void dupSetDefaultAllowDowngrade()
zypp::Resolver::removeOrphaned
bool removeOrphaned() const
Definition Resolver.cc:106
zypp::Resolver::setAllowVendorChange
void setAllowVendorChange(bool yesno_r)
Whether to allow one to change vendor of installed solvables.
zypp::Resolver::dupAllowArchChange
bool dupAllowArchChange() const
zypp::Resolver::systemVerification
bool systemVerification() const
Definition Resolver.cc:113
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:156
zypp::Resolver::removeUpgradeRepo
void removeUpgradeRepo(Repository repo_r)
Remove an upgrade request for this repo.
Definition Resolver.cc:147
zypp::Resolver::setAllowDowngrade
void setAllowDowngrade(bool yesno_r)
Whether to allow one to downgrade installed solvable.
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:161
zypp::Resolver::addConflict
void addConflict(const Capability &capability)
Adding additional conflict.
Definition Resolver.cc:151
zypp::Resolver::dupAllowNameChange
bool dupAllowNameChange() const
zypp::Resolver::doUpgrade
bool doUpgrade()
Do an distribution upgrade (DUP)
Definition Resolver.cc:80
zypp::Resolver::dupSetDefaultAllowArchChange
void dupSetDefaultAllowArchChange()
zypp::Resolver::setForceResolve
void setForceResolve(bool force)
Remove resolvables which are conflicts with others or have unfulfilled requirements.
Definition Resolver.cc:89
zypp::Resolver::allowArchChange
bool allowArchChange() const
zypp::Resolver::removeRequire
void removeRequire(const Capability &capability)
Remove the additional requirement set by addRequire(Capability).
Definition Resolver.cc:152
zypp::Resolver::removeConflict
void removeConflict(const Capability &capability)
Remove the additional conflict set by addConflict(Capability).
Definition Resolver.cc:153
zypp::Resolver::dupAllowVendorChange
bool dupAllowVendorChange() const
zypp::Resolver::upgradingRepos
bool upgradingRepos() const
Whether there is at least one UpgradeRepo request pending.
Definition Resolver.cc:145
zypp::Resolver::focus
ResolverFocus focus() const
Definition Resolver.cc:87
zypp::Resolver::setDefaultAllowDowngrade
void setDefaultAllowDowngrade()
zypp::Resolver::undo
void undo()
Definition Resolver.cc:68
zypp::Resolver::allowVendorChange
bool allowVendorChange() const
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:176
zypp::Resolver::setDefaultSolveSrcPackages
void setDefaultSolveSrcPackages()
Definition Resolver.cc:116
zypp::Resolver::_pimpl
zypp::RW_pointer< solver::detail::ResolverInternal > _pimpl
Definition Resolver.h:491
zypp::Resolver::setAllowArchChange
void setAllowArchChange(bool yesno_r)
Whether to allow one to change architecture of installed solvables.
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:155
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:173
zypp::Resolver::dupSetAllowArchChange
void dupSetAllowArchChange(bool yesno_r)
dup mode: allow one to change architecture of installed solvables
zypp::Resolver::onlyRequires
bool onlyRequires() const
Definition Resolver.cc:97
zypp::Resolver::dupSetAllowDowngrade
void dupSetAllowDowngrade(bool yesno_r)
dup mode: allow one to downgrade installed solvable
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::base::ReferenceCounted
Base class for reference counted objects.
Definition ReferenceCounted.h:35
zypp::sat::Transaction
Libsolv transaction wrapper.
Definition Transaction.h:52
Types.h
str
String related utilities and Regular expression matching.
zypp::base::NonCopyable
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition NonCopyable.h:26
zypp::pool
Definition ByIdent.h:24
zypp::sat::detail::CSolver
::s_Solver CSolver
Wrapped libsolv C data type exposed as backdoor.
Definition PoolMember.h:65
zypp::sat
Definition Resolver.h:28
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
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
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::operator<<
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Definition SerialNumber.cc:52
zypp::CapabilitySet
std::unordered_set< Capability > CapabilitySet
Definition Capability.h:35
zypp::ZYPP_API
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
zypp::RW_pointer
Wrapper for const correct access via Smart pointer types.
Definition PtrTypes.h:293
ReferenceCounted.h