1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/Resolver.h
12 #ifndef ZYPP_RESOLVER_H
13 #define ZYPP_RESOLVER_H
18 #include "zypp/base/ReferenceCounted.h"
19 #include "zypp/base/PtrTypes.h"
21 #include "zypp/ResPool.h"
22 #include "zypp/UpgradeStatistics.h"
23 #include "zypp/solver/detail/Resolver.h"
24 #include "zypp/solver/detail/SolverQueueItem.h"
25 #include "zypp/ProblemTypes.h"
27 ///////////////////////////////////////////////////////////////////
29 { /////////////////////////////////////////////////////////////////
32 ///////////////////////////////////////////////////////////////////
34 // CLASS NAME : Resolver
37 * Dependency resolver interface.
39 * To resolve dependencies after making changes to the \ref ResPool (using
40 * \ref addRequire(), \ref addConflict(), \ref applySolutions(), or by making
41 * the changes directly on the \ref PoolItem status objects,
42 * call the \ref resolvePool() method.
43 * Do not use this method after \ref verifySystem(), \ref doUpdate(), or
46 class Resolver : public base::ReferenceCounted, private base::NonCopyable
51 Resolver( const ResPool & pool );
56 * Resolve package dependencies:
58 * Verify consistency of system
65 * Resolve package dependencies:
67 * Try to execute all pending transactions (there may be more than
69 * The solver collects all transactions (install/delete resolvables)
70 * from the pool, generates task, solving it and writes the
71 * results back to pool
73 * Returns "true" on success (i.e., if there were no problems that
74 * need user interaction) and "false" if there were problems. In
75 * the latter case, use problems() and later applySolutions()
78 bool resolvePool (void);
82 * Resolve package dependencies:
84 * The solver works off the given queue and writes back the solution
87 * Returns "true" on success (i.e., if there were no problems that
88 * need user interaction) and "false" if there were problems. In
89 * the latter case, use problems() and later applySolutions()
92 bool resolveQueue (solver::detail::SolverQueueItemList & queue);
95 * Undo solver changes done in resolvePool()
96 * Throwing away all ignored dependencies.
101 * Do an distribution upgrade
103 * This will run a full upgrade on the pool, taking all upgrade
104 * dependencies (provide/obsolete for package renames, split-
105 * provides, etc.) into account and actually removing installed
106 * packages if no upgrade exists AND the package dependency is
109 * To be run with great caution. It basically brings your
110 * system 'back to start'.
111 * Quite helpful to get back to a 'sane state'. Quite disastrous
112 * since you'll loose all non-distribution packages
114 bool doUpgrade( UpgradeStatistics & opt_stats_r );
117 * Update to newest package
119 * Install the newest version of your installed packages as
120 * far as possible. This means a newer package will NOT be
121 * installed if it generates dependency problems.
122 * So the user will not get an error message.
129 * Unmaintained packages which does not fit to
130 * the updated system (broken dependencies) will be
132 * Return the list of deleted items.
133 * Note : This list is valid after the call doUpgrade() only.
135 std::list<PoolItem> problematicUpdateItems( void ) const;
138 * Return the dependency problems found by the last call to
139 * resolveDependencies(). If there were no problems, the returned
140 * list will be empty.
142 ResolverProblemList problems();
146 * Apply problem solutions. No more than one solution per problem
149 void applySolutions( const ProblemSolutionList & solutions );
153 * Remove resolvables which are conflicts with others or
154 * have unfulfilled requirements.
155 * This behaviour is favourited by ZMD.
157 void setForceResolve (const bool force);
161 * Setting whether required packages are installed ONLY
162 * So recommended packages, language packages and packages which depend
163 * on hardware (modalias) will not be regarded.
165 void setOnlyRequires (const bool onlyRequires);
166 void resetOnlyRequires(); // set back to default (described in zypp.conf)
170 * Adding additional requirement
173 void addRequire (const Capability & capability);
176 * Adding additional conflict
179 void addConflict (const Capability & capability);
182 * Remove the additional requirement set by \ref addRequire(Capability).
185 void removeRequire (const Capability & capability);
188 * Remove the additional conflict set by \ref addConflict(Capability).
191 void removeConflict (const Capability & capability);
194 * Get all the additional requirements set by \ref addRequire(Capability).
197 const CapabilitySet getRequire ();
200 * Get all the additional conflicts set by \ref addConflict(Capability).
203 const CapabilitySet getConflict();
206 * Generates a solver Testcase of the current state
208 * \parame dumpPath destination directory of the created directory
209 * \return true if it was successful
211 bool createSolverTestcase (const std::string & dumpPath = "/var/log/YaST2/solverTestcase");
217 solver::detail::Resolver_Ptr _pimpl;
219 ///////////////////////////////////////////////////////////////////
221 /////////////////////////////////////////////////////////////////
223 ///////////////////////////////////////////////////////////////////
224 #endif // ZYPP_RESOLVER_H