libzypp  15.28.6
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 
27 
28 #include "zypp/ProblemTypes.h"
29 #include "zypp/ResolverProblem.h"
30 #include "zypp/ProblemSolution.h"
31 
33 namespace zypp
34 {
35 
36  namespace sat
37  {
38  class Transaction;
39  }
40 
42  //
43  // CLASS NAME : Resolver
44  //
54  {
55  public:
56 
58  Resolver( const ResPool & pool );
60  virtual ~Resolver();
61 
70  bool verifySystem();
71 
72 
87  bool resolvePool();
88 
89 
108 
109  /*
110  * Undo solver changes done in resolvePool()
111  * Throwing away all ignored dependencies.
112  */
113  void undo();
114 
115  /*
116  * Resets solver information and verify option.
117  */
118  void reset();
119 
120 
134  bool doUpgrade();
135 
145  void doUpdate( );
146 
154  std::list<PoolItem> problematicUpdateItems() const;
155 
162 
163 
168  void applySolutions( const ProblemSolutionList & solutions );
169 
174 
180  void setForceResolve( bool force );
181  bool forceResolve() const;
182 
187  void setIgnoreAlreadyRecommended( bool yesno_r );
188  bool ignoreAlreadyRecommended() const;
189 
195  void setOnlyRequires( bool yesno_r );
196  void resetOnlyRequires(); // set back to default (described in zypp.conf)
197  bool onlyRequires() const;
198 
204  void setUpgradeMode( bool yesno_r );
205  bool upgradeMode() const;
206 
212  void setAllowDowngrade( bool yesno_r );
213  void setDefaultAllowDowngrade(); // Set back to default
214  bool allowDowngrade() const;
215 
217  void setAllowNameChange( bool yesno_r );
218  void setDefaultAllowNameChange(); // Set back to default
219  bool allowNameChange() const;
220 
222  void setAllowArchChange( bool yesno_r );
223  void setDefaultAllowArchChange(); // Set back to default
224  bool allowArchChange() const;
225 
229  void setAllowVendorChange( bool yesno_r );
230  void setDefaultAllowVendorChange(); // Set back to default
231  bool allowVendorChange() const;
233 
239  void setSystemVerification( bool yesno_r );
241  bool systemVerification() const;
242 
252  void setSolveSrcPackages( bool yesno_r );
254  bool solveSrcPackages() const;
255 
260  void setCleandepsOnRemove( bool yesno_r );
261  void setDefaultCleandepsOnRemove(); // set back to default (in zypp.conf)
262  bool cleandepsOnRemove() const;
263 
270  void dupSetAllowDowngrade( bool yesno_r );
271  void dupSetDefaultAllowDowngrade(); // Set back to default (in zypp.conf)
272  bool dupAllowDowngrade() const;
273 
275  void dupSetAllowNameChange( bool yesno_r );
276  void dupSetDefaultAllowNameChange(); // Set back to default (in zypp.conf)
277  bool dupAllowNameChange() const;
278 
280  void dupSetAllowArchChange( bool yesno_r );
281  void dupSetDefaultAllowArchChange(); // Set back to default (in zypp.conf)
282  bool dupAllowArchChange() const;
283 
285  void dupSetAllowVendorChange( bool yesno_r );
286  void dupSetDefaultAllowVendorChange(); // Set back to default (in zypp.conf)
287  bool dupAllowVendorChange() const;
289 
301  void addUpgradeRepo( Repository repo_r );
302 
306  bool upgradingRepos() const;
307 
311  bool upgradingRepo( Repository repo_r ) const;
312 
316  void removeUpgradeRepo( Repository repo_r );
317 
321  void removeUpgradeRepos();
323 
328  void addRequire( const Capability & capability );
329 
334  void addConflict( const Capability & capability );
335 
340  void removeRequire( const Capability & capability );
341 
346  void removeConflict( const Capability & capability );
347 
352  CapabilitySet getRequire() const;
353 
358  CapabilitySet getConflict() const;
359 
366  bool createSolverTestcase( const std::string & dumpPath = "/var/log/YaST2/solverTestcase", bool runSolver = true );
367 
383 
399 
415 
416 
432 
433 
434  private:
435  friend std::ostream & operator<<( std::ostream & str, const Resolver & obj );
437  };
439 
441  std::ostream & operator<<( std::ostream & str, const Resolver & obj );
442 
444 } // namespace zypp
446 #endif // ZYPP_RESOLVER_H
bool upgradingRepos() const
Whether there is at least one UpgradeRepo request pending.
Definition: Resolver.cc:130
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:155
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
std::list< PoolItem > problematicUpdateItems() const
Unmaintained packages which does not fit to the updated system (broken dependencies) will be deleted...
Definition: Resolver.cc:143
void addUpgradeRepo(Repository repo_r)
Adding request to perform a dist upgrade restricted to this repository.
Definition: Resolver.cc:129
bool dupAllowVendorChange() const
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:146
void setAllowDowngrade(bool yesno_r)
Whether to allow to downgrade installed solvable.
void setAllowNameChange(bool yesno_r)
Whether to allow to change name of installed solvable.
bool allowVendorChange() const
void setDefaultSolveSrcPackages()
Definition: Resolver.cc:101
void setCleandepsOnRemove(bool yesno_r)
Cleanup when deleting packages.
Definition: Resolver.cc:104
void removeRequire(const Capability &capability)
Remove the additional requirement set by addRequire(Capability).
Definition: Resolver.cc:137
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.
zypp::RW_pointer< solver::detail::ResolverInternal > _pimpl
Definition: Resolver.h:436
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
bool upgradingRepo(Repository repo_r) const
Whether there is an UpgradeRepo request pending for this repo.
Definition: Resolver.cc:131
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:167
solver::detail::ItemCapKindList isInstalledBy(const PoolItem &item)
Gives information about WHO has pused an installation of an given item.
Definition: Resolver.cc:152
bool ignoreAlreadyRecommended() const
Definition: Resolver.cc:87
bool solveSrcPackages() const
Definition: Resolver.cc:102
bool dupAllowNameChange() const
bool resolveQueue(solver::detail::SolverQueueItemList &queue)
Resolve package dependencies:
Definition: Resolver.cc:62
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:132
bool allowNameChange() const
solver::detail::ItemCapKindList installedSatisfied(const PoolItem &item)
Gives information about WHICH items require an already installed item.
Definition: Resolver.cc:161
void setDefaultAllowArchChange()
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:158
bool systemVerification() const
Definition: Resolver.cc:98
void setDefaultCleandepsOnRemove()
Definition: Resolver.cc:105
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:53
bool dupAllowArchChange() const
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:120
void setDefaultAllowNameChange()
virtual ~Resolver()
Dtor.
Definition: Resolver.cc:48
void resetOnlyRequires()
Definition: Resolver.cc:90
void dupSetDefaultAllowArchChange()
bool cleandepsOnRemove() const
Definition: Resolver.cc:106
CapabilitySet getConflict() const
Get all the additional conflicts set by addConflict(Capability).
Definition: Resolver.cc:141
CapabilitySet getRequire() const
Get all the additional requirements set by addRequire(Capability).
Definition: Resolver.cc:140
void setAllowArchChange(bool yesno_r)
Whether to allow to change architecture of installed solvables.
void setDefaultAllowDowngrade()
bool forceResolve() const
Definition: Resolver.cc:84
void addConflict(const Capability &capability)
Adding additional conflict.
Definition: Resolver.cc:136
Base class for reference counted objects.
bool allowArchChange() const
void setSystemVerification(bool yesno_r)
System verification mode also monitors and repairs dependencies of already installed packages...
Definition: Resolver.cc:96
void applySolutions(const ProblemSolutionList &solutions)
Apply problem solutions.
Definition: Resolver.cc:71
std::unordered_set< Capability > CapabilitySet
Definition: Capability.h:33
Global ResObject pool.
Definition: ResPool.h:60
void addRequire(const Capability &capability)
Adding additional requirement.
Definition: Resolver.cc:135
std::list< ItemCapKind > ItemCapKindList
Definition: Types.h:41
void dupSetDefaultAllowDowngrade()
bool dupAllowDowngrade() const
A sat capability.
Definition: Capability.h:59
void removeConflict(const Capability &capability)
Remove the additional conflict set by addConflict(Capability).
Definition: Resolver.cc:138
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
bool upgradeMode() const
Definition: Resolver.cc:94
void dupSetAllowArchChange(bool yesno_r)
dup mode: allow to change architecture of installed solvables
void reset()
Definition: Resolver.cc:164
void setIgnoreAlreadyRecommended(bool yesno_r)
Ignore recommended packages that were already recommended by the installed packages.
Definition: Resolver.cc:86
bool onlyRequires() const
Definition: Resolver.cc:91
bool allowDowngrade() const
void dupSetDefaultAllowVendorChange()
void setDefaultSystemVerification()
Definition: Resolver.cc:97
void removeUpgradeRepos()
Remove all upgrade repo requests.
Definition: Resolver.cc:133
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:100
Resolver(const ResPool &pool)
Ctor.
Definition: Resolver.cc:39