build require libproxy
[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/solver/detail/Resolver.h"
18 #include "zypp/solver/detail/Testcase.h"
19
20 using namespace std;
21
22 ///////////////////////////////////////////////////////////////////
23 namespace zypp
24 { /////////////////////////////////////////////////////////////////
25
26   using namespace solver;
27
28   IMPL_PTR_TYPE(Resolver);
29
30   ///////////////////////////////////////////////////////////////////
31   //
32   //    METHOD NAME : Resolver::Resolver
33   //    METHOD TYPE : Ctor
34   //
35   Resolver::Resolver( const ResPool & pool )
36   : _pimpl( new Impl(pool) )
37   {}
38
39   ///////////////////////////////////////////////////////////////////
40   //
41   //    METHOD NAME : Resolver::~Resolver
42   //    METHOD TYPE : Dtor
43   //
44   Resolver::~Resolver()
45   {}
46
47   ///////////////////////////////////////////////////////////////////
48   //
49   //    Resolver interface forwarded to implementation
50   //
51   ///////////////////////////////////////////////////////////////////
52   bool Resolver::verifySystem ()
53   { return _pimpl->verifySystem(); }
54
55   bool Resolver::resolvePool ()
56   { return _pimpl->resolvePool(); }
57
58   bool Resolver::resolveQueue( solver::detail::SolverQueueItemList & queue )
59   { return _pimpl->resolveQueue(queue); }
60
61   void Resolver::undo()
62   { _pimpl->undo(); }
63
64   ResolverProblemList Resolver::problems ()
65   { return _pimpl->problems (); }
66
67   void Resolver::applySolutions( const ProblemSolutionList & solutions )
68   { _pimpl->applySolutions (solutions); }
69
70   bool Resolver::doUpgrade()
71   { return _pimpl->doUpgrade(); }
72
73   void Resolver::doUpdate()
74   { _pimpl->doUpdate(); }
75
76   void Resolver::setForceResolve( bool yesno_r )        { _pimpl->setForceResolve( yesno_r ); }
77   bool Resolver::forceResolve() const                   { return _pimpl->forceResolve(); }
78
79   void Resolver::setIgnoreAlreadyRecommended( bool yesno_r) { _pimpl->setIgnoreAlreadyRecommended( yesno_r ); }
80   bool Resolver::ignoreAlreadyRecommended() const       { return _pimpl->ignoreAlreadyRecommended(); }
81
82   void Resolver::setOnlyRequires( bool yesno_r )        { _pimpl->setOnlyRequires( yesno_r ); }
83   void Resolver::resetOnlyRequires()                    { _pimpl->setOnlyRequires( indeterminate ); }
84   bool Resolver::onlyRequires() const                   { return _pimpl->onlyRequires(); }
85
86   bool Resolver::upgradeMode() const                    { return _pimpl->isUpgradeMode(); }
87
88   void Resolver::setAllowVendorChange( bool yesno_r )   { _pimpl->setAllowVendorChange( yesno_r ); }
89   void Resolver::setDefaultAllowVendorChange()          { _pimpl->setAllowVendorChange( indeterminate ); }
90   bool Resolver::allowVendorChange() const              { return _pimpl->allowVendorChange(); }
91
92   void Resolver::setSystemVerification( bool yesno_r )  { _pimpl->setVerifyingMode( yesno_r ); }
93   void Resolver::setDefaultSystemVerification()         { _pimpl->setVerifyingMode( indeterminate ); }
94   bool Resolver::systemVerification() const             { return _pimpl->isVerifyingMode(); }
95
96   void Resolver::setSolveSrcPackages( bool yesno_r )    { _pimpl->setSolveSrcPackages( yesno_r ); }
97   void Resolver::setDefaultSolveSrcPackages()           { _pimpl->setSolveSrcPackages( indeterminate ); }
98   bool Resolver::solveSrcPackages() const               { return _pimpl->solveSrcPackages(); }
99
100   void Resolver::setCleandepsOnRemove( bool yesno_r )   { _pimpl->setCleandepsOnRemove( yesno_r ); }
101   void Resolver::setDefaultCleandepsOnRemove()          { _pimpl->setCleandepsOnRemove( indeterminate ); }
102   bool Resolver::cleandepsOnRemove() const              { return _pimpl->cleandepsOnRemove(); }
103
104   void Resolver::addUpgradeRepo( Repository repo_r )    { _pimpl->addUpgradeRepo( repo_r ); }
105   bool Resolver::upgradingRepo( Repository repo_r ) const { return _pimpl->upgradingRepo( repo_r ); }
106   void Resolver::removeUpgradeRepo( Repository repo_r ) { _pimpl->removeUpgradeRepo( repo_r ); }
107   void Resolver::removeUpgradeRepos()                   { _pimpl->removeUpgradeRepos(); }
108
109   void Resolver::addRequire( const Capability & capability )    { _pimpl->addExtraRequire( capability ); }
110   void Resolver::addConflict( const Capability & capability )   { _pimpl->addExtraConflict( capability ); }
111   void Resolver::removeRequire( const Capability & capability ) { _pimpl->removeExtraRequire( capability ); }
112   void Resolver::removeConflict( const Capability & capability ){ _pimpl->removeExtraConflict( capability ); }
113
114   CapabilitySet Resolver::getRequire() const    { return _pimpl->extraRequires(); }
115   CapabilitySet Resolver::getConflict() const   { return _pimpl->extraConflicts(); }
116
117   std::list<PoolItem> Resolver::problematicUpdateItems() const
118   { return _pimpl->problematicUpdateItems(); }
119
120   bool Resolver::createSolverTestcase( const std::string & dumpPath, bool runSolver )
121   {
122     solver::detail::Testcase testcase (dumpPath);
123     return testcase.createTestcase(*_pimpl, true, runSolver);
124   }
125
126   solver::detail::ItemCapKindList Resolver::isInstalledBy( const PoolItem & item )
127   { return _pimpl->isInstalledBy (item); }
128
129   solver::detail::ItemCapKindList Resolver::installs( const PoolItem & item )
130   { return _pimpl->installs (item); }
131
132   solver::detail::ItemCapKindList Resolver::satifiedByInstalled( const PoolItem & item )
133   { return _pimpl->satifiedByInstalled (item); }
134
135   solver::detail::ItemCapKindList Resolver::installedSatisfied( const PoolItem & item )
136   { return _pimpl->installedSatisfied (item); }
137
138   void Resolver::reset()
139   { _pimpl->reset( false ); /* Do not keep extra requires/conflicts */ }
140
141   std::ostream & operator<<( std::ostream & str, const Resolver & obj )
142   { return str << *obj._pimpl; }
143
144   /////////////////////////////////////////////////////////////////
145 } // namespace zypp
146 ///////////////////////////////////////////////////////////////////