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/ResolverContext.h"
25 #include "zypp/ProblemTypes.h"
27 ///////////////////////////////////////////////////////////////////
29 { /////////////////////////////////////////////////////////////////
33 ///////////////////////////////////////////////////////////////////
35 // CLASS NAME : Resolver
37 /** Resolver interface.
39 class Resolver : public base::ReferenceCounted, private base::NonCopyable
44 Resolver( const ResPool & pool );
49 * Resolve package dependencies:
51 * Verify consistency of system
54 bool verifySystem (void);
57 * Establish state of 'higher level' Resolvables in Pool
59 * Must be called when dealing with non-package resolvables,
60 * like Patches, Patterns, and Products
62 * Must be called with a 'plain' pool, e.g. no additonal
65 * return true if it was successful
66 * return false if not (this will only happen if other
67 * transactions are in the pool which will lead to
70 bool establishPool (void);
73 * Resolve package dependencies:
75 * Try to execute all pending transactions (there may be more than
78 * Returns "true" on success (i.e., if there were no problems that
79 * need user interaction) and "false" if there were problems. In
80 * the latter case, use problems() and later applySolutions()
83 bool resolvePool (void);
86 * Undo solver changes done in resolvePool()
87 * Throwing away all ignored dependencies.
92 * Get the most recent resolver context
94 * It will be NULL if resolvePool() or establishPool() was never called.
95 * Depending on the return code of the last resolvePool() call,
96 * it _either_ points to a valid or an invalid solution.
98 solver::detail::ResolverContext_Ptr context (void) const;
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.
108 * To be run with great caution. It basically brings your
109 * system 'back to start'.
110 * Quite helpful to get back to a 'sane state'. Quite disastrous
111 * since you'll loose all non-distribution packages
113 void doUpgrade( UpgradeStatistics & opt_stats_r );
116 * Return the dependency problems found by the last call to
117 * resolveDependencies(). If there were no problems, the returned
118 * list will be empty.
120 ResolverProblemList problems();
123 * Apply problem solutions. No more than one solution per problem
126 void applySolutions( const ProblemSolutionList & solutions );
128 Arch architecture() const;
129 void setArchitecture( const Arch & arch);
132 * Remove resolvables which are conflicts with others or
133 * have unfulfilled requirements.
134 * This behaviour is favourited by ZMD.
136 void setForceResolve (const bool force);
137 const bool forceResolve();
140 * transact a single ResObject
142 * Installs (install == true) or removes (install == false) all required
143 * and recommended packages(!) of \c robj
144 * (More or less a 'single step' resolver call)
146 * returns false if requirements are not all fulfillable
149 bool transactResObject( ResObject::constPtr robj, bool install = true);
152 * transact all objects of this kind
154 * Look through the pool and runs transactResObject, first for removes
156 * (More or less a 'single step' resolver call)
158 * returns false if any transactResObject() call returned false.
161 bool transactResKind( Resolvable::Kind kind );
166 solver::detail::Resolver_Ptr _pimpl;
168 ///////////////////////////////////////////////////////////////////
170 /////////////////////////////////////////////////////////////////
172 ///////////////////////////////////////////////////////////////////
173 #endif // ZYPP_RESOLVER_H