- Create the cache directly from the schema (installed) file.
[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/UpgradeStatistics.h"
16 #include "zypp/solver/detail/Resolver.h"
17 #include "zypp/solver/detail/Testcase.h"
18
19 using namespace std;
20
21 ///////////////////////////////////////////////////////////////////
22 namespace zypp
23 { /////////////////////////////////////////////////////////////////
24
25   IMPL_PTR_TYPE(Resolver);
26 #if 0
27   Resolver_Ptr Resolver::_resolver = NULL;
28   Resolver_Ptr Resolver::resolver()
29   {
30     if (_resolver == NULL) {
31         _resolver = new Resolver();
32     }
33     return _resolver;
34   }
35 #endif
36   ///////////////////////////////////////////////////////////////////
37   //
38   //    METHOD NAME : Resolver::Resolver
39   //    METHOD TYPE : Ctor
40   //
41   Resolver::Resolver( const ResPool & pool )
42   {
43     _pimpl = new solver::detail::Resolver(pool);
44   }
45
46   ///////////////////////////////////////////////////////////////////
47   //
48   //    METHOD NAME : Resolver::~Resolver
49   //    METHOD TYPE : Dtor
50   //
51   Resolver::~Resolver()
52   {}
53
54   ///////////////////////////////////////////////////////////////////
55   //
56   //    Resolver interface forwarded to implementation
57   //
58   ///////////////////////////////////////////////////////////////////
59   bool Resolver::verifySystem ()
60   { return _pimpl->verifySystem(false); }
61   bool Resolver::verifySystem (bool considerNewHardware)
62   { return _pimpl->verifySystem(considerNewHardware); }
63   bool Resolver::establishPool ()
64   { return _pimpl->establishPool(); }
65   bool Resolver::freshenPool ()
66   { return _pimpl->freshenPool(); }
67   bool Resolver::resolvePool ()
68   { return _pimpl->resolvePool( false ); }// do not try all possibilities 
69   bool Resolver::resolvePool( bool tryAllPossibilities )
70   { return _pimpl->resolvePool( tryAllPossibilities ); }
71   void Resolver::undo()
72   { _pimpl->undo(); }
73   solver::detail::ResolverContext_Ptr Resolver::context (void) const
74   { return _pimpl->context(); }
75   ResolverProblemList Resolver::problems ()
76   { return _pimpl->problems (); }
77   std::list<std::string> Resolver::problemDescription( void ) const
78   { return _pimpl->problemDescription (); }    
79   void Resolver::applySolutions( const ProblemSolutionList & solutions )
80   { _pimpl->applySolutions (solutions); }      
81   void Resolver::doUpgrade( UpgradeStatistics & opt_stats_r )
82   { _pimpl->doUpgrade(opt_stats_r); }
83   Arch Resolver::architecture() const
84   { return _pimpl->architecture(); }
85   void Resolver::setArchitecture( const Arch & arch )
86   { _pimpl->setArchitecture( arch ); }
87   void Resolver::setForceResolve( const bool force )
88   { _pimpl->setForceResolve( force ); }
89   const bool Resolver::forceResolve()
90   { return _pimpl->forceResolve(); }
91     void Resolver::setPreferHighestVersion( const bool highestVersion )
92   { _pimpl->setPreferHighestVersion( highestVersion ); }
93   const bool Resolver::preferHighestVersion()
94   { return _pimpl->preferHighestVersion(); }
95   bool Resolver::transactResObject( ResObject::constPtr robj, bool install)
96   { return _pimpl->transactResObject( robj, install ); }
97   bool Resolver::transactResKind( Resolvable::Kind kind )
98   { return _pimpl->transactResKind( kind ); }
99   void Resolver::transactReset( ResStatus::TransactByValue causer )
100   { _pimpl->transactReset( causer ); }
101   std::list<PoolItem_Ref> Resolver::problematicUpdateItems( void ) const
102   { return _pimpl->problematicUpdateItems(); }
103   void Resolver::setTimeout( int seconds )
104   { _pimpl->setTimeout( seconds ); }
105   void Resolver::setMaxSolverPasses (int count)
106   { _pimpl->setMaxSolverPasses( count ); }
107   int Resolver::timeout()
108   { return _pimpl->timeout(); }
109   int Resolver::maxSolverPasses()
110   { return _pimpl->maxSolverPasses(); }
111   bool Resolver::createSolverTestcase (const std::string & dumpPath)
112   { solver::detail::Testcase testcase (dumpPath);
113     return testcase.createTestcase(*_pimpl);}          
114
115   /////////////////////////////////////////////////////////////////
116 } // namespace zypp
117 ///////////////////////////////////////////////////////////////////