libzypp  17.25.1
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 
19 
20 #include <zypp/solver/Types.h>
22 
24 namespace zypp
25 {
26 
27  namespace sat
28  {
29  class Transaction;
30  }
31 
33  //
34  // CLASS NAME : Resolver
35  //
45  {
46  public:
47 
49  Resolver( const ResPool & pool );
51  virtual ~Resolver();
52 
61  bool verifySystem();
62 
63 
78  bool resolvePool();
79 
80 
99 
100  /*
101  * Undo solver changes done in resolvePool()
102  * Throwing away all ignored dependencies.
103  */
104  void undo();
105 
106  /*
107  * Resets solver information and verify option.
108  */
109  void reset();
110 
111 
125  bool doUpgrade();
126 
136  void doUpdate( );
137 
145  std::list<PoolItem> problematicUpdateItems() const;
146 
153 
154 
159  void applySolutions( const ProblemSolutionList & solutions );
160 
165 
170  void setFocus( ResolverFocus focus_r );
171  ResolverFocus focus() const;
172 
178  void setForceResolve( bool force );
179  bool forceResolve() const;
180 
185  void setIgnoreAlreadyRecommended( bool yesno_r );
186  bool ignoreAlreadyRecommended() const;
187 
193  void setOnlyRequires( bool yesno_r );
194  void resetOnlyRequires(); // set back to default (described in zypp.conf)
195  bool onlyRequires() const;
196 
202  void setUpgradeMode( bool yesno_r );
203  bool upgradeMode() const;
204 
210  void setUpdateMode( bool yesno_r );
211  bool updateMode() const;
212 
213 
219  void setAllowDowngrade( bool yesno_r );
220  void setDefaultAllowDowngrade(); // Set back to default
221  bool allowDowngrade() const;
222 
224  void setAllowNameChange( bool yesno_r );
225  void setDefaultAllowNameChange(); // Set back to default
226  bool allowNameChange() const;
227 
229  void setAllowArchChange( bool yesno_r );
230  void setDefaultAllowArchChange(); // Set back to default
231  bool allowArchChange() const;
232 
236  void setAllowVendorChange( bool yesno_r );
237  void setDefaultAllowVendorChange(); // Set back to default
238  bool allowVendorChange() const;
240 
246  void setSystemVerification( bool yesno_r );
248  bool systemVerification() const;
249 
259  void setSolveSrcPackages( bool yesno_r );
261  bool solveSrcPackages() const;
262 
267  void setCleandepsOnRemove( bool yesno_r );
268  void setDefaultCleandepsOnRemove(); // set back to default (in zypp.conf)
269  bool cleandepsOnRemove() const;
270 
277  void dupSetAllowDowngrade( bool yesno_r );
278  void dupSetDefaultAllowDowngrade(); // Set back to default (in zypp.conf)
279  bool dupAllowDowngrade() const;
280 
282  void dupSetAllowNameChange( bool yesno_r );
283  void dupSetDefaultAllowNameChange(); // Set back to default (in zypp.conf)
284  bool dupAllowNameChange() const;
285 
287  void dupSetAllowArchChange( bool yesno_r );
288  void dupSetDefaultAllowArchChange(); // Set back to default (in zypp.conf)
289  bool dupAllowArchChange() const;
290 
292  void dupSetAllowVendorChange( bool yesno_r );
293  void dupSetDefaultAllowVendorChange(); // Set back to default (in zypp.conf)
294  bool dupAllowVendorChange() const;
296 
308  void addUpgradeRepo( Repository repo_r );
309 
313  bool upgradingRepos() const;
314 
318  bool upgradingRepo( Repository repo_r ) const;
319 
323  void removeUpgradeRepo( Repository repo_r );
324 
328  void removeUpgradeRepos();
330 
335  void addRequire( const Capability & capability );
336 
341  void addConflict( const Capability & capability );
342 
347  void removeRequire( const Capability & capability );
348 
353  void removeConflict( const Capability & capability );
354 
359  CapabilitySet getRequire() const;
360 
365  CapabilitySet getConflict() const;
366 
373  bool createSolverTestcase( const std::string & dumpPath = "/var/log/YaST2/solverTestcase", bool runSolver = true );
374 
390 
406 
422 
423 
439 
440  public:
442  sat::detail::CSolver * get() const;
443 
444  private:
445  friend std::ostream & operator<<( std::ostream & str, const Resolver & obj );
447  };
449 
451  std::ostream & operator<<( std::ostream & str, const Resolver & obj );
452 
454 } // namespace zypp
456 #endif // ZYPP_RESOLVER_H
zypp::Resolver::allowVendorChange
bool allowVendorChange() const
zypp::Resolver::removeRequire
void removeRequire(const Capability &capability)
Remove the additional requirement set by addRequire(Capability).
Definition: Resolver.cc:143
zypp::PoolItem
Combining sat::Solvable and ResStatus.
Definition: PoolItem.h:50
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:152
zypp::Resolver::_pimpl
zypp::RW_pointer< solver::detail::ResolverInternal > _pimpl
Definition: Resolver.h:446
zypp::Resolver::dupAllowArchChange
bool dupAllowArchChange() const
zypp::Resolver::dupAllowDowngrade
bool dupAllowDowngrade() const
zypp::Resolver::setDefaultSystemVerification
void setDefaultSystemVerification()
Definition: Resolver.cc:103
zypp::Resolver::doUpdate
void doUpdate()
Update to newest package.
Definition: Resolver.cc:80
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:92
zypp::Resolver::undo
void undo()
Definition: Resolver.cc:65
Types.h
Types.h
zypp::Resolver::setSolveSrcPackages
void setSolveSrcPackages(bool yesno_r)
Set whether to solve source packages build dependencies per default.
Definition: Resolver.cc:106
zypp::Resolver::Resolver
Resolver(const ResPool &pool)
Ctor.
Definition: Resolver.cc:36
zypp::Resolver::systemVerification
bool systemVerification() const
Definition: Resolver.cc:104
zypp::Resolver::setUpdateMode
void setUpdateMode(bool yesno_r)
Setting whether the solver should perform in 'update' mode or not.
Definition: Resolver.cc:99
zypp::Resolver::addUpgradeRepo
void addUpgradeRepo(Repository repo_r)
Adding request to perform a dist upgrade restricted to this repository.
Definition: Resolver.cc:135
zypp::Resolver::doUpgrade
bool doUpgrade()
Do an distribution upgrade (DUP)
Definition: Resolver.cc:77
zypp::Resolver::getConflict
CapabilitySet getConflict() const
Get all the additional conflicts set by addConflict(Capability).
Definition: Resolver.cc:147
zypp::base::ReferenceCounted
Base class for reference counted objects.
Definition: ReferenceCounted.h:33
zypp::Resolver::setDefaultSolveSrcPackages
void setDefaultSolveSrcPackages()
Definition: Resolver.cc:107
zypp::Resolver::dupSetAllowNameChange
void dupSetAllowNameChange(bool yesno_r)
dup mode: allow to change name of installed solvable
zypp::Resolver::dupSetDefaultAllowNameChange
void dupSetDefaultAllowNameChange()
zypp::Resolver::ignoreAlreadyRecommended
bool ignoreAlreadyRecommended() const
Definition: Resolver.cc:90
zypp::Resolver::removeUpgradeRepo
void removeUpgradeRepo(Repository repo_r)
Remove an upgrade request for this repo.
Definition: Resolver.cc:138
zypp::Resolver::setDefaultAllowArchChange
void setDefaultAllowArchChange()
zypp::Resolver::getRequire
CapabilitySet getRequire() const
Get all the additional requirements set by addRequire(Capability).
Definition: Resolver.cc:146
zypp::ProblemSolutionList
std::list< ProblemSolution_Ptr > ProblemSolutionList
Definition: ProblemTypes.h:43
zypp::Resolver::solveSrcPackages
bool solveSrcPackages() const
Definition: Resolver.cc:108
zypp::ResolverFocus
ResolverFocus
The resolvers general attitude.
Definition: ResolverFocus.h:21
zypp::sat::Transaction
Libsolv transaction wrapper.
Definition: Transaction.h:51
zypp::Resolver::dupSetDefaultAllowArchChange
void dupSetDefaultAllowArchChange()
zypp::Resolver::forceResolve
bool forceResolve() const
Definition: Resolver.cc:87
zypp::sat::detail::CSolver
::s_Solver CSolver
Wrapped libsolv C data type exposed as backdoor.
Definition: PoolMember.h:65
zypp::Resolver::operator<<
friend std::ostream & operator<<(std::ostream &str, const Resolver &obj)
Definition: Resolver.cc:173
zypp::Resolver::setCleandepsOnRemove
void setCleandepsOnRemove(bool yesno_r)
Cleanup when deleting packages.
Definition: Resolver.cc:110
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:158
zypp::Resolver::setDefaultAllowDowngrade
void setDefaultAllowDowngrade()
zypp::Resolver::setAllowVendorChange
void setAllowVendorChange(bool yesno_r)
Whether to allow to change vendor of installed solvables.
zypp::Resolver::resolveQueue
bool resolveQueue(solver::detail::SolverQueueItemList &queue)
Resolve package dependencies:
Definition: Resolver.cc:62
zypp::Resolver::addConflict
void addConflict(const Capability &capability)
Adding additional conflict.
Definition: Resolver.cc:142
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:149
zypp::RW_pointer
Wrapper for const correct access via Smart pointer types.
Definition: PtrTypes.h:285
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:167
zypp::Resolver::problems
ResolverProblemList problems()
Return the dependency problems found by the last call to resolveDependencies().
Definition: Resolver.cc:68
zypp::solver::detail::SolverQueueItemList
std::list< SolverQueueItem_Ptr > SolverQueueItemList
Definition: Types.h:45
zypp::Resolver::setAllowArchChange
void setAllowArchChange(bool yesno_r)
Whether to allow to change architecture of installed solvables.
zypp::Resolver::applySolutions
void applySolutions(const ProblemSolutionList &solutions)
Apply problem solutions.
Definition: Resolver.cc:71
zypp::base::NonCopyable
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition: NonCopyable.h:26
zypp::Resolver
Dependency resolver interface.
Definition: Resolver.h:44
zypp::Resolver::setDefaultAllowNameChange
void setDefaultAllowNameChange()
zypp::Resolver::allowDowngrade
bool allowDowngrade() const
zypp::Resolver::cleandepsOnRemove
bool cleandepsOnRemove() const
Definition: Resolver.cc:112
zypp::Resolver::updateMode
bool updateMode() const
Definition: Resolver.cc:100
zypp::Resolver::resetOnlyRequires
void resetOnlyRequires()
Definition: Resolver.cc:93
zypp::Resolver::setUpgradeMode
void setUpgradeMode(bool yesno_r)
Setting whether the solver should perform in 'upgrade' mode or not.
Definition: Resolver.cc:96
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:164
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:102
zypp::Resolver::setDefaultCleandepsOnRemove
void setDefaultCleandepsOnRemove()
Definition: Resolver.cc:111
zypp::Resolver::get
sat::detail::CSolver * get() const
Expert backdoor.
Definition: Resolver.cc:53
zypp::Resolver::addRequire
void addRequire(const Capability &capability)
Adding additional requirement.
Definition: Resolver.cc:141
zypp::Resolver::~Resolver
virtual ~Resolver()
Dtor.
Definition: Resolver.cc:45
zypp::Resolver::focus
ResolverFocus focus() const
Definition: Resolver.cc:84
zypp::ResolverProblemList
std::list< ResolverProblem_Ptr > ResolverProblemList
Definition: ProblemTypes.h:46
zypp::Resolver::dupSetAllowDowngrade
void dupSetAllowDowngrade(bool yesno_r)
dup mode: allow to downgrade installed solvable
zypp::Resolver::reset
void reset()
Definition: Resolver.cc:170
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:89
zypp::Resolver::setForceResolve
void setForceResolve(bool force)
Remove resolvables which are conflicts with others or have unfulfilled requirements.
Definition: Resolver.cc:86
zypp::Capability
A sat capability.
Definition: Capability.h:59
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:147
ReferenceCounted.h
zypp::Resolver::dupSetDefaultAllowVendorChange
void dupSetDefaultAllowVendorChange()
zypp::Resolver::onlyRequires
bool onlyRequires() const
Definition: Resolver.cc:94
zypp::Resolver::upgradeMode
bool upgradeMode() const
Definition: Resolver.cc:97
zypp::Resolver::allowNameChange
bool allowNameChange() const
zypp::Resolver::upgradingRepo
bool upgradingRepo(Repository repo_r) const
Whether there is an UpgradeRepo request pending for this repo.
Definition: Resolver.cc:137
zypp::Resolver::dupSetAllowVendorChange
void dupSetAllowVendorChange(bool yesno_r)
dup mode: allow to change vendor of installed solvables
zypp::Resolver::dupAllowNameChange
bool dupAllowNameChange() const
zypp::Resolver::allowArchChange
bool allowArchChange() const
zypp::Resolver::verifySystem
bool verifySystem()
Resolve package dependencies:
Definition: Resolver.cc:56
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:161
str
String related utilities and Regular expression matching.
zypp::solver::detail::ItemCapKindList
std::list< ItemCapKind > ItemCapKindList
Definition: Types.h:41
zypp::Resolver::resolvePool
bool resolvePool()
Resolve package dependencies:
Definition: Resolver.cc:59
zypp::Resolver::removeUpgradeRepos
void removeUpgradeRepos()
Remove all upgrade repo requests.
Definition: Resolver.cc:139
zypp::Resolver::dupSetDefaultAllowDowngrade
void dupSetDefaultAllowDowngrade()
zypp::Resolver::upgradingRepos
bool upgradingRepos() const
Whether there is at least one UpgradeRepo request pending.
Definition: Resolver.cc:136
zypp::Resolver::removeConflict
void removeConflict(const Capability &capability)
Remove the additional conflict set by addConflict(Capability).
Definition: Resolver.cc:144
zypp::Repository
Definition: Repository.h:39
zypp::Resolver::setDefaultAllowVendorChange
void setDefaultAllowVendorChange()
zypp::Resolver::setAllowDowngrade
void setAllowDowngrade(bool yesno_r)
Whether to allow to downgrade installed solvable.
zypp::Resolver::getTransaction
sat::Transaction getTransaction()
Return the Transaction computed by the last solver run.
Definition: Resolver.cc:74
zypp::Resolver::dupAllowVendorChange
bool dupAllowVendorChange() const
zypp::Resolver::dupSetAllowArchChange
void dupSetAllowArchChange(bool yesno_r)
dup mode: allow to change architecture of installed solvables
zypp::Resolver::setFocus
void setFocus(ResolverFocus focus_r)
Define the resolvers general attitude when resolving jobs.
Definition: Resolver.cc:83
zypp::Resolver::setAllowNameChange
void setAllowNameChange(bool yesno_r)
Whether to allow to change name of installed solvable.