remove old solver
[platform/upstream/libzypp.git] / zypp / Resolver.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/Resolver.h
10  *
11 */
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 #include "zypp/base/PtrTypes.h"
20
21 #include "zypp/ResPool.h"
22 #include "zypp/UpgradeStatistics.h"
23 #include "zypp/solver/detail/Resolver.h"
24 #include "zypp/ProblemTypes.h"
25
26 ///////////////////////////////////////////////////////////////////
27 namespace zypp
28 { /////////////////////////////////////////////////////////////////
29
30
31
32   ///////////////////////////////////////////////////////////////////
33   //
34   //    CLASS NAME : Resolver
35   //
36   /** Resolver interface.
37   */
38   class Resolver : public base::ReferenceCounted, private base::NonCopyable
39   {
40   public:
41
42     /** Ctor */
43     Resolver( const ResPool & pool );
44     /** Dtor */
45     virtual ~Resolver();
46
47     /**
48      * Resolve package dependencies:
49      *
50      * Verify consistency of system
51      *
52      **/
53     bool verifySystem ();
54
55
56     /**
57      * Resolve package dependencies:
58      *
59      * Try to execute all pending transactions (there may be more than
60      * one!).
61      * The solver pays attention to the BEST packages only in order to
62      * come to a solution. 
63      * If there has not been found a valid results all other branches
64      * (e.G. packages with older version numbers, worse architecture)
65      *  will be regarded.
66      *
67      * Returns "true" on success (i.e., if there were no problems that
68      * need user interaction) and "false" if there were problems.  In
69      * the latter case, use problems() and later applySolutions()
70      * below.
71      **/
72     bool resolvePool (void);      
73
74     /*
75      * Undo solver changes done in resolvePool()
76      * Throwing away all ignored dependencies.
77      */
78     void undo( void );
79
80     /**
81      * Do an distribution upgrade
82      *
83      * This will run a full upgrade on the pool, taking all upgrade
84      * dependencies (provide/obsolete for package renames, split-
85      * provides, etc.) into account and actually removing installed
86      * packages if no upgrade exists.
87      *
88      * To be run with great caution. It basically brings your
89      * system 'back to start'.
90      * Quite helpful to get back to a 'sane state'. Quite disastrous
91      * since you'll loose all non-distribution packages
92      **/
93     void doUpgrade( UpgradeStatistics & opt_stats_r );
94
95     /**
96      * Return the list of problematic update items
97      * i.e. locked ones (due to foreign vendor)
98      **/
99     std::list<PoolItem_Ref> problematicUpdateItems( void ) const;
100
101     /**
102      * Return the dependency problems found by the last call to
103      * resolveDependencies(). If there were no problems, the returned
104      * list will be empty.
105      **/
106     ResolverProblemList problems();
107
108       
109     /**
110      * Apply problem solutions. No more than one solution per problem
111      * can be applied.
112      **/
113     void applySolutions( const ProblemSolutionList & solutions );
114
115
116     /**      
117      * Remove resolvables which are conflicts with others or
118      * have unfulfilled requirements.
119      * This behaviour is favourited by ZMD.
120      **/
121     void setForceResolve (const bool force);
122     bool forceResolve();
123
124     /**
125      * Adding additional requirement
126      *
127      */
128     void addRequire (const Capability & capability);
129
130     /**
131      * Adding additional conflict
132      *
133      */
134     void addConflict (const Capability & capability);
135
136     /**
137      * Remove the additional requirement set by \ref addRequire(Capability).
138      *
139      */
140     void removeRequire (const Capability & capability);
141
142     /**
143      * Remove the additional conflict set by \ref addConflict(Capability).
144      *
145      */
146     void removeConflict (const Capability & capability);
147
148     /**
149      * Get all the additional requirements set by \ref addRequire(Capability).
150      *
151      */      
152     const CapabilitySet getRequire ();
153       
154     /**
155      * Get all the additional conflicts set by \ref addConflict(Capability).
156      *
157      */            
158     const CapabilitySet getConflict();
159
160     /**
161      * Generates a solver Testcase of the current state
162      *
163      * \parame dumpPath destination directory of the created directory
164      * \return true if it was successful     
165      */
166     bool createSolverTestcase (const std::string & dumpPath = "/var/log/YaST2/solverTestcase");
167
168
169   protected:
170
171   private:
172     solver::detail::Resolver_Ptr _pimpl;
173   };
174   ///////////////////////////////////////////////////////////////////
175
176   /////////////////////////////////////////////////////////////////
177 } // namespace zypp
178 ///////////////////////////////////////////////////////////////////
179 #endif // ZYPP_RESOLVER_H