libzypp  17.11.2
Resolver.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* Resolver.cc
3  *
4  * Copyright (C) 2000-2002 Ximian, Inc.
5  * Copyright (C) 2005 SUSE Linux Products GmbH
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License,
9  * version 2, as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19  * 02111-1307, USA.
20  */
21 #include <boost/static_assert.hpp>
22 
23 #define ZYPP_USE_RESOLVER_INTERNALS
24 
31 
32 #include "zypp/Capabilities.h"
33 #include "zypp/ZConfig.h"
34 #include "zypp/base/Logger.h"
35 #include "zypp/base/String.h"
36 #include "zypp/base/Gettext.h"
37 #include "zypp/base/Algorithm.h"
38 #include "zypp/ResPool.h"
39 #include "zypp/ResFilters.h"
40 #include "zypp/sat/Pool.h"
41 #include "zypp/sat/Solvable.h"
42 #include "zypp/sat/Transaction.h"
43 #include "zypp/ResolverProblem.h"
44 
45 #define MAXSOLVERRUNS 5
46 
47 using std::endl;
48 using std::make_pair;
49 
50 #undef ZYPP_BASE_LOGGER_LOGGROUP
51 #define ZYPP_BASE_LOGGER_LOGGROUP "zypp::solver"
52 
54 namespace zypp
55 {
56  namespace solver
58  {
59  namespace detail
61  {
62 
63  //using namespace std;
64 
65 //---------------------------------------------------------------------------
66 
67 
68 std::ostream & Resolver::dumpOn( std::ostream & os ) const
69 {
70  os << "<resolver>" << endl;
71  #define OUTS(t) os << " " << #t << ":\t" << t << endl;
72  OUTS( _upgradeMode );
73  OUTS( _updateMode );
74  OUTS( _verifying );
75  OUTS( _onlyRequires );
76  OUTS( _solveSrcPackages );
77  OUTS( _cleandepsOnRemove );
78  OUTS( _ignoreAlreadyRecommended );
79  #undef OUT
80  return os << "<resolver/>";
81 }
82 
83 
84 //---------------------------------------------------------------------------
85 
86 Resolver::Resolver (const ResPool & pool)
87  : _pool(pool)
88  , _satResolver(NULL)
89  , _poolchanged(_pool.serial() )
90  , _upgradeMode (false)
91  , _updateMode (false)
92  , _verifying (false)
93  , _onlyRequires ( ZConfig::instance().solver_onlyRequires() )
94  , _solveSrcPackages ( false )
95  , _cleandepsOnRemove ( ZConfig::instance().solver_cleandepsOnRemove() )
96  , _ignoreAlreadyRecommended ( true )
97 {
98  sat::Pool satPool( sat::Pool::instance() );
99  _satResolver = new SATResolver(_pool, satPool.get());
100 }
101 
102 
104 {
105  delete _satResolver;
106 }
107 
108 //---------------------------------------------------------------------------
109 // forward flags too SATResolver
110 #define ZOLV_FLAG_TRIBOOL( ZSETTER, ZGETTER, ZVARNAME, ZVARDEFAULT ) \
111  void Resolver::ZSETTER( TriBool state_r ) \
112  { _satResolver->ZVARNAME = indeterminate(state_r) ? ZVARDEFAULT : bool(state_r); } \
113  bool Resolver::ZGETTER() const \
114  { return _satResolver->ZVARNAME; } \
115 
116 // NOTE: ZVARDEFAULT must be in sync with SATResolver ctor
117 ZOLV_FLAG_TRIBOOL( setForceResolve, forceResolve, _allowuninstall, false )
118 
119 ZOLV_FLAG_TRIBOOL( setAllowDowngrade, allowDowngrade, _allowdowngrade, false )
120 ZOLV_FLAG_TRIBOOL( setAllowNameChange, allowNameChange, _allownamechange, true ) // bsc#1071466
121 ZOLV_FLAG_TRIBOOL( setAllowArchChange, allowArchChange, _allowarchchange, false )
122 ZOLV_FLAG_TRIBOOL( setAllowVendorChange, allowVendorChange, _allowvendorchange, ZConfig::instance().solver_allowVendorChange() )
123 
124 ZOLV_FLAG_TRIBOOL( dupSetAllowDowngrade, dupAllowDowngrade, _dup_allowdowngrade, ZConfig::instance().solver_dupAllowDowngrade() )
125 ZOLV_FLAG_TRIBOOL( dupSetAllowNameChange, dupAllowNameChange, _dup_allownamechange, ZConfig::instance().solver_dupAllowNameChange() )
126 ZOLV_FLAG_TRIBOOL( dupSetAllowArchChange, dupAllowArchChange, _dup_allowarchchange, ZConfig::instance().solver_dupAllowArchChange() )
127 ZOLV_FLAG_TRIBOOL( dupSetAllowVendorChange, dupAllowVendorChange, _dup_allowvendorchange, ZConfig::instance().solver_dupAllowVendorChange() )
128 
129 #undef ZOLV_FLAG_TRIBOOL
130 //---------------------------------------------------------------------------
131 
132 void Resolver::setOnlyRequires( TriBool state_r )
133 {
134  _onlyRequires = indeterminate(state_r) ? ZConfig::instance().solver_onlyRequires() : bool(state_r);
135 }
136 
138 {
139  _cleandepsOnRemove = indeterminate(state_r) ? ZConfig::instance().solver_cleandepsOnRemove() : bool(state_r);
140 }
141 
142 //---------------------------------------------------------------------------
143 
144 ResPool Resolver::pool() const
145 { return _pool; }
146 
147 void Resolver::reset( bool keepExtras )
148 {
149  _verifying = false;
150 
151  if (!keepExtras) {
152  _extra_requires.clear();
153  _extra_conflicts.clear();
154  }
155 
156  _isInstalledBy.clear();
157  _installs.clear();
158  _satifiedByInstalled.clear();
159  _installedSatisfied.clear();
160 }
161 
162 bool Resolver::doUpgrade()
163 {
164  // Setting Resolver to upgrade mode. SAT solver will do the update
165  _upgradeMode = true;
166  return resolvePool();
167 }
168 
169 void Resolver::doUpdate()
170 {
171  _updateMode = true;
172  return _satResolver->doUpdate();
173 }
174 
175 PoolItemList Resolver::problematicUpdateItems() const
176 { return _satResolver->problematicUpdateItems(); }
177 
178 void Resolver::addExtraRequire( const Capability & capability )
179 { _extra_requires.insert (capability); }
180 
181 void Resolver::removeExtraRequire( const Capability & capability )
182 { _extra_requires.erase (capability); }
183 
184 void Resolver::addExtraConflict( const Capability & capability )
185 { _extra_conflicts.insert (capability); }
186 
187 void Resolver::removeExtraConflict( const Capability & capability )
188 { _extra_conflicts.erase (capability); }
189 
190 void Resolver::removeQueueItem( SolverQueueItem_Ptr item )
191 {
192  bool found = false;
193  for (SolverQueueItemList::const_iterator iter = _added_queue_items.begin();
194  iter != _added_queue_items.end(); iter++) {
195  if (*iter == item) {
196  _added_queue_items.remove(*iter);
197  found = true;
198  break;
199  }
200  }
201  if (!found) {
202  _removed_queue_items.push_back (item);
203  _removed_queue_items.unique ();
204  }
205 }
206 
207 void Resolver::addQueueItem( SolverQueueItem_Ptr item )
208 {
209  bool found = false;
210  for (SolverQueueItemList::const_iterator iter = _removed_queue_items.begin();
211  iter != _removed_queue_items.end(); iter++) {
212  if (*iter == item) {
213  _removed_queue_items.remove(*iter);
214  found = true;
215  break;
216  }
217  }
218  if (!found) {
219  _added_queue_items.push_back (item);
220  _added_queue_items.unique ();
221  }
222 }
223 
224 void Resolver::addWeak( const PoolItem & item )
225 { _addWeak.push_back( item ); }
226 
227 //---------------------------------------------------------------------------
228 
230 {
233  :resStatus(status)
234  { }
235 
236  bool operator()( PoolItem item ) // only transacts() items go here
237  {
238  item.status().resetTransact( resStatus );// clear any solver/establish transactions
239  return true;
240  }
241 };
242 
243 
245 {
248  :resStatus(status)
249  { }
250 
251  bool operator()( PoolItem item ) // only transacts() items go here
252  {
253  item.status().setTransact( true, resStatus );
254  return true;
255  }
256 };
257 
258 
260 {
261  UndoTransact resetting (ResStatus::APPL_HIGH);
262 
263  DBG << "Resolver::verifySystem()" << endl;
264 
265  _verifying = true;
266 
267  invokeOnEach ( _pool.begin(), _pool.end(),
268  resfilter::ByTransact( ), // Resetting all transcations
269  functor::functorRef<bool,PoolItem>(resetting) );
270 
271  return resolvePool();
272 }
273 
274 
275 //----------------------------------------------------------------------------
276 // undo
277 void Resolver::undo()
278 {
279  UndoTransact info(ResStatus::APPL_LOW);
280  MIL << "*** undo ***" << endl;
281  invokeOnEach ( _pool.begin(), _pool.end(),
282  resfilter::ByTransact( ), // collect transacts from Pool to resolver queue
283  functor::functorRef<bool,PoolItem>(info) );
284  // Regard dependencies of the item weak onl
285  _addWeak.clear();
286 
287  // Additional QueueItems which has to be regarded by the solver
288  _removed_queue_items.clear();
289  _added_queue_items.clear();
290 
291  return;
292 }
293 
294 void Resolver::solverInit()
295 {
296  // Solving with libsolv
297  static bool poolDumped = false;
298  MIL << "-------------- Calling SAT Solver -------------------" << endl;
299  if ( getenv("ZYPP_FULLLOG") ) {
300  Testcase testcase("/var/log/YaST2/autoTestcase");
301  if (!poolDumped) {
302  testcase.createTestcase (*this, true, false); // dump pool
303  poolDumped = true;
304  } else {
305  testcase.createTestcase (*this, false, false); // write control file only
306  }
307  }
308 
309  _satResolver->setFixsystem ( isVerifyingMode() );
310  _satResolver->setIgnorealreadyrecommended ( ignoreAlreadyRecommended() );
311  _satResolver->setOnlyRequires ( onlyRequires() );
312  _satResolver->setUpdatesystem (_updateMode);
313  _satResolver->setSolveSrcPackages ( solveSrcPackages() );
314  _satResolver->setCleandepsOnRemove ( cleandepsOnRemove() );
315 
316  _satResolver->setDistupgrade (_upgradeMode);
317  if (_upgradeMode) {
318  // may overwrite some settings
319  _satResolver->setDistupgrade_removeunsupported (false);
320  }
321 
322  // Resetting additional solver information
323  _isInstalledBy.clear();
324  _installs.clear();
325  _satifiedByInstalled.clear();
326  _installedSatisfied.clear();
327 }
328 
330 {
331  solverInit();
332  return _satResolver->resolvePool(_extra_requires, _extra_conflicts, _addWeak, _upgradeRepos );
333 }
334 
336 {
337  solverInit();
338 
339  // add/remove additional SolverQueueItems
340  for (SolverQueueItemList::const_iterator iter = _removed_queue_items.begin();
341  iter != _removed_queue_items.end(); iter++) {
342  for (SolverQueueItemList::const_iterator iterQueue = queue.begin(); iterQueue != queue.end(); iterQueue++) {
343  if ( (*iterQueue)->cmp(*iter) == 0) {
344  MIL << "remove from queue" << *iter;
345  queue.remove(*iterQueue);
346  break;
347  }
348  }
349  }
350 
351  for (SolverQueueItemList::const_iterator iter = _added_queue_items.begin();
352  iter != _added_queue_items.end(); iter++) {
353  bool found = false;
354  for (SolverQueueItemList::const_iterator iterQueue = queue.begin(); iterQueue != queue.end(); iterQueue++) {
355  if ( (*iterQueue)->cmp(*iter) == 0) {
356  found = true;
357  break;
358  }
359  }
360  if (!found) {
361  MIL << "add to queue" << *iter;
362  queue.push_back(*iter);
363  }
364  }
365 
366  // The application has to take care to write these solutions back to e.g. selectables in order
367  // give the user a chance for changing these decisions again.
368  _removed_queue_items.clear();
369  _added_queue_items.clear();
370 
371  return _satResolver->resolveQueue(queue, _addWeak);
372 }
373 
374 sat::Transaction Resolver::getTransaction()
375 {
376  // FIXME: That's an ugly way of pushing autoInstalled into the transaction.
377  sat::Transaction ret( sat::Transaction::loadFromPool );
378  ret.autoInstalled( _satResolver->autoInstalled() );
379  return ret;
380 }
381 
382 
383 //----------------------------------------------------------------------------
384 // Getting more information about the solve results
385 
387 {
388  MIL << "Resolver::problems()" << endl;
389  return _satResolver->problems();
390 }
391 
392 void Resolver::applySolutions( const ProblemSolutionList & solutions )
393 {
394  for ( ProblemSolution_Ptr solution : solutions )
395  {
396  if ( ! applySolution( *solution ) )
397  break;
398  }
399 }
400 
401 bool Resolver::applySolution( const ProblemSolution & solution )
402 {
403  bool ret = true;
404  DBG << "apply solution " << solution << endl;
405  for ( SolutionAction_Ptr action : solution.actions() )
406  {
407  if ( ! action->execute( *this ) )
408  {
409  WAR << "apply solution action failed: " << action << endl;
410  ret = false;
411  break;
412  }
413  }
414  return ret;
415 }
416 
417 //----------------------------------------------------------------------------
418 
419 void Resolver::collectResolverInfo()
420 {
421  if ( _satResolver
422  && _isInstalledBy.empty()
423  && _installs.empty()) {
424 
425  // generating new
426  PoolItemList itemsToInstall = _satResolver->resultItemsToInstall();
427 
428  for (PoolItemList::const_iterator instIter = itemsToInstall.begin();
429  instIter != itemsToInstall.end(); instIter++) {
430  // Requires
431  for (Capabilities::const_iterator capIt = (*instIter)->dep (Dep::REQUIRES).begin(); capIt != (*instIter)->dep (Dep::REQUIRES).end(); ++capIt)
432  {
433  sat::WhatProvides possibleProviders(*capIt);
434  for_( iter, possibleProviders.begin(), possibleProviders.end() ) {
435  PoolItem provider = ResPool::instance().find( *iter );
436 
437  // searching if this provider will already be installed
438  bool found = false;
439  bool alreadySetForInstallation = false;
440  ItemCapKindMap::const_iterator pos = _isInstalledBy.find(provider);
441  while (pos != _isInstalledBy.end()
442  && pos->first == provider
443  && !found) {
444  alreadySetForInstallation = true;
445  ItemCapKind capKind = pos->second;
446  if (capKind.item() == *instIter) found = true;
447  pos++;
448  }
449 
450  if (!found
451  && provider.status().isToBeInstalled()) {
452  if (provider.status().isBySolver()) {
453  ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::REQUIRES, !alreadySetForInstallation );
454  _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
455  } else {
456  // no initial installation cause it has been set be e.g. user
457  ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::REQUIRES, false );
458  _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
459  }
460  ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::REQUIRES, !alreadySetForInstallation );
461  _installs.insert (make_pair( *instIter, capKindisInstalledBy));
462  }
463 
464  if (provider.status().staysInstalled()) { // Is already satisfied by an item which is installed
465  ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::REQUIRES, false );
466  _satifiedByInstalled.insert (make_pair( *instIter, capKindisInstalledBy));
467 
468  ItemCapKind installedSatisfied( *instIter, *capIt, Dep::REQUIRES, false );
469  _installedSatisfied.insert (make_pair( provider, installedSatisfied));
470  }
471  }
472  }
473 
474  if (!(_satResolver->onlyRequires())) {
475  //Recommends
476  for (Capabilities::const_iterator capIt = (*instIter)->dep (Dep::RECOMMENDS).begin(); capIt != (*instIter)->dep (Dep::RECOMMENDS).end(); ++capIt)
477  {
478  sat::WhatProvides possibleProviders(*capIt);
479  for_( iter, possibleProviders.begin(), possibleProviders.end() ) {
480  PoolItem provider = ResPool::instance().find( *iter );
481 
482  // searching if this provider will already be installed
483  bool found = false;
484  bool alreadySetForInstallation = false;
485  ItemCapKindMap::const_iterator pos = _isInstalledBy.find(provider);
486  while (pos != _isInstalledBy.end()
487  && pos->first == provider
488  && !found) {
489  alreadySetForInstallation = true;
490  ItemCapKind capKind = pos->second;
491  if (capKind.item() == *instIter) found = true;
492  pos++;
493  }
494 
495  if (!found
496  && provider.status().isToBeInstalled()) {
497  if (provider.status().isBySolver()) {
498  ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::RECOMMENDS, !alreadySetForInstallation );
499  _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
500  } else {
501  // no initial installation cause it has been set be e.g. user
502  ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::RECOMMENDS, false );
503  _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
504  }
505  ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::RECOMMENDS, !alreadySetForInstallation );
506  _installs.insert (make_pair( *instIter, capKindisInstalledBy));
507  }
508 
509  if (provider.status().staysInstalled()) { // Is already satisfied by an item which is installed
510  ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::RECOMMENDS, false );
511  _satifiedByInstalled.insert (make_pair( *instIter, capKindisInstalledBy));
512 
513  ItemCapKind installedSatisfied( *instIter, *capIt, Dep::RECOMMENDS, false );
514  _installedSatisfied.insert (make_pair( provider, installedSatisfied));
515  }
516  }
517  }
518 
519  //Supplements
520  for (Capabilities::const_iterator capIt = (*instIter)->dep (Dep::SUPPLEMENTS).begin(); capIt != (*instIter)->dep (Dep::SUPPLEMENTS).end(); ++capIt)
521  {
522  sat::WhatProvides possibleProviders(*capIt);
523  for_( iter, possibleProviders.begin(), possibleProviders.end() ) {
524  PoolItem provider = ResPool::instance().find( *iter );
525  // searching if this item will already be installed
526  bool found = false;
527  bool alreadySetForInstallation = false;
528  ItemCapKindMap::const_iterator pos = _isInstalledBy.find(*instIter);
529  while (pos != _isInstalledBy.end()
530  && pos->first == *instIter
531  && !found) {
532  alreadySetForInstallation = true;
533  ItemCapKind capKind = pos->second;
534  if (capKind.item() == provider) found = true;
535  pos++;
536  }
537 
538  if (!found
539  && instIter->status().isToBeInstalled()) {
540  if (instIter->status().isBySolver()) {
541  ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::SUPPLEMENTS, !alreadySetForInstallation );
542  _isInstalledBy.insert (make_pair( *instIter, capKindisInstalledBy));
543  } else {
544  // no initial installation cause it has been set be e.g. user
545  ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::SUPPLEMENTS, false );
546  _isInstalledBy.insert (make_pair( *instIter, capKindisInstalledBy));
547  }
548  ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::SUPPLEMENTS, !alreadySetForInstallation );
549  _installs.insert (make_pair( provider, capKindisInstalledBy));
550  }
551 
552  if (instIter->status().staysInstalled()) { // Is already satisfied by an item which is installed
553  ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::SUPPLEMENTS, !alreadySetForInstallation );
554  _satifiedByInstalled.insert (make_pair( provider, capKindisInstalledBy));
555 
556  ItemCapKind installedSatisfied( provider, *capIt, Dep::SUPPLEMENTS, false );
557  _installedSatisfied.insert (make_pair( *instIter, installedSatisfied));
558  }
559  }
560  }
561  }
562  }
563  }
564 }
565 
566 
567 ItemCapKindList Resolver::isInstalledBy( const PoolItem & item )
568 {
569  ItemCapKindList ret;
570  collectResolverInfo();
571 
572  for (ItemCapKindMap::const_iterator iter = _isInstalledBy.find(item); iter != _isInstalledBy.end();) {
573  ItemCapKind info = iter->second;
574  PoolItem iterItem = iter->first;
575  if (iterItem == item) {
576  ret.push_back(info);
577  iter++;
578  } else {
579  // exit
580  iter = _isInstalledBy.end();
581  }
582  }
583  return ret;
584 }
585 
586 ItemCapKindList Resolver::installs( const PoolItem & item )
587 {
588  ItemCapKindList ret;
589  collectResolverInfo();
590 
591  for (ItemCapKindMap::const_iterator iter = _installs.find(item); iter != _installs.end();) {
592  ItemCapKind info = iter->second;
593  PoolItem iterItem = iter->first;
594  if (iterItem == item) {
595  ret.push_back(info);
596  iter++;
597  } else {
598  // exit
599  iter = _installs.end();
600  }
601  }
602  return ret;
603 }
604 
605 ItemCapKindList Resolver::satifiedByInstalled( const PoolItem & item )
606 {
607  ItemCapKindList ret;
608  collectResolverInfo();
609 
610  for (ItemCapKindMap::const_iterator iter = _satifiedByInstalled.find(item); iter != _satifiedByInstalled.end();) {
611  ItemCapKind info = iter->second;
612  PoolItem iterItem = iter->first;
613  if (iterItem == item) {
614  ret.push_back(info);
615  iter++;
616  } else {
617  // exit
618  iter = _satifiedByInstalled.end();
619  }
620  }
621  return ret;
622 }
623 
624 ItemCapKindList Resolver::installedSatisfied( const PoolItem & item )
625 {
626  ItemCapKindList ret;
627  collectResolverInfo();
628 
629  for (ItemCapKindMap::const_iterator iter = _installedSatisfied.find(item); iter != _installedSatisfied.end();) {
630  ItemCapKind info = iter->second;
631  PoolItem iterItem = iter->first;
632  if (iterItem == item) {
633  ret.push_back(info);
634  iter++;
635  } else {
636  // exit
637  iter = _installedSatisfied.end();
638  }
639  }
640  return ret;
641 }
642 
643 
645  };// namespace detail
648  };// namespace solver
651 };// namespace zypp
653 
void doUpdate()
Update to newest package.
Definition: Resolver.cc:80
solver::detail::ItemCapKindList installs(const PoolItem &item)
Gives information about WHICH additional items will be installed due the installation of an item...
Definition: Resolver.cc:158
Interface to gettext.
std::list< ProblemSolution_Ptr > ProblemSolutionList
Definition: ProblemTypes.h:43
#define MIL
Definition: Logger.h:79
bool resolvePool()
Resolve package dependencies:
Definition: Resolver.cc:59
sat::Transaction getTransaction()
Return the Transaction computed by the last solver run.
Definition: Resolver.cc:74
bool operator()(PoolItem item)
Definition: Resolver.cc:251
static const Dep RECOMMENDS
Definition: Dep.h:47
static const Dep SUPPLEMENTS
Definition: Dep.h:50
static ZConfig & instance()
Singleton ctor.
Definition: Resolver.cc:127
#define OUTS(t)
virtual std::ostream & dumpOn(std::ostream &str) const
Overload to realize std::ostream & operator<<.
PoolItem find(const sat::Solvable &slv_r) const
Return the corresponding PoolItem.
Definition: ResPool.cc:70
void setCleandepsOnRemove(bool yesno_r)
Cleanup when deleting packages.
Definition: Resolver.cc:107
ResStatus & status() const
Returns the current status.
Definition: PoolItem.cc:204
UndoTransact(const ResStatus::TransactByValue &status)
Definition: Resolver.cc:232
void setOnlyRequires(bool yesno_r)
Setting whether required packages are installed ONLY So recommended packages, language packages and p...
Definition: Resolver.cc:89
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:27
void undo()
Definition: Resolver.cc:65
bool doUpgrade()
Do an distribution upgrade (DUP)
Definition: Resolver.cc:77
bool resetTransact(TransactByValue causer_r)
Not the same as setTransact( false ).
Definition: ResStatus.h:476
std::list< SolverQueueItem_Ptr > SolverQueueItemList
Definition: Types.h:45
solver::detail::ItemCapKindList isInstalledBy(const PoolItem &item)
Gives information about WHO has pused an installation of an given item.
Definition: Resolver.cc:155
bool resolveQueue(solver::detail::SolverQueueItemList &queue)
Resolve package dependencies:
Definition: Resolver.cc:62
ResolverProblemList problems()
Return the dependency problems found by the last call to resolveDependencies().
Definition: Resolver.cc:68
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Definition: String.h:30
solver::detail::ItemCapKindList installedSatisfied(const PoolItem &item)
Gives information about WHICH items require an already installed item.
Definition: Resolver.cc:164
solver::detail::ItemCapKindList satifiedByInstalled(const PoolItem &item)
Gives information about WHICH installed items are requested by the installation of an item...
Definition: Resolver.cc:161
std::list< ResolverProblem_Ptr > ResolverProblemList
Definition: ProblemTypes.h:46
static Pool instance()
Singleton ctor.
Definition: Pool.h:55
virtual ~Resolver()
Dtor.
Definition: Resolver.cc:48
std::list< PoolItem > problematicUpdateItems() const
Unmaintained packages which does not fit to the updated system (broken dependencies) will be deleted...
Definition: Resolver.cc:146
ResStatus::TransactByValue resStatus
Definition: Resolver.cc:231
std::unary_function< PoolItem, bool > PoolItemFilterFunctor
Definition: ResFilters.h:285
Interim helper class to collect global options and settings.
Definition: ZConfig.h:59
#define WAR
Definition: Logger.h:80
static const Dep REQUIRES
Definition: Dep.h:44
bool operator()(PoolItem item)
Definition: Resolver.cc:236
Select PoolItem by transact.
Definition: ResFilters.h:306
bool setTransact(bool toTansact_r, TransactByValue causer_r)
Toggle between TRANSACT and KEEP_STATE.
Definition: ResStatus.h:424
void applySolutions(const ProblemSolutionList &solutions)
Apply problem solutions.
Definition: Resolver.cc:71
bool solver_onlyRequires() const
Solver regards required packages,patterns,...
Definition: ZConfig.cc:1071
Global ResObject pool.
Definition: ResPool.h:60
static constexpr LoadFromPoolType loadFromPool
Definition: Transaction.h:82
bool solver_cleandepsOnRemove() const
Whether removing a package should also remove no longer needed requirements.
Definition: ZConfig.cc:1082
std::list< ItemCapKind > ItemCapKindList
Definition: Types.h:41
ZOLV_FLAG_TRIBOOL(setAllowNameChange, allowNameChange, _allownamechange, true) ZOLV_FLAG_TRIBOOL(setAllowVendorChange
ResStatus::TransactByValue resStatus
Definition: Resolver.cc:246
bool verifySystem()
Resolve package dependencies:
Definition: Resolver.cc:56
DoTransact(const ResStatus::TransactByValue &status)
Definition: Resolver.cc:247
Combining sat::Solvable and ResStatus.
Definition: PoolItem.h:50
void reset()
Definition: Resolver.cc:167
int invokeOnEach(TIterator begin_r, TIterator end_r, TFilter filter_r, TFunction fnc_r)
Iterate through [begin_r,end_r) and invoke fnc_r on each item that passes filter_r.
Definition: Algorithm.h:30
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
#define DBG
Definition: Logger.h:78
Resolver(const ResPool &pool)
Ctor.
Definition: Resolver.cc:39
static ResPool instance()
Singleton ctor.
Definition: ResPool.cc:33