make 'verifySystem' return bool
[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/solver/detail/ResolverContext.h"
25 #include "zypp/ProblemTypes.h"
26
27 ///////////////////////////////////////////////////////////////////
28 namespace zypp
29 { /////////////////////////////////////////////////////////////////
30
31
32
33   ///////////////////////////////////////////////////////////////////
34   //
35   //    CLASS NAME : Resolver
36   //
37   /** Resolver interface.
38   */
39   class Resolver : public base::ReferenceCounted, private base::NonCopyable
40   {
41   public:
42
43     /** Ctor */
44     Resolver( const ResPool & pool );
45     /** Dtor */
46     virtual ~Resolver();
47
48     /**
49      * Resolve package dependencies:
50      *
51      * Verify consistency of system
52      *
53      **/
54     bool verifySystem (void);
55
56     /**
57      * Establish state of 'higher level' Resolvables in Pool
58      *
59      * Must be called when dealing with non-package resolvables,
60      * like Patches, Patterns, and Products
61      *
62      **/
63     void establishPool (void);
64
65     /**
66      * Resolve package dependencies:
67      *
68      * Try to execute all pending transactions (there may be more than
69      * one!).
70      *
71      * Returns "true" on success (i.e., if there were no problems that
72      * need user interaction) and "false" if there were problems.  In
73      * the latter case, use problems() and later applySolutions()
74      * below.
75      **/
76     bool resolvePool (void);
77
78     /*
79      * Get the most recent resolver context
80      *
81      * It will be NULL if resolvePool() or establishPool() was never called.
82      * Depending on the return code of the last resolvePool() call,
83      * it _either_ points to a valid or an invalid solution.
84      */
85     solver::detail::ResolverContext_Ptr context (void) const;
86
87     /**
88      * Do an distribution upgrade
89      *
90      * This will run a full upgrade on the pool, taking all upgrade
91      * dependencies (provide/obsolete for package renames, split-
92      * provides, etc.) into account and actually removing installed
93      * packages if no upgrade exists.
94      *
95      * To be run with great caution. It basically brings your
96      * system 'back to start'.
97      * Quite helpful to get back to a 'sane state'. Quite disastrous
98      * since you'll loose all non-distribution packages
99      **/
100     void doUpgrade( UpgradeStatistics & opt_stats_r );
101
102     /**
103      * Return the dependency problems found by the last call to
104      * resolveDependencies(). If there were no problems, the returned
105      * list will be empty.
106      **/
107     ResolverProblemList problems();
108
109     /**
110      * Apply problem solutions. No more than one solution per problem
111      * can be applied.
112      **/
113     bool applySolutions( const ProblemSolutionList & solutions );
114
115   protected:
116
117   private:
118     solver::detail::Resolver_Ptr _pimpl;
119   };
120   ///////////////////////////////////////////////////////////////////
121
122   /////////////////////////////////////////////////////////////////
123 } // namespace zypp
124 ///////////////////////////////////////////////////////////////////
125 #endif // ZYPP_RESOLVER_H