cleanup in return values of doUpgrade and doUpdate
[platform/upstream/libzypp.git] / zypp / Resolver.cc
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/Resolver.cc
10  *
11 */
12 #include <iostream>
13
14 #include "zypp/Resolver.h"
15 #include "zypp/ZConfig.h"
16 #include "zypp/TriBool.h"
17 #include "zypp/UpgradeStatistics.h"
18 #include "zypp/solver/detail/Resolver.h"
19 #include "zypp/solver/detail/Testcase.h"
20
21 using namespace std;
22
23 ///////////////////////////////////////////////////////////////////
24 namespace zypp
25 { /////////////////////////////////////////////////////////////////
26
27   using namespace solver;
28     
29   IMPL_PTR_TYPE(Resolver);
30 #if 0
31   Resolver_Ptr Resolver::_resolver = NULL;
32   Resolver_Ptr Resolver::resolver()
33   {
34     if (_resolver == NULL) {
35         _resolver = new Resolver();
36     }
37     return _resolver;
38   }
39 #endif
40   ///////////////////////////////////////////////////////////////////
41   //
42   //    METHOD NAME : Resolver::Resolver
43   //    METHOD TYPE : Ctor
44   //
45   Resolver::Resolver( const ResPool & pool )
46   {
47     _pimpl = new solver::detail::Resolver(pool);
48   }
49
50   ///////////////////////////////////////////////////////////////////
51   //
52   //    METHOD NAME : Resolver::~Resolver
53   //    METHOD TYPE : Dtor
54   //
55   Resolver::~Resolver()
56   {}
57
58   ///////////////////////////////////////////////////////////////////
59   //
60   //    Resolver interface forwarded to implementation
61   //
62   ///////////////////////////////////////////////////////////////////
63   bool Resolver::verifySystem ()
64   { return _pimpl->verifySystem(); }
65   bool Resolver::resolvePool ()
66   { return _pimpl->resolvePool(); }
67   bool Resolver::resolveQueue (zypp::solver::detail::SolverQueueItemList & queue)
68   { return _pimpl->resolveQueue(queue); }    
69   void Resolver::undo()
70   { _pimpl->undo(); }
71   ResolverProblemList Resolver::problems ()
72   { return _pimpl->problems (); }
73   void Resolver::applySolutions( const ProblemSolutionList & solutions )
74   { _pimpl->applySolutions (solutions); }      
75   bool Resolver::doUpgrade( UpgradeStatistics & opt_stats_r )
76   { return _pimpl->doUpgrade(opt_stats_r); }
77   void Resolver::doUpdate()
78   { _pimpl->doUpdate(); }    
79   void Resolver::setForceResolve( const bool force )
80   { _pimpl->setForceResolve( force ); }
81   bool Resolver::forceResolve()
82   { return _pimpl->forceResolve(); }
83   void Resolver::setOnlyRequires( const bool onlyRequires )
84   { onlyRequires ? _pimpl->setOnlyRequires( true ) : _pimpl->setOnlyRequires( false ); }
85   void Resolver::resetOnlyRequires()
86   { _pimpl->setOnlyRequires( indeterminate ); }    
87   bool Resolver::onlyRequires()
88   {
89       if (_pimpl->onlyRequires() == indeterminate)
90           return ZConfig::instance().solver_onlyRequires();
91       else
92           return _pimpl->onlyRequires();
93   }
94   
95   void Resolver::addRequire (const Capability & capability)
96   { _pimpl->addExtraRequire( capability ); }
97   void Resolver::addConflict (const Capability & capability)
98   { _pimpl->addExtraConflict( capability ); }
99   void Resolver::removeRequire (const Capability & capability)
100   { _pimpl->removeExtraRequire( capability ); }
101   void Resolver::removeConflict (const Capability & capability)
102   { _pimpl->removeExtraConflict( capability ); }
103   const CapabilitySet Resolver::getRequire ()
104   { return _pimpl->extraRequires();}
105   const CapabilitySet Resolver::getConflict ()
106   { return _pimpl->extraConflicts();}      
107   std::list<PoolItem> Resolver::problematicUpdateItems( void ) const
108   { return _pimpl->problematicUpdateItems(); }
109   bool Resolver::createSolverTestcase (const std::string & dumpPath)
110   { solver::detail::Testcase testcase (dumpPath);
111     return testcase.createTestcase(*_pimpl);}
112
113
114   /////////////////////////////////////////////////////////////////
115 } // namespace zypp
116 ///////////////////////////////////////////////////////////////////