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