libzypp  15.28.6
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 
51 namespace zypp
52 {
53  namespace solver
55  {
56  namespace detail
58  {
59 
60  //using namespace std;
61 
62 //---------------------------------------------------------------------------
63 
64 
65 std::ostream & Resolver::dumpOn( std::ostream & os ) const
66 {
67  os << "<resolver>" << endl;
68  #define OUTS(t) os << " " << #t << ":\t" << t << endl;
69  OUTS( _forceResolve );
70  OUTS( _upgradeMode );
71  OUTS( _updateMode );
72  OUTS( _verifying );
73  OUTS( _onlyRequires );
74  OUTS( _solveSrcPackages );
75  OUTS( _cleandepsOnRemove );
76  OUTS( _ignoreAlreadyRecommended );
77  #undef OUT
78  return os << "<resolver/>";
79 }
80 
81 
82 //---------------------------------------------------------------------------
83 
84 Resolver::Resolver (const ResPool & pool)
85  : _pool(pool)
86  , _satResolver(NULL)
87  , _poolchanged(_pool.serial() )
88  , _forceResolve (false)
89  , _upgradeMode (false)
90  , _updateMode (false)
91  , _verifying (false)
92  , _onlyRequires ( ZConfig::instance().solver_onlyRequires() )
93  , _solveSrcPackages ( false )
94  , _cleandepsOnRemove ( ZConfig::instance().solver_cleandepsOnRemove() )
95  , _ignoreAlreadyRecommended ( true )
96 
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( setAllowDowngrade, allowDowngrade, _allowdowngrade, false )
118 ZOLV_FLAG_TRIBOOL( setAllowNameChange, allowNameChange, _allownamechange, true ) // bsc#1071466
119 ZOLV_FLAG_TRIBOOL( setAllowArchChange, allowArchChange, _allowarchchange, false )
120 ZOLV_FLAG_TRIBOOL( setAllowVendorChange, allowVendorChange, _allowvendorchange, ZConfig::instance().solver_allowVendorChange() )
121 
122 ZOLV_FLAG_TRIBOOL( dupSetAllowDowngrade, dupAllowDowngrade, _dup_allowdowngrade, ZConfig::instance().solver_dupAllowDowngrade() )
123 ZOLV_FLAG_TRIBOOL( dupSetAllowNameChange, dupAllowNameChange, _dup_allownamechange, ZConfig::instance().solver_dupAllowNameChange() )
124 ZOLV_FLAG_TRIBOOL( dupSetAllowArchChange, dupAllowArchChange, _dup_allowarchchange, ZConfig::instance().solver_dupAllowArchChange() )
125 ZOLV_FLAG_TRIBOOL( dupSetAllowVendorChange, dupAllowVendorChange, _dup_allowvendorchange, ZConfig::instance().solver_dupAllowVendorChange() )
126 
127 #undef ZOLV_FLAG_TRIBOOL
128 //---------------------------------------------------------------------------
129 
130 void Resolver::setOnlyRequires( TriBool state_r )
131 {
132  _onlyRequires = indeterminate(state_r) ? ZConfig::instance().solver_onlyRequires() : bool(state_r);
133 }
134 
136 {
137  _cleandepsOnRemove = indeterminate(state_r) ? ZConfig::instance().solver_cleandepsOnRemove() : bool(state_r);
138 }
139 
140 //---------------------------------------------------------------------------
141 
142 ResPool Resolver::pool() const
143 { return _pool; }
144 
145 void Resolver::reset( bool keepExtras )
146 {
147  _verifying = false;
148 
149  if (!keepExtras) {
150  _extra_requires.clear();
151  _extra_conflicts.clear();
152  }
153 
154  _isInstalledBy.clear();
155  _installs.clear();
156  _satifiedByInstalled.clear();
157  _installedSatisfied.clear();
158 }
159 
160 bool Resolver::doUpgrade()
161 {
162  // Setting Resolver to upgrade mode. SAT solver will do the update
163  _upgradeMode = true;
164  return resolvePool();
165 }
166 
167 void Resolver::doUpdate()
168 {
169  _updateMode = true;
170  return _satResolver->doUpdate();
171 }
172 
173 PoolItemList Resolver::problematicUpdateItems() const
174 { return _satResolver->problematicUpdateItems(); }
175 
176 void Resolver::addExtraRequire( const Capability & capability )
177 { _extra_requires.insert (capability); }
178 
179 void Resolver::removeExtraRequire( const Capability & capability )
180 { _extra_requires.erase (capability); }
181 
182 void Resolver::addExtraConflict( const Capability & capability )
183 { _extra_conflicts.insert (capability); }
184 
185 void Resolver::removeExtraConflict( const Capability & capability )
186 { _extra_conflicts.erase (capability); }
187 
188 void Resolver::removeQueueItem( SolverQueueItem_Ptr item )
189 {
190  bool found = false;
191  for (SolverQueueItemList::const_iterator iter = _added_queue_items.begin();
192  iter != _added_queue_items.end(); iter++) {
193  if (*iter == item) {
194  _added_queue_items.remove(*iter);
195  found = true;
196  break;
197  }
198  }
199  if (!found) {
200  _removed_queue_items.push_back (item);
201  _removed_queue_items.unique ();
202  }
203 }
204 
205 void Resolver::addQueueItem( SolverQueueItem_Ptr item )
206 {
207  bool found = false;
208  for (SolverQueueItemList::const_iterator iter = _removed_queue_items.begin();
209  iter != _removed_queue_items.end(); iter++) {
210  if (*iter == item) {
211  _removed_queue_items.remove(*iter);
212  found = true;
213  break;
214  }
215  }
216  if (!found) {
217  _added_queue_items.push_back (item);
218  _added_queue_items.unique ();
219  }
220 }
221 
222 void Resolver::addWeak( const PoolItem & item )
223 { _addWeak.push_back( item ); }
224 
225 //---------------------------------------------------------------------------
226 
228 {
231  :resStatus(status)
232  { }
233 
234  bool operator()( PoolItem item ) // only transacts() items go here
235  {
236  item.status().resetTransact( resStatus );// clear any solver/establish transactions
237  return true;
238  }
239 };
240 
241 
243 {
246  :resStatus(status)
247  { }
248 
249  bool operator()( PoolItem item ) // only transacts() items go here
250  {
251  item.status().setTransact( true, resStatus );
252  return true;
253  }
254 };
255 
256 
258 {
259  UndoTransact resetting (ResStatus::APPL_HIGH);
260 
261  DBG << "Resolver::verifySystem()" << endl;
262 
263  _verifying = true;
264 
265  invokeOnEach ( _pool.begin(), _pool.end(),
266  resfilter::ByTransact( ), // Resetting all transcations
267  functor::functorRef<bool,PoolItem>(resetting) );
268 
269  return resolvePool();
270 }
271 
272 
273 //----------------------------------------------------------------------------
274 // undo
275 void Resolver::undo()
276 {
277  UndoTransact info(ResStatus::APPL_LOW);
278  MIL << "*** undo ***" << endl;
279  invokeOnEach ( _pool.begin(), _pool.end(),
280  resfilter::ByTransact( ), // collect transacts from Pool to resolver queue
281  functor::functorRef<bool,PoolItem>(info) );
282  // Regard dependencies of the item weak onl
283  _addWeak.clear();
284 
285  // Additional QueueItems which has to be regarded by the solver
286  _removed_queue_items.clear();
287  _added_queue_items.clear();
288 
289  return;
290 }
291 
292 void Resolver::solverInit()
293 {
294  // Solving with libsolv
295  static bool poolDumped = false;
296  MIL << "-------------- Calling SAT Solver -------------------" << endl;
297  if ( getenv("ZYPP_FULLLOG") ) {
298  Testcase testcase("/var/log/YaST2/autoTestcase");
299  if (!poolDumped) {
300  testcase.createTestcase (*this, true, false); // dump pool
301  poolDumped = true;
302  } else {
303  testcase.createTestcase (*this, false, false); // write control file only
304  }
305  }
306 
307  _satResolver->setFixsystem ( isVerifyingMode() );
308  _satResolver->setIgnorealreadyrecommended ( ignoreAlreadyRecommended() );
309  _satResolver->setOnlyRequires ( onlyRequires() );
310  _satResolver->setAllowdowngrade (false);
311  _satResolver->setAllowarchchange (false);
312  _satResolver->setAllowvendorchange ( allowVendorChange() );
313  _satResolver->setAllowuninstall ( forceResolve() );
314  _satResolver->setUpdatesystem (false);
315  _satResolver->setNoupdateprovide (false);
316  _satResolver->setDosplitprovides (true);
317  _satResolver->setSolveSrcPackages ( solveSrcPackages() );
318  _satResolver->setCleandepsOnRemove ( cleandepsOnRemove() );
319 
320  _satResolver->setDistupgrade (_upgradeMode);
321  if (_upgradeMode) {
322  // may overwrite some settings
323  _satResolver->setDistupgrade_removeunsupported (false);
324  }
325 
326  // Resetting additional solver information
327  _isInstalledBy.clear();
328  _installs.clear();
329  _satifiedByInstalled.clear();
330  _installedSatisfied.clear();
331 }
332 
334 {
335  solverInit();
336  return _satResolver->resolvePool(_extra_requires, _extra_conflicts, _addWeak, _upgradeRepos );
337 }
338 
340 {
341  solverInit();
342 
343  // add/remove additional SolverQueueItems
344  for (SolverQueueItemList::const_iterator iter = _removed_queue_items.begin();
345  iter != _removed_queue_items.end(); iter++) {
346  for (SolverQueueItemList::const_iterator iterQueue = queue.begin(); iterQueue != queue.end(); iterQueue++) {
347  if ( (*iterQueue)->cmp(*iter) == 0) {
348  MIL << "remove from queue" << *iter;
349  queue.remove(*iterQueue);
350  break;
351  }
352  }
353  }
354 
355  for (SolverQueueItemList::const_iterator iter = _added_queue_items.begin();
356  iter != _added_queue_items.end(); iter++) {
357  bool found = false;
358  for (SolverQueueItemList::const_iterator iterQueue = queue.begin(); iterQueue != queue.end(); iterQueue++) {
359  if ( (*iterQueue)->cmp(*iter) == 0) {
360  found = true;
361  break;
362  }
363  }
364  if (!found) {
365  MIL << "add to queue" << *iter;
366  queue.push_back(*iter);
367  }
368  }
369 
370  // The application has to take care to write these solutions back to e.g. selectables in order
371  // give the user a chance for changing these decisions again.
372  _removed_queue_items.clear();
373  _added_queue_items.clear();
374 
375  return _satResolver->resolveQueue(queue, _addWeak);
376 }
377 
378 sat::Transaction Resolver::getTransaction()
379 {
380  // FIXME: That's an ugly way of pushing autoInstalled into the transaction.
381  sat::Transaction ret( sat::Transaction::loadFromPool );
382  ret.autoInstalled( _satResolver->autoInstalled() );
383  return ret;
384 }
385 
386 
387 //----------------------------------------------------------------------------
388 // Getting more information about the solve results
389 
391 {
392  MIL << "Resolver::problems()" << endl;
393  return _satResolver->problems();
394 }
395 
396 void Resolver::applySolutions( const ProblemSolutionList & solutions )
397 {
398  for ( ProblemSolution_Ptr solution : solutions )
399  {
400  if ( ! applySolution( *solution ) )
401  break;
402  }
403 }
404 
405 bool Resolver::applySolution( const ProblemSolution & solution )
406 {
407  bool ret = true;
408  DBG << "apply solution " << solution << endl;
409  for ( SolutionAction_Ptr action : solution.actions() )
410  {
411  if ( ! action->execute( *this ) )
412  {
413  WAR << "apply solution action failed: " << action << endl;
414  ret = false;
415  break;
416  }
417  }
418  return ret;
419 }
420 
421 //----------------------------------------------------------------------------
422 
423 void Resolver::collectResolverInfo()
424 {
425  if ( _satResolver
426  && _isInstalledBy.empty()
427  && _installs.empty()) {
428 
429  // generating new
430  PoolItemList itemsToInstall = _satResolver->resultItemsToInstall();
431 
432  for (PoolItemList::const_iterator instIter = itemsToInstall.begin();
433  instIter != itemsToInstall.end(); instIter++) {
434  // Requires
435  for (Capabilities::const_iterator capIt = (*instIter)->dep (Dep::REQUIRES).begin(); capIt != (*instIter)->dep (Dep::REQUIRES).end(); ++capIt)
436  {
437  sat::WhatProvides possibleProviders(*capIt);
438  for_( iter, possibleProviders.begin(), possibleProviders.end() ) {
439  PoolItem provider = ResPool::instance().find( *iter );
440 
441  // searching if this provider will already be installed
442  bool found = false;
443  bool alreadySetForInstallation = false;
444  ItemCapKindMap::const_iterator pos = _isInstalledBy.find(provider);
445  while (pos != _isInstalledBy.end()
446  && pos->first == provider
447  && !found) {
448  alreadySetForInstallation = true;
449  ItemCapKind capKind = pos->second;
450  if (capKind.item() == *instIter) found = true;
451  pos++;
452  }
453 
454  if (!found
455  && provider.status().isToBeInstalled()) {
456  if (provider.status().isBySolver()) {
457  ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::REQUIRES, !alreadySetForInstallation );
458  _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
459  } else {
460  // no initial installation cause it has been set be e.g. user
461  ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::REQUIRES, false );
462  _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
463  }
464  ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::REQUIRES, !alreadySetForInstallation );
465  _installs.insert (make_pair( *instIter, capKindisInstalledBy));
466  }
467 
468  if (provider.status().staysInstalled()) { // Is already satisfied by an item which is installed
469  ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::REQUIRES, false );
470  _satifiedByInstalled.insert (make_pair( *instIter, capKindisInstalledBy));
471 
472  ItemCapKind installedSatisfied( *instIter, *capIt, Dep::REQUIRES, false );
473  _installedSatisfied.insert (make_pair( provider, installedSatisfied));
474  }
475  }
476  }
477 
478  if (!(_satResolver->onlyRequires())) {
479  //Recommends
480  for (Capabilities::const_iterator capIt = (*instIter)->dep (Dep::RECOMMENDS).begin(); capIt != (*instIter)->dep (Dep::RECOMMENDS).end(); ++capIt)
481  {
482  sat::WhatProvides possibleProviders(*capIt);
483  for_( iter, possibleProviders.begin(), possibleProviders.end() ) {
484  PoolItem provider = ResPool::instance().find( *iter );
485 
486  // searching if this provider will already be installed
487  bool found = false;
488  bool alreadySetForInstallation = false;
489  ItemCapKindMap::const_iterator pos = _isInstalledBy.find(provider);
490  while (pos != _isInstalledBy.end()
491  && pos->first == provider
492  && !found) {
493  alreadySetForInstallation = true;
494  ItemCapKind capKind = pos->second;
495  if (capKind.item() == *instIter) found = true;
496  pos++;
497  }
498 
499  if (!found
500  && provider.status().isToBeInstalled()) {
501  if (provider.status().isBySolver()) {
502  ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::RECOMMENDS, !alreadySetForInstallation );
503  _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
504  } else {
505  // no initial installation cause it has been set be e.g. user
506  ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::RECOMMENDS, false );
507  _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
508  }
509  ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::RECOMMENDS, !alreadySetForInstallation );
510  _installs.insert (make_pair( *instIter, capKindisInstalledBy));
511  }
512 
513  if (provider.status().staysInstalled()) { // Is already satisfied by an item which is installed
514  ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::RECOMMENDS, false );
515  _satifiedByInstalled.insert (make_pair( *instIter, capKindisInstalledBy));
516 
517  ItemCapKind installedSatisfied( *instIter, *capIt, Dep::RECOMMENDS, false );
518  _installedSatisfied.insert (make_pair( provider, installedSatisfied));
519  }
520  }
521  }
522 
523  //Supplements
524  for (Capabilities::const_iterator capIt = (*instIter)->dep (Dep::SUPPLEMENTS).begin(); capIt != (*instIter)->dep (Dep::SUPPLEMENTS).end(); ++capIt)
525  {
526  sat::WhatProvides possibleProviders(*capIt);
527  for_( iter, possibleProviders.begin(), possibleProviders.end() ) {
528  PoolItem provider = ResPool::instance().find( *iter );
529  // searching if this item will already be installed
530  bool found = false;
531  bool alreadySetForInstallation = false;
532  ItemCapKindMap::const_iterator pos = _isInstalledBy.find(*instIter);
533  while (pos != _isInstalledBy.end()
534  && pos->first == *instIter
535  && !found) {
536  alreadySetForInstallation = true;
537  ItemCapKind capKind = pos->second;
538  if (capKind.item() == provider) found = true;
539  pos++;
540  }
541 
542  if (!found
543  && instIter->status().isToBeInstalled()) {
544  if (instIter->status().isBySolver()) {
545  ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::SUPPLEMENTS, !alreadySetForInstallation );
546  _isInstalledBy.insert (make_pair( *instIter, capKindisInstalledBy));
547  } else {
548  // no initial installation cause it has been set be e.g. user
549  ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::SUPPLEMENTS, false );
550  _isInstalledBy.insert (make_pair( *instIter, capKindisInstalledBy));
551  }
552  ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::SUPPLEMENTS, !alreadySetForInstallation );
553  _installs.insert (make_pair( provider, capKindisInstalledBy));
554  }
555 
556  if (instIter->status().staysInstalled()) { // Is already satisfied by an item which is installed
557  ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::SUPPLEMENTS, !alreadySetForInstallation );
558  _satifiedByInstalled.insert (make_pair( provider, capKindisInstalledBy));
559 
560  ItemCapKind installedSatisfied( provider, *capIt, Dep::SUPPLEMENTS, false );
561  _installedSatisfied.insert (make_pair( *instIter, installedSatisfied));
562  }
563  }
564  }
565  }
566  }
567  }
568 }
569 
570 
571 ItemCapKindList Resolver::isInstalledBy( const PoolItem & item )
572 {
573  ItemCapKindList ret;
574  collectResolverInfo();
575 
576  for (ItemCapKindMap::const_iterator iter = _isInstalledBy.find(item); iter != _isInstalledBy.end();) {
577  ItemCapKind info = iter->second;
578  PoolItem iterItem = iter->first;
579  if (iterItem == item) {
580  ret.push_back(info);
581  iter++;
582  } else {
583  // exit
584  iter = _isInstalledBy.end();
585  }
586  }
587  return ret;
588 }
589 
590 ItemCapKindList Resolver::installs( const PoolItem & item )
591 {
592  ItemCapKindList ret;
593  collectResolverInfo();
594 
595  for (ItemCapKindMap::const_iterator iter = _installs.find(item); iter != _installs.end();) {
596  ItemCapKind info = iter->second;
597  PoolItem iterItem = iter->first;
598  if (iterItem == item) {
599  ret.push_back(info);
600  iter++;
601  } else {
602  // exit
603  iter = _installs.end();
604  }
605  }
606  return ret;
607 }
608 
609 ItemCapKindList Resolver::satifiedByInstalled( const PoolItem & item )
610 {
611  ItemCapKindList ret;
612  collectResolverInfo();
613 
614  for (ItemCapKindMap::const_iterator iter = _satifiedByInstalled.find(item); iter != _satifiedByInstalled.end();) {
615  ItemCapKind info = iter->second;
616  PoolItem iterItem = iter->first;
617  if (iterItem == item) {
618  ret.push_back(info);
619  iter++;
620  } else {
621  // exit
622  iter = _satifiedByInstalled.end();
623  }
624  }
625  return ret;
626 }
627 
628 ItemCapKindList Resolver::installedSatisfied( const PoolItem & item )
629 {
630  ItemCapKindList ret;
631  collectResolverInfo();
632 
633  for (ItemCapKindMap::const_iterator iter = _installedSatisfied.find(item); iter != _installedSatisfied.end();) {
634  ItemCapKind info = iter->second;
635  PoolItem iterItem = iter->first;
636  if (iterItem == item) {
637  ret.push_back(info);
638  iter++;
639  } else {
640  // exit
641  iter = _installedSatisfied.end();
642  }
643  }
644  return ret;
645 }
646 
647 
649  };// namespace detail
652  };// namespace solver
655 };// namespace zypp
657 
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:155
Interface to gettext.
std::list< ProblemSolution_Ptr > ProblemSolutionList
Definition: ProblemTypes.h:43
#define MIL
Definition: Logger.h:64
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:249
static const Dep RECOMMENDS
Definition: Dep.h:47
static const Dep SUPPLEMENTS
Definition: Dep.h:50
std::list< PoolItem > problematicUpdateItems() const
Unmaintained packages which does not fit to the updated system (broken dependencies) will be deleted...
Definition: Resolver.cc:143
static ZConfig & instance()
Singleton ctor.
Definition: Resolver.cc:125
#define OUTS(t)
void setCleandepsOnRemove(bool yesno_r)
Cleanup when deleting packages.
Definition: Resolver.cc:104
UndoTransact(const ResStatus::TransactByValue &status)
Definition: Resolver.cc:230
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:473
bool solver_cleandepsOnRemove() const
Whether removing a package should also remove no longer needed requirements.
Definition: ZConfig.cc:1016
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:152
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:161
solver::detail::ItemCapKindList satifiedByInstalled(const PoolItem &item)
Gives information about WHICH installed items are requested by the installation of an item...
Definition: Resolver.cc:158
std::list< ResolverProblem_Ptr > ResolverProblemList
Definition: ProblemTypes.h:46
static Pool instance()
Singleton ctor.
Definition: Pool.h:53
virtual ~Resolver()
Dtor.
Definition: Resolver.cc:48
ResStatus::TransactByValue resStatus
Definition: Resolver.cc:229
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:65
virtual std::ostream & dumpOn(std::ostream &str) const
Overload to realize std::ostream & operator<<.
static const Dep REQUIRES
Definition: Dep.h:44
ResStatus & status() const
Returns the current status.
Definition: PoolItem.cc:204
bool operator()(PoolItem item)
Definition: Resolver.cc:234
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:421
void applySolutions(const ProblemSolutionList &solutions)
Apply problem solutions.
Definition: Resolver.cc:71
bool solver_onlyRequires() const
Solver regards required packages,patterns,...
Definition: ZConfig.cc:1005
Global ResObject pool.
Definition: ResPool.h:60
static constexpr LoadFromPoolType loadFromPool
Definition: Transaction.h:82
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:244
bool verifySystem()
Resolve package dependencies:
Definition: Resolver.cc:56
DoTransact(const ResStatus::TransactByValue &status)
Definition: Resolver.cc:245
Combining sat::Solvable and ResStatus.
Definition: PoolItem.h:50
void reset()
Definition: Resolver.cc:164
PoolItem find(const sat::Solvable &slv_r) const
Return the corresponding PoolItem.
Definition: ResPool.cc:70
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
#define DBG
Definition: Logger.h:63
Resolver(const ResPool &pool)
Ctor.
Definition: Resolver.cc:39
static ResPool instance()
Singleton ctor.
Definition: ResPool.cc:33