libzypp  17.14.0
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 #include "zypp/base/PtrTypes.h"
20 
21 #include "zypp/ResPool.h"
22 #include "zypp/PoolItem.h"
23 #include "zypp/Capabilities.h"
24 #include "zypp/Capability.h"
25 #include "zypp/ResolverNamespace.h"
26 
28 
29 #include "zypp/ProblemTypes.h"
30 #include "zypp/ResolverProblem.h"
31 #include "zypp/ProblemSolution.h"
32 
34 namespace zypp
35 {
36 
37  namespace sat
38  {
39  class Transaction;
40  }
41 
43  //
44  // CLASS NAME : Resolver
45  //
55  {
56  public:
57 
59  Resolver( const ResPool & pool );
61  virtual ~Resolver();
62 
71  bool verifySystem();
72 
73 
88  bool resolvePool();
89 
90 
109 
110  /*
111  * Undo solver changes done in resolvePool()
112  * Throwing away all ignored dependencies.
113  */
114  void undo();
115 
116  /*
117  * Resets solver information and verify option.
118  */
119  void reset();
120 
121 
135  bool doUpgrade();
136 
146  void doUpdate( );
147 
155  std::list<PoolItem> problematicUpdateItems() const;
156 
163 
164 
169  void applySolutions( const ProblemSolutionList & solutions );
170 
175 
181  void setForceResolve( bool force );
182  bool forceResolve() const;
183 
188  void setIgnoreAlreadyRecommended( bool yesno_r );
189  bool ignoreAlreadyRecommended() const;
190 
196  void setOnlyRequires( bool yesno_r );
197  void resetOnlyRequires(); // set back to default (described in zypp.conf)
198  bool onlyRequires() const;
199 
205  void setUpgradeMode( bool yesno_r );
206  bool upgradeMode() const;
207 
213  void setUpdateMode( bool yesno_r );
214  bool updateMode() const;
215 
216 
222  void setAllowDowngrade( bool yesno_r );
223  void setDefaultAllowDowngrade(); // Set back to default
224  bool allowDowngrade() const;
225 
227  void setAllowNameChange( bool yesno_r );
228  void setDefaultAllowNameChange(); // Set back to default
229  bool allowNameChange() const;
230 
232  void setAllowArchChange( bool yesno_r );
233  void setDefaultAllowArchChange(); // Set back to default
234  bool allowArchChange() const;
235 
239  void setAllowVendorChange( bool yesno_r );
240  void setDefaultAllowVendorChange(); // Set back to default
241  bool allowVendorChange() const;
243 
249  void setSystemVerification( bool yesno_r );
251  bool systemVerification() const;
252 
262  void setSolveSrcPackages( bool yesno_r );
264  bool solveSrcPackages() const;
265 
270  void setCleandepsOnRemove( bool yesno_r );
271  void setDefaultCleandepsOnRemove(); // set back to default (in zypp.conf)
272  bool cleandepsOnRemove() const;
273 
280  void dupSetAllowDowngrade( bool yesno_r );
281  void dupSetDefaultAllowDowngrade(); // Set back to default (in zypp.conf)
282  bool dupAllowDowngrade() const;
283 
285  void dupSetAllowNameChange( bool yesno_r );
286  void dupSetDefaultAllowNameChange(); // Set back to default (in zypp.conf)
287  bool dupAllowNameChange() const;
288 
290  void dupSetAllowArchChange( bool yesno_r );
291  void dupSetDefaultAllowArchChange(); // Set back to default (in zypp.conf)
292  bool dupAllowArchChange() const;
293 
295  void dupSetAllowVendorChange( bool yesno_r );
296  void dupSetDefaultAllowVendorChange(); // Set back to default (in zypp.conf)
297  bool dupAllowVendorChange() const;
299 
311  void addUpgradeRepo( Repository repo_r );
312 
316  bool upgradingRepos() const;
317 
321  bool upgradingRepo( Repository repo_r ) const;
322 
326  void removeUpgradeRepo( Repository repo_r );
327 
331  void removeUpgradeRepos();
333 
338  void addRequire( const Capability & capability );
339 
344  void addConflict( const Capability & capability );
345 
350  void removeRequire( const Capability & capability );
351 
356  void removeConflict( const Capability & capability );
357 
362  CapabilitySet getRequire() const;
363 
368  CapabilitySet getConflict() const;
369 
376  bool createSolverTestcase( const std::string & dumpPath = "/var/log/YaST2/solverTestcase", bool runSolver = true );
377 
393 
409 
425 
426 
442 
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
void doUpdate()
Update to newest package.
Definition: Resolver.cc:80
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
std::list< ProblemSolution_Ptr > ProblemSolutionList
Definition: ProblemTypes.h:43
bool resolvePool()
Resolve package dependencies:
Definition: Resolver.cc:59
sat::Transaction getTransaction()
Return the Transaction computed by the last solver run.
Definition: Resolver.cc:74
bool upgradingRepos() const
Whether there is at least one UpgradeRepo request pending.
Definition: Resolver.cc:133
void addUpgradeRepo(Repository repo_r)
Adding request to perform a dist upgrade restricted to this repository.
Definition: Resolver.cc:132
void setDefaultAllowVendorChange()
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
CapabilitySet getRequire() const
Get all the additional requirements set by addRequire(Capability).
Definition: Resolver.cc:143
void setAllowDowngrade(bool yesno_r)
Whether to allow to downgrade installed solvable.
bool dupAllowVendorChange() const
void setAllowNameChange(bool yesno_r)
Whether to allow to change name of installed solvable.
void setDefaultSolveSrcPackages()
Definition: Resolver.cc:104
void setCleandepsOnRemove(bool yesno_r)
Cleanup when deleting packages.
Definition: Resolver.cc:107
void removeRequire(const Capability &capability)
Remove the additional requirement set by addRequire(Capability).
Definition: Resolver.cc:140
void dupSetDefaultAllowNameChange()
void dupSetAllowNameChange(bool yesno_r)
dup mode: allow to change name of installed solvable
void setAllowVendorChange(bool yesno_r)
Whether to allow to change vendor of installed solvables.
String related utilities and Regular expression matching.
zypp::RW_pointer< solver::detail::ResolverInternal > _pimpl
Definition: Resolver.h:446
void setUpdateMode(bool yesno_r)
Setting whether the solver should perform in 'update' mode or not.
Definition: Resolver.cc:96
void setOnlyRequires(bool yesno_r)
Setting whether required packages are installed ONLY So recommended packages, language packages and p...
Definition: Resolver.cc:89
Libsolv transaction wrapper.
Definition: Transaction.h:51
void undo()
Definition: Resolver.cc:65
bool doUpgrade()
Do an distribution upgrade (DUP)
Definition: Resolver.cc:77
std::list< SolverQueueItem_Ptr > SolverQueueItemList
Definition: Types.h:45
friend std::ostream & operator<<(std::ostream &str, const Resolver &obj)
Definition: Resolver.cc:170
solver::detail::ItemCapKindList isInstalledBy(const PoolItem &item)
Gives information about WHO has pused an installation of an given item.
Definition: Resolver.cc:155
bool resolveQueue(solver::detail::SolverQueueItemList &queue)
Resolve package dependencies:
Definition: Resolver.cc:62
bool ignoreAlreadyRecommended() const
Definition: Resolver.cc:87
ResolverProblemList problems()
Return the dependency problems found by the last call to resolveDependencies().
Definition: Resolver.cc:68
void removeUpgradeRepo(Repository repo_r)
Remove an upgrade request for this repo.
Definition: Resolver.cc:135
solver::detail::ItemCapKindList installedSatisfied(const PoolItem &item)
Gives information about WHICH items require an already installed item.
Definition: Resolver.cc:164
bool updateMode() const
Definition: Resolver.cc:97
void setDefaultAllowArchChange()
CapabilitySet getConflict() const
Get all the additional conflicts set by addConflict(Capability).
Definition: Resolver.cc:144
void setUpgradeMode(bool yesno_r)
Setting whether the solver should perform in 'upgrade' mode or not.
Definition: Resolver.cc:93
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
void setDefaultCleandepsOnRemove()
Definition: Resolver.cc:108
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition: NonCopyable.h:26
std::list< ResolverProblem_Ptr > ResolverProblemList
Definition: ProblemTypes.h:46
Dependency resolver interface.
Definition: Resolver.h:54
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:147
void setDefaultAllowNameChange()
virtual ~Resolver()
Dtor.
Definition: Resolver.cc:48
std::list< PoolItem > problematicUpdateItems() const
Unmaintained packages which does not fit to the updated system (broken dependencies) will be deleted.
Definition: Resolver.cc:146
void resetOnlyRequires()
Definition: Resolver.cc:90
void dupSetDefaultAllowArchChange()
bool solveSrcPackages() const
Definition: Resolver.cc:105
void setAllowArchChange(bool yesno_r)
Whether to allow to change architecture of installed solvables.
bool forceResolve() const
Definition: Resolver.cc:84
void setDefaultAllowDowngrade()
void addConflict(const Capability &capability)
Adding additional conflict.
Definition: Resolver.cc:139
bool onlyRequires() const
Definition: Resolver.cc:91
bool allowDowngrade() const
Base class for reference counted objects.
bool cleandepsOnRemove() const
Definition: Resolver.cc:109
void setSystemVerification(bool yesno_r)
System verification mode also monitors and repairs dependencies of already installed packages.
Definition: Resolver.cc:99
void applySolutions(const ProblemSolutionList &solutions)
Apply problem solutions.
Definition: Resolver.cc:71
std::unordered_set< Capability > CapabilitySet
Definition: Capability.h:33
bool upgradeMode() const
Definition: Resolver.cc:94
Global ResObject pool.
Definition: ResPool.h:60
void addRequire(const Capability &capability)
Adding additional requirement.
Definition: Resolver.cc:138
std::list< ItemCapKind > ItemCapKindList
Definition: Types.h:41
bool allowNameChange() const
void dupSetDefaultAllowDowngrade()
bool dupAllowNameChange() const
A sat capability.
Definition: Capability.h:59
void removeConflict(const Capability &capability)
Remove the additional conflict set by addConflict(Capability).
Definition: Resolver.cc:141
Wrapper for const correct access via Smart pointer types.
Definition: PtrTypes.h:285
bool verifySystem()
Resolve package dependencies:
Definition: Resolver.cc:56
void setForceResolve(bool force)
Remove resolvables which are conflicts with others or have unfulfilled requirements.
Definition: Resolver.cc:83
Combining sat::Solvable and ResStatus.
Definition: PoolItem.h:50
void dupSetAllowDowngrade(bool yesno_r)
dup mode: allow to downgrade installed solvable
void dupSetAllowArchChange(bool yesno_r)
dup mode: allow to change architecture of installed solvables
bool allowVendorChange() const
void reset()
Definition: Resolver.cc:167
bool upgradingRepo(Repository repo_r) const
Whether there is an UpgradeRepo request pending for this repo.
Definition: Resolver.cc:134
void setIgnoreAlreadyRecommended(bool yesno_r)
Ignore recommended packages that were already recommended by the installed packages.
Definition: Resolver.cc:86
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
void dupSetDefaultAllowVendorChange()
void setDefaultSystemVerification()
Definition: Resolver.cc:100
void removeUpgradeRepos()
Remove all upgrade repo requests.
Definition: Resolver.cc:136
void dupSetAllowVendorChange(bool yesno_r)
dup mode: allow to change vendor of installed solvables
void setSolveSrcPackages(bool yesno_r)
Set whether to solve source packages build dependencies per default.
Definition: Resolver.cc:103
Resolver(const ResPool &pool)
Ctor.
Definition: Resolver.cc:39
bool systemVerification() const
Definition: Resolver.cc:101
bool dupAllowDowngrade() const
bool allowArchChange() const
bool dupAllowArchChange() const