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 * go through all package 'freshen' dependencies and
74 * schedule matches for installation.
76 * To be called at begin of installation and upgrade.
77 * Probably also useful after adding a new package
80 * return true if it was successful
81 * return false if not (this will only happen if other
82 * transactions are in the pool which will lead to
85 bool freshenPool (void);
88 * Resolve package dependencies:
90 * Try to execute all pending transactions (there may be more than
93 * Returns "true" on success (i.e., if there were no problems that
94 * need user interaction) and "false" if there were problems. In
95 * the latter case, use problems() and later applySolutions()
98 bool resolvePool (void);
101 * Undo solver changes done in resolvePool()
102 * Throwing away all ignored dependencies.
107 * Get the most recent resolver context
109 * It will be NULL if resolvePool() or establishPool() was never called.
110 * Depending on the return code of the last resolvePool() call,
111 * it _either_ points to a valid or an invalid solution.
113 solver::detail::ResolverContext_Ptr context (void) const;
116 * Do an distribution upgrade
118 * This will run a full upgrade on the pool, taking all upgrade
119 * dependencies (provide/obsolete for package renames, split-
120 * provides, etc.) into account and actually removing installed
121 * packages if no upgrade exists.
123 * To be run with great caution. It basically brings your
124 * system 'back to start'.
125 * Quite helpful to get back to a 'sane state'. Quite disastrous
126 * since you'll loose all non-distribution packages
128 void doUpgrade( UpgradeStatistics & opt_stats_r );
131 * Return the list of problematic update items
132 * i.e. locked ones (due to foreign vendor)
134 std::list<PoolItem_Ref> problematicUpdateItems( void ) const;
137 * Return the dependency problems found by the last call to
138 * resolveDependencies(). If there were no problems, the returned
139 * list will be empty.
141 ResolverProblemList problems();
144 * Return more solver information if an error has happened.
147 std::list<std::string> problemDescription( void ) const;
150 * Apply problem solutions. No more than one solution per problem
153 void applySolutions( const ProblemSolutionList & solutions );
155 Arch architecture() const;
156 void setArchitecture( const Arch & arch);
159 * Remove resolvables which are conflicts with others or
160 * have unfulfilled requirements.
161 * This behaviour is favourited by ZMD.
163 void setForceResolve (const bool force);
164 const bool forceResolve();
167 * transact a single ResObject
169 * Installs (install == true) or removes (install == false) all required
170 * and recommended packages(!) of \c robj
171 * (More or less a 'single step' resolver call)
173 * returns false if requirements are not all fulfillable
176 bool transactResObject( ResObject::constPtr robj, bool install = true);
179 * transact all objects of this kind
181 * Look through the pool and runs transactResObject, first for removes
183 * (More or less a 'single step' resolver call)
185 * returns false if any transactResObject() call returned false.
188 bool transactResKind( Resolvable::Kind kind );
191 * reset any transact states
193 * Look through the pool and clear transact state.
194 * It will only reset states which have an equal or
198 void transactReset( ResStatus::TransactByValue causer );
203 solver::detail::Resolver_Ptr _pimpl;
205 ///////////////////////////////////////////////////////////////////
207 /////////////////////////////////////////////////////////////////
209 ///////////////////////////////////////////////////////////////////
210 #endif // ZYPP_RESOLVER_H