libzypp  17.31.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 
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 Resolver : public base::ReferenceCounted, private base::NonCopyable
45  {
46  public:
47 
49  Resolver( const ResPool & pool );
51  virtual ~Resolver();
52 
64  void setDefaultSolverFlags( bool all_r = true );
65 
74  bool verifySystem();
75 
76 
91  bool resolvePool();
92 
93 
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 
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 
226 
232  void setAllowDowngrade( bool yesno_r );
233  void setDefaultAllowDowngrade(); // Set back to default
234  bool allowDowngrade() const;
235 
237  void setAllowNameChange( bool yesno_r );
238  void setDefaultAllowNameChange(); // Set back to default
239  bool allowNameChange() const;
240 
242  void setAllowArchChange( bool yesno_r );
243  void setDefaultAllowArchChange(); // Set back to default
244  bool allowArchChange() const;
245 
249  void setAllowVendorChange( bool yesno_r );
250  void setDefaultAllowVendorChange(); // Set back to default
251  bool allowVendorChange() const;
253 
259  void setSystemVerification( bool yesno_r );
261  bool systemVerification() const;
262 
272  void setSolveSrcPackages( bool yesno_r );
274  bool solveSrcPackages() const;
275 
280  void setCleandepsOnRemove( bool yesno_r );
281  void setDefaultCleandepsOnRemove(); // set back to default (in zypp.conf)
282  bool cleandepsOnRemove() const;
283 
290  void dupSetAllowDowngrade( bool yesno_r );
291  void dupSetDefaultAllowDowngrade(); // Set back to default (in zypp.conf)
292  bool dupAllowDowngrade() const;
293 
295  void dupSetAllowNameChange( bool yesno_r );
296  void dupSetDefaultAllowNameChange(); // Set back to default (in zypp.conf)
297  bool dupAllowNameChange() const;
298 
300  void dupSetAllowArchChange( bool yesno_r );
301  void dupSetDefaultAllowArchChange(); // Set back to default (in zypp.conf)
302  bool dupAllowArchChange() const;
303 
305  void dupSetAllowVendorChange( bool yesno_r );
306  void dupSetDefaultAllowVendorChange(); // Set back to default (in zypp.conf)
307  bool dupAllowVendorChange() const;
309 
321  void addUpgradeRepo( Repository repo_r );
322 
326  bool upgradingRepos() const;
327 
331  bool upgradingRepo( Repository repo_r ) const;
332 
336  void removeUpgradeRepo( Repository repo_r );
337 
341  void removeUpgradeRepos();
343 
348  void addRequire( const Capability & capability );
349 
354  void addConflict( const Capability & capability );
355 
360  void removeRequire( const Capability & capability );
361 
366  void removeConflict( const Capability & capability );
367 
372  CapabilitySet getRequire() const;
373 
378  CapabilitySet getConflict() const;
379 
386  bool createSolverTestcase( const std::string & dumpPath = "/var/log/YaST2/solverTestcase", bool runSolver = true );
387 
402  solver::detail::ItemCapKindList isInstalledBy( const PoolItem & item );
403 
418  solver::detail::ItemCapKindList installs( const PoolItem & item );
419 
434  solver::detail::ItemCapKindList satifiedByInstalled( const PoolItem & item );
435 
436 
451  solver::detail::ItemCapKindList installedSatisfied( const PoolItem & item );
452 
453  public:
455  sat::detail::CSolver * get() const;
456 
457  private:
458  friend std::ostream & operator<<( std::ostream & str, const Resolver & obj );
460  };
462 
464  std::ostream & operator<<( std::ostream & str, const Resolver & obj );
465 
467 } // namespace zypp
469 #endif // ZYPP_RESOLVER_H
void doUpdate()
Update to newest package.
Definition: Resolver.cc:83
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:164
std::list< ProblemSolution_Ptr > ProblemSolutionList
Definition: ProblemTypes.h:43
bool resolvePool()
Resolve package dependencies:
Definition: Resolver.cc:62
sat::Transaction getTransaction()
Return the Transaction computed by the last solver run.
Definition: Resolver.cc:77
bool upgradingRepos() const
Whether there is at least one UpgradeRepo request pending.
Definition: Resolver.cc:139
void addUpgradeRepo(Repository repo_r)
Adding request to perform a dist upgrade restricted to this repository.
Definition: Resolver.cc:138
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:155
CapabilitySet getRequire() const
Get all the additional requirements set by addRequire(Capability).
Definition: Resolver.cc:149
void setAllowDowngrade(bool yesno_r)
Whether to allow one to downgrade installed solvable.
bool dupAllowVendorChange() const
void setAllowNameChange(bool yesno_r)
Whether to allow one to change name of installed solvable.
ResolverFocus
The resolver&#39;s general attitude.
Definition: ResolverFocus.h:21
void setDefaultSolveSrcPackages()
Definition: Resolver.cc:110
void removeRequire(const Capability &capability)
Remove the additional requirement set by addRequire(Capability).
Definition: Resolver.cc:146
void setCleandepsOnRemove(bool yesno_r)
Cleanup when deleting packages.
Definition: Resolver.cc:113
void dupSetDefaultAllowNameChange()
void dupSetAllowNameChange(bool yesno_r)
dup mode: allow one to change name of installed solvable
void setAllowVendorChange(bool yesno_r)
Whether to allow one to change vendor of installed solvables.
String related utilities and Regular expression matching.
zypp::RW_pointer< solver::detail::ResolverInternal > _pimpl
Definition: Resolver.h:459
void setUpdateMode(bool yesno_r)
Setting whether the solver should perform in &#39;update&#39; mode or not.
Definition: Resolver.cc:102
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Definition: SerialNumber.cc:52
void setOnlyRequires(bool yesno_r)
Setting whether required packages are installed ONLY So recommended packages, language packages and p...
Definition: Resolver.cc:95
void undo()
Definition: Resolver.cc:68
bool doUpgrade()
Do an distribution upgrade (DUP)
Definition: Resolver.cc:80
std::list< SolverQueueItem_Ptr > SolverQueueItemList
Definition: Types.h:45
friend std::ostream & operator<<(std::ostream &str, const Resolver &obj)
Definition: Resolver.cc:176
solver::detail::ItemCapKindList isInstalledBy(const PoolItem &item)
Gives information about WHO has pused an installation of an given item.
Definition: Resolver.cc:161
bool resolveQueue(solver::detail::SolverQueueItemList &queue)
Resolve package dependencies:
Definition: Resolver.cc:65
bool ignoreAlreadyRecommended() const
Definition: Resolver.cc:93
ResolverProblemList problems()
Return the dependency problems found by the last call to resolveDependencies().
Definition: Resolver.cc:71
void removeUpgradeRepo(Repository repo_r)
Remove an upgrade request for this repo.
Definition: Resolver.cc:141
solver::detail::ItemCapKindList installedSatisfied(const PoolItem &item)
Gives information about WHICH items require an already installed item.
Definition: Resolver.cc:170
bool updateMode() const
Definition: Resolver.cc:103
void setDefaultAllowArchChange()
CapabilitySet getConflict() const
Get all the additional conflicts set by addConflict(Capability).
Definition: Resolver.cc:150
void setUpgradeMode(bool yesno_r)
Setting whether the solver should perform in &#39;upgrade&#39; mode or not.
Definition: Resolver.cc:99
solver::detail::ItemCapKindList satifiedByInstalled(const PoolItem &item)
Gives information about WHICH installed items are requested by the installation of an item...
Definition: Resolver.cc:167
void setDefaultCleandepsOnRemove()
Definition: Resolver.cc:114
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition: NonCopyable.h:26
std::list< ResolverProblem_Ptr > ResolverProblemList
Definition: ProblemTypes.h:46
void setDefaultAllowNameChange()
virtual ~Resolver()
Dtor.
Definition: Resolver.cc:45
std::list< PoolItem > problematicUpdateItems() const
Unmaintained packages which does not fit to the updated system (broken dependencies) will be deleted...
Definition: Resolver.cc:152
void resetOnlyRequires()
Definition: Resolver.cc:96
ResolverFocus focus() const
Definition: Resolver.cc:87
void dupSetDefaultAllowArchChange()
bool solveSrcPackages() const
Definition: Resolver.cc:111
void setAllowArchChange(bool yesno_r)
Whether to allow one to change architecture of installed solvables.
bool forceResolve() const
Definition: Resolver.cc:90
void setDefaultAllowDowngrade()
void addConflict(const Capability &capability)
Adding additional conflict.
Definition: Resolver.cc:145
bool onlyRequires() const
Definition: Resolver.cc:97
bool allowDowngrade() const
bool cleandepsOnRemove() const
Definition: Resolver.cc:115
void setSystemVerification(bool yesno_r)
System verification mode also monitors and repairs dependencies of already installed packages...
Definition: Resolver.cc:105
void applySolutions(const ProblemSolutionList &solutions)
Apply problem solutions.
Definition: Resolver.cc:74
std::unordered_set< Capability > CapabilitySet
Definition: Capability.h:33
bool upgradeMode() const
Definition: Resolver.cc:100
void addRequire(const Capability &capability)
Adding additional requirement.
Definition: Resolver.cc:144
void setDefaultSolverFlags(bool all_r=true)
Reset all solver flags to the systems default (e.g.
Definition: Resolver.cc:53
::s_Solver CSolver
Wrapped libsolv C data type exposed as backdoor.
Definition: PoolMember.h:65
std::list< ItemCapKind > ItemCapKindList
Definition: Types.h:41
bool allowNameChange() const
void dupSetDefaultAllowDowngrade()
bool dupAllowNameChange() const
void removeConflict(const Capability &capability)
Remove the additional conflict set by addConflict(Capability).
Definition: Resolver.cc:147
Wrapper for const correct access via Smart pointer types.
Definition: PtrTypes.h:285
bool verifySystem()
Resolve package dependencies:
Definition: Resolver.cc:59
void setForceResolve(bool force)
Remove resolvables which are conflicts with others or have unfulfilled requirements.
Definition: Resolver.cc:89
void dupSetAllowDowngrade(bool yesno_r)
dup mode: allow one to downgrade installed solvable
void dupSetAllowArchChange(bool yesno_r)
dup mode: allow one to change architecture of installed solvables
void setFocus(ResolverFocus focus_r)
Define the resolver&#39;s general attitude when resolving jobs.
Definition: Resolver.cc:86
bool allowVendorChange() const
void reset()
Definition: Resolver.cc:173
bool upgradingRepo(Repository repo_r) const
Whether there is an UpgradeRepo request pending for this repo.
Definition: Resolver.cc:140
void setIgnoreAlreadyRecommended(bool yesno_r)
Ignore recommended packages that were already recommended by the installed packages.
Definition: Resolver.cc:92
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
void dupSetDefaultAllowVendorChange()
void setDefaultSystemVerification()
Definition: Resolver.cc:106
void removeUpgradeRepos()
Remove all upgrade repo requests.
Definition: Resolver.cc:142
void dupSetAllowVendorChange(bool yesno_r)
dup mode: allow one to change vendor of installed solvables
void setSolveSrcPackages(bool yesno_r)
Set whether to solve source packages build dependencies per default.
Definition: Resolver.cc:109
Resolver(const ResPool &pool)
Ctor.
Definition: Resolver.cc:36
bool systemVerification() const
Definition: Resolver.cc:107
bool dupAllowDowngrade() const
bool allowArchChange() const
bool dupAllowArchChange() const