libzypp  17.23.8
SATResolver.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* SATResolver.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 the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19  * 02111-1307, USA.
20  */
21 extern "C"
22 {
23 #include <solv/repo_solv.h>
24 #include <solv/poolarch.h>
25 #include <solv/evr.h>
26 #include <solv/poolvendor.h>
27 #include <solv/policy.h>
28 #include <solv/bitmap.h>
29 #include <solv/queue.h>
30 }
31 
32 #define ZYPP_USE_RESOLVER_INTERNALS
33 
34 #include <zypp/base/LogTools.h>
35 #include <zypp/base/Gettext.h>
36 #include <zypp/base/Algorithm.h>
37 
38 #include <zypp/ZConfig.h>
39 #include <zypp/Product.h>
40 #include <zypp/AutoDispose.h>
41 #include <zypp/sat/WhatProvides.h>
42 #include <zypp/sat/WhatObsoletes.h>
44 
47 
55 
56 using std::endl;
57 
58 #define XDEBUG(x) do { if (base::logger::isExcessive()) XXX << x << std::endl;} while (0)
59 
60 #undef ZYPP_BASE_LOGGER_LOGGROUP
61 #define ZYPP_BASE_LOGGER_LOGGROUP "zypp::solver"
62 
64 namespace zypp
65 {
66  namespace solver
68  {
69  namespace detail
71  {
72 
74  namespace
75  {
76  inline void solverSetFocus( sat::detail::CSolver & satSolver_r, const ResolverFocus & focus_r )
77  {
78  switch ( focus_r )
79  {
80  case ResolverFocus::Default: // fallthrough to Job
81  case ResolverFocus::Job:
82  solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_INSTALLED, 0 );
83  solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_BEST, 0 );
84  break;
86  solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_INSTALLED, 1 );
87  solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_BEST, 0 );
88  break;
90  solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_INSTALLED, 0 );
91  solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_BEST, 1 );
92  break;
93  }
94  }
95 
99  inline sat::Queue collectPseudoInstalled( const ResPool & pool_r )
100  {
101  sat::Queue ret;
102  for ( const PoolItem & pi : pool_r )
103  if ( traits::isPseudoInstalled( pi.kind() ) ) ret.push( pi.id() );
104  return ret;
105  }
106 
110  inline void solverCopyBackWeak( sat::detail::CSolver & satSolver_r, PoolItemList & orphanedItems_r )
111  {
112  // NOTE: assert all items weak stati are reset (resetWeak was called)
113  {
114  sat::Queue recommendations;
115  sat::Queue suggestions;
116  ::solver_get_recommendations( &satSolver_r, recommendations, suggestions, 0 );
117  for ( sat::Queue::size_type i = 0; i < recommendations.size(); ++i )
118  PoolItem(sat::Solvable(recommendations[i])).status().setRecommended( true );
119  for ( sat::Queue::size_type i = 0; i < suggestions.size(); ++i )
120  PoolItem(sat::Solvable(suggestions[i])).status().setSuggested( true );
121  }
122  {
123  orphanedItems_r.clear(); // cached on the fly
124  sat::Queue orphaned;
125  ::solver_get_orphaned( &satSolver_r, orphaned );
126  for ( sat::Queue::size_type i = 0; i < orphaned.size(); ++i )
127  {
128  PoolItem pi { sat::Solvable(orphaned[i]) };
129  pi.status().setOrphaned( true );
130  orphanedItems_r.push_back( pi );
131  }
132  }
133  {
134  sat::Queue unneeded;
135  ::solver_get_unneeded( &satSolver_r, unneeded, 1 );
136  for ( sat::Queue::size_type i = 0; i < unneeded.size(); ++i )
137  PoolItem(sat::Solvable(unneeded[i])).status().setUnneeded( true );
138  }
139  }
140 
142  inline void solverCopyBackValidate( sat::detail::CSolver & satSolver_r, const ResPool & pool_r )
143  {
144  sat::Queue pseudoItems { collectPseudoInstalled( pool_r ) };
145  if ( ! pseudoItems.empty() )
146  {
147  sat::Queue pseudoFlags;
148  ::solver_trivial_installable( &satSolver_r, pseudoItems, pseudoFlags );
149 
150  for ( sat::Queue::size_type i = 0; i < pseudoItems.size(); ++i )
151  {
152  PoolItem pi { sat::Solvable(pseudoItems[i]) };
153  switch ( pseudoFlags[i] )
154  {
155  case 0: pi.status().setBroken(); break;
156  case 1: pi.status().setSatisfied(); break;
157  case -1: pi.status().setNonRelevant(); break;
158  default: pi.status().setUndetermined(); break;
159  }
160  }
161  }
162  }
163 
164  } //namespace
166 
167 
168 
169 IMPL_PTR_TYPE(SATResolver);
170 
171 #define MAYBE_CLEANDEPS (cleandepsOnRemove()?SOLVER_CLEANDEPS:0)
172 
173 //---------------------------------------------------------------------------
174 // Callbacks for SAT policies
175 //---------------------------------------------------------------------------
176 
177 int vendorCheck( sat::detail::CPool *pool, Solvable *solvable1, Solvable *solvable2 )
178 {
179  return VendorAttr::instance().equivalent( IdString(solvable1->vendor),
180  IdString(solvable2->vendor) ) ? 0 : 1;
181 }
182 
187 void establish( sat::Queue & pseudoItems_r, sat::Queue & pseudoFlags_r )
188 {
189  pseudoItems_r = collectPseudoInstalled( ResPool::instance() );
190  if ( ! pseudoItems_r.empty() )
191  {
192  MIL << "Establish..." << endl;
194  ::pool_set_custom_vendorcheck( cPool, &vendorCheck );
195 
196  sat::Queue jobQueue;
197  // Add rules for parallel installable resolvables with different versions
198  for ( const sat::Solvable & solv : sat::Pool::instance().multiversion() )
199  {
200  jobQueue.push( SOLVER_NOOBSOLETES | SOLVER_SOLVABLE );
201  jobQueue.push( solv.id() );
202  }
203 
204  AutoDispose<sat::detail::CSolver*> cSolver { ::solver_create( cPool ), ::solver_free };
206  if ( ::solver_solve( cSolver, jobQueue ) != 0 )
207  INT << "How can establish fail?" << endl;
208 
209  ::solver_trivial_installable( cSolver, pseudoItems_r, pseudoFlags_r );
210 
211  for ( sat::Queue::size_type i = 0; i < pseudoItems_r.size(); ++i )
212  {
213  PoolItem pi { sat::Solvable(pseudoItems_r[i]) };
214  switch ( pseudoFlags_r[i] )
215  {
216  case 0: pi.status().setBroken(); break;
217  case 1: pi.status().setSatisfied(); break;
218  case -1: pi.status().setNonRelevant(); break;
219  default: pi.status().setUndetermined(); break;
220  }
221  }
222  MIL << "Establish DONE" << endl;
223  }
224  else
225  MIL << "Establish not needed." << endl;
226 }
227 
228 inline std::string itemToString( const PoolItem & item )
229 {
230  if ( !item )
231  return std::string();
232 
233  sat::Solvable slv( item.satSolvable() );
234  std::string ret( slv.asString() ); // n-v-r.a
235  if ( ! slv.isSystem() )
236  {
237  ret += "[";
238  ret += slv.repository().alias();
239  ret += "]";
240  }
241  return ret;
242 }
243 
244 //---------------------------------------------------------------------------
245 
246 std::ostream &
247 SATResolver::dumpOn( std::ostream & os ) const
248 {
249  os << "<resolver>" << endl;
250  if (_satSolver) {
251 #define OUTS(X) os << " " << #X << "\t= " << solver_get_flag(_satSolver, SOLVER_FLAG_##X) << endl
252  OUTS( ALLOW_DOWNGRADE );
253  OUTS( ALLOW_ARCHCHANGE );
254  OUTS( ALLOW_VENDORCHANGE );
255  OUTS( ALLOW_NAMECHANGE );
256  OUTS( ALLOW_UNINSTALL );
257  OUTS( NO_UPDATEPROVIDE );
258  OUTS( SPLITPROVIDES );
259  OUTS( IGNORE_RECOMMENDED );
260  OUTS( ADD_ALREADY_RECOMMENDED );
261  OUTS( NO_INFARCHCHECK );
262  OUTS( KEEP_EXPLICIT_OBSOLETES );
263  OUTS( BEST_OBEY_POLICY );
264  OUTS( NO_AUTOTARGET );
265  OUTS( DUP_ALLOW_DOWNGRADE );
266  OUTS( DUP_ALLOW_ARCHCHANGE );
267  OUTS( DUP_ALLOW_VENDORCHANGE );
268  OUTS( DUP_ALLOW_NAMECHANGE );
269  OUTS( KEEP_ORPHANS );
270  OUTS( BREAK_ORPHANS );
271  OUTS( YUM_OBSOLETES );
272 #undef OUTS
273  os << " focus = " << _focus << endl;
274  os << " distupgrade = " << _distupgrade << endl;
275  os << " distupgrade_removeunsupported = " << _distupgrade_removeunsupported << endl;
276  os << " solveSrcPackages = " << _solveSrcPackages << endl;
277  os << " cleandepsOnRemove = " << _cleandepsOnRemove << endl;
278  os << " fixsystem = " << _fixsystem << endl;
279  } else {
280  os << "<NULL>";
281  }
282  return os << "<resolver/>" << endl;
283 }
284 
285 //---------------------------------------------------------------------------
286 
287 // NOTE: flag defaults must be in sync with ZVARDEFAULT in Resolver.cc
288 SATResolver::SATResolver (const ResPool & pool, sat::detail::CPool *satPool)
289  : _pool(pool)
290  , _satPool(satPool)
291  , _satSolver(NULL)
292  , _focus ( ZConfig::instance().solver_focus() )
293  , _fixsystem(false)
294  , _allowdowngrade ( false )
295  , _allownamechange ( true ) // bsc#1071466
296  , _allowarchchange ( false )
297  , _allowvendorchange ( ZConfig::instance().solver_allowVendorChange() )
298  , _allowuninstall ( false )
299  , _updatesystem(false)
300  , _noupdateprovide ( false )
301  , _dosplitprovides ( true )
302  , _onlyRequires (ZConfig::instance().solver_onlyRequires())
303  , _ignorealreadyrecommended(true)
304  , _distupgrade(false)
305  , _distupgrade_removeunsupported(false)
306  , _dup_allowdowngrade ( ZConfig::instance().solver_dupAllowDowngrade() )
307  , _dup_allownamechange ( ZConfig::instance().solver_dupAllowNameChange() )
308  , _dup_allowarchchange ( ZConfig::instance().solver_dupAllowArchChange() )
309  , _dup_allowvendorchange ( ZConfig::instance().solver_dupAllowVendorChange() )
310  , _solveSrcPackages(false)
311  , _cleandepsOnRemove(ZConfig::instance().solver_cleandepsOnRemove())
312 {
313 }
314 
315 
316 SATResolver::~SATResolver()
317 {
318  solverEnd();
319 }
320 
321 //---------------------------------------------------------------------------
322 
323 ResPool
324 SATResolver::pool (void) const
325 {
326  return _pool;
327 }
328 
329 //---------------------------------------------------------------------------
330 
331 // copy marked item from solution back to pool
332 // if data != NULL, set as APPL_LOW (from establishPool())
333 
334 static void
336 {
337  // resetting
338  item.status().resetTransact (causer);
339  item.status().resetWeak ();
340 
341  bool r;
342 
343  // installation/deletion
344  if (status.isToBeInstalled()) {
345  r = item.status().setToBeInstalled (causer);
346  XDEBUG("SATSolutionToPool install returns " << item << ", " << r);
347  }
348  else if (status.isToBeUninstalledDueToUpgrade()) {
349  r = item.status().setToBeUninstalledDueToUpgrade (causer);
350  XDEBUG("SATSolutionToPool upgrade returns " << item << ", " << r);
351  }
352  else if (status.isToBeUninstalled()) {
353  r = item.status().setToBeUninstalled (causer);
354  XDEBUG("SATSolutionToPool remove returns " << item << ", " << r);
355  }
356 
357  return;
358 }
359 
360 //----------------------------------------------------------------------------
361 //----------------------------------------------------------------------------
362 // resolvePool
363 //----------------------------------------------------------------------------
364 //----------------------------------------------------------------------------
373 {
374  SATCollectTransact( PoolItemList & items_to_install_r,
375  PoolItemList & items_to_remove_r,
376  PoolItemList & items_to_lock_r,
377  PoolItemList & items_to_keep_r,
378  bool solveSrcPackages_r )
379  : _items_to_install( items_to_install_r )
380  , _items_to_remove( items_to_remove_r )
381  , _items_to_lock( items_to_lock_r )
382  , _items_to_keep( items_to_keep_r )
383  , _solveSrcPackages( solveSrcPackages_r )
384  {
385  _items_to_install.clear();
386  _items_to_remove.clear();
387  _items_to_lock.clear();
388  _items_to_keep.clear();
389  }
390 
391  bool operator()( const PoolItem & item_r )
392  {
393 
394  ResStatus & itemStatus( item_r.status() );
395  bool by_solver = ( itemStatus.isBySolver() || itemStatus.isByApplLow() );
396 
397  if ( by_solver )
398  {
399  // Clear former solver/establish resultd
400  itemStatus.resetTransact( ResStatus::APPL_LOW );
401  return true; // -> back out here, don't re-queue former results
402  }
403 
404  if ( !_solveSrcPackages && item_r.isKind<SrcPackage>() )
405  {
406  // Later we may continue on a per source package base.
407  return true; // dont process this source package.
408  }
409 
410  switch ( itemStatus.getTransactValue() )
411  {
412  case ResStatus::TRANSACT:
413  itemStatus.isUninstalled() ? _items_to_install.push_back( item_r )
414  : _items_to_remove.push_back( item_r ); break;
415  case ResStatus::LOCKED: _items_to_lock.push_back( item_r ); break;
416  case ResStatus::KEEP_STATE: _items_to_keep.push_back( item_r ); break;
417  }
418  return true;
419  }
420 
421 private:
422  PoolItemList & _items_to_install;
423  PoolItemList & _items_to_remove;
424  PoolItemList & _items_to_lock;
425  PoolItemList & _items_to_keep;
427 
428 };
430 
431 
432 //----------------------------------------------------------------------------
433 //----------------------------------------------------------------------------
434 // solving.....
435 //----------------------------------------------------------------------------
436 //----------------------------------------------------------------------------
437 
438 
440 {
441  public:
444 
445  CheckIfUpdate( const sat::Solvable & installed_r )
446  : is_updated( false )
447  , _installed( installed_r )
448  {}
449 
450  // check this item will be updated
451 
452  bool operator()( const PoolItem & item )
453  {
454  if ( item.status().isToBeInstalled() )
455  {
456  if ( ! item.multiversionInstall() || sameNVRA( _installed, item ) )
457  {
458  is_updated = true;
459  return false;
460  }
461  }
462  return true;
463  }
464 };
465 
466 
467 bool
468 SATResolver::solving(const CapabilitySet & requires_caps,
469  const CapabilitySet & conflict_caps)
470 {
471  _satSolver = solver_create( _satPool );
472  ::pool_set_custom_vendorcheck( _satPool, &vendorCheck );
473  if (_fixsystem) {
474  queue_push( &(_jobQueue), SOLVER_VERIFY|SOLVER_SOLVABLE_ALL);
475  queue_push( &(_jobQueue), 0 );
476  }
477  if (_updatesystem) {
478  queue_push( &(_jobQueue), SOLVER_UPDATE|SOLVER_SOLVABLE_ALL);
479  queue_push( &(_jobQueue), 0 );
480  }
481  if (_distupgrade) {
482  queue_push( &(_jobQueue), SOLVER_DISTUPGRADE|SOLVER_SOLVABLE_ALL);
483  queue_push( &(_jobQueue), 0 );
484  }
485  if (_distupgrade_removeunsupported) {
486  queue_push( &(_jobQueue), SOLVER_DROP_ORPHANED|SOLVER_SOLVABLE_ALL);
487  queue_push( &(_jobQueue), 0 );
488  }
489  solverSetFocus( *_satSolver, _focus );
490  solver_set_flag(_satSolver, SOLVER_FLAG_ADD_ALREADY_RECOMMENDED, !_ignorealreadyrecommended);
491  solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_DOWNGRADE, _allowdowngrade);
492  solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_NAMECHANGE, _allownamechange);
493  solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_ARCHCHANGE, _allowarchchange);
494  solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_VENDORCHANGE, _allowvendorchange);
495  solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_UNINSTALL, _allowuninstall);
496  solver_set_flag(_satSolver, SOLVER_FLAG_NO_UPDATEPROVIDE, _noupdateprovide);
497  solver_set_flag(_satSolver, SOLVER_FLAG_SPLITPROVIDES, _dosplitprovides);
498  solver_set_flag(_satSolver, SOLVER_FLAG_IGNORE_RECOMMENDED, false); // resolve recommended namespaces
499  solver_set_flag(_satSolver, SOLVER_FLAG_ONLY_NAMESPACE_RECOMMENDED, _onlyRequires); //
500  solver_set_flag(_satSolver, SOLVER_FLAG_DUP_ALLOW_DOWNGRADE, _dup_allowdowngrade );
501  solver_set_flag(_satSolver, SOLVER_FLAG_DUP_ALLOW_NAMECHANGE, _dup_allownamechange );
502  solver_set_flag(_satSolver, SOLVER_FLAG_DUP_ALLOW_ARCHCHANGE, _dup_allowarchchange );
503  solver_set_flag(_satSolver, SOLVER_FLAG_DUP_ALLOW_VENDORCHANGE, _dup_allowvendorchange );
504 
506 
507  // Solve !
508  MIL << "Starting solving...." << endl;
509  MIL << *this;
510  if ( solver_solve( _satSolver, &(_jobQueue) ) == 0 )
511  {
512  // bsc#1155819: Weakremovers of future product not evaluated.
513  // Do a 2nd run to cleanup weakremovers() of to be installed
514  // Produtcs unless removeunsupported is active (cleans up all).
515  if ( _distupgrade )
516  {
517  if ( _distupgrade_removeunsupported )
518  MIL << "Droplist processing not needed. RemoveUnsupported is On." << endl;
519  else if ( ! ZConfig::instance().solverUpgradeRemoveDroppedPackages() )
520  MIL << "Droplist processing is disabled in ZConfig." << endl;
521  else
522  {
523  bool resolve = false;
524  MIL << "Checking droplists ..." << endl;
525  // get Solvables to be installed...
526  sat::SolvableQueue decisionq;
527  solver_get_decisionqueue( _satSolver, decisionq );
528  for ( sat::detail::IdType id : decisionq )
529  {
530  if ( id < 0 )
531  continue;
532  sat::Solvable slv { (sat::detail::SolvableIdType)id };
533  // get product buddies (they carry the weakremover)...
534  static const Capability productCap { "product()" };
535  if ( slv && slv.provides().matches( productCap ) )
536  {
537  CapabilitySet droplist { slv.valuesOfNamespace( "weakremover" ) };
538  MIL << "Droplist for " << slv << ": size " << droplist.size() << endl;
539  if ( !droplist.empty() )
540  {
541  for ( const auto & cap : droplist )
542  {
543  queue_push( &_jobQueue, SOLVER_DROP_ORPHANED | SOLVER_SOLVABLE_NAME );
544  queue_push( &_jobQueue, cap.id() );
545  }
546  // PIN product - a safety net to prevent cleanup from changing the decision for this product
547  queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE );
548  queue_push( &(_jobQueue), id );
549  resolve = true;
550  }
551  }
552  }
553  if ( resolve )
554  solver_solve( _satSolver, &(_jobQueue) );
555  }
556  }
557  }
558  MIL << "....Solver end" << endl;
559 
560  // copying solution back to zypp pool
561  //-----------------------------------------
562  _result_items_to_install.clear();
563  _result_items_to_remove.clear();
564 
565  /* solvables to be installed */
566  Queue decisionq;
567  queue_init(&decisionq);
568  solver_get_decisionqueue(_satSolver, &decisionq);
569  for ( int i = 0; i < decisionq.count; ++i )
570  {
571  Id p = decisionq.elements[i];
572  if ( p < 0 )
573  continue;
574 
575  sat::Solvable slv { (sat::detail::SolvableIdType)p };
576  if ( ! slv || slv.isSystem() )
577  continue;
578 
579  PoolItem poolItem( slv );
581  _result_items_to_install.push_back( poolItem );
582  }
583  queue_free(&decisionq);
584 
585  /* solvables to be erased */
586  Repository systemRepo( sat::Pool::instance().findSystemRepo() ); // don't create if it does not exist
587  if ( systemRepo && ! systemRepo.solvablesEmpty() )
588  {
589  bool mustCheckObsoletes = false;
590  for_( it, systemRepo.solvablesBegin(), systemRepo.solvablesEnd() )
591  {
592  if (solver_get_decisionlevel(_satSolver, it->id()) > 0)
593  continue;
594 
595  // Check if this is an update
596  CheckIfUpdate info( *it );
597  PoolItem poolItem( *it );
598  invokeOnEach( _pool.byIdentBegin( poolItem ),
599  _pool.byIdentEnd( poolItem ),
600  resfilter::ByUninstalled(), // ByUninstalled
601  functor::functorRef<bool,PoolItem> (info) );
602 
603  if (info.is_updated) {
605  } else {
607  if ( ! mustCheckObsoletes )
608  mustCheckObsoletes = true; // lazy check for UninstalledDueToObsolete
609  }
610  _result_items_to_remove.push_back (poolItem);
611  }
612  if ( mustCheckObsoletes )
613  {
614  sat::WhatObsoletes obsoleted( _result_items_to_install.begin(), _result_items_to_install.end() );
615  for_( it, obsoleted.poolItemBegin(), obsoleted.poolItemEnd() )
616  {
617  ResStatus & status( it->status() );
618  // WhatObsoletes contains installed items only!
619  if ( status.transacts() && ! status.isToBeUninstalledDueToUpgrade() )
620  status.setToBeUninstalledDueToObsolete();
621  }
622  }
623  }
624 
625  // copy back computed status values to pool
626  // (on the fly cache orphaned items for the UI)
627  solverCopyBackWeak( *_satSolver, _problem_items );
628  solverCopyBackValidate( *_satSolver, _pool );
629 
630  // Solvables which were selected due requirements which have been made by the user will
631  // be selected by APPL_LOW. We can't use any higher level, because this setting must
632  // not serve as a request for the next solver run. APPL_LOW is reset before solving.
633  for (CapabilitySet::const_iterator iter = requires_caps.begin(); iter != requires_caps.end(); iter++) {
634  sat::WhatProvides rpmProviders(*iter);
635  for_( iter2, rpmProviders.begin(), rpmProviders.end() ) {
636  PoolItem poolItem(*iter2);
637  if (poolItem.status().isToBeInstalled()) {
638  MIL << "User requirement " << *iter << " sets " << poolItem << endl;
639  poolItem.status().setTransactByValue (ResStatus::APPL_LOW);
640  }
641  }
642  }
643  for (CapabilitySet::const_iterator iter = conflict_caps.begin(); iter != conflict_caps.end(); iter++) {
644  sat::WhatProvides rpmProviders(*iter);
645  for_( iter2, rpmProviders.begin(), rpmProviders.end() ) {
646  PoolItem poolItem(*iter2);
647  if (poolItem.status().isToBeUninstalled()) {
648  MIL << "User conflict " << *iter << " sets " << poolItem << endl;
649  poolItem.status().setTransactByValue (ResStatus::APPL_LOW);
650  }
651  }
652  }
653 
654  if (solver_problem_count(_satSolver) > 0 )
655  {
656  ERR << "Solverrun finished with an ERROR" << endl;
657  return false;
658  }
659 
660  return true;
661 }
662 
663 
664 void
665 SATResolver::solverInit(const PoolItemList & weakItems)
666 {
667 
668  MIL << "SATResolver::solverInit()" << endl;
669 
670  // remove old stuff
671  solverEnd();
672  queue_init( &_jobQueue );
673 
674  // clear and rebuild: _items_to_install, _items_to_remove, _items_to_lock, _items_to_keep
675  {
676  SATCollectTransact collector( _items_to_install, _items_to_remove, _items_to_lock, _items_to_keep, solveSrcPackages() );
677  invokeOnEach ( _pool.begin(), _pool.end(), functor::functorRef<bool,PoolItem>( collector ) );
678  }
679 
680  for (PoolItemList::const_iterator iter = weakItems.begin(); iter != weakItems.end(); iter++) {
681  Id id = (*iter)->satSolvable().id();
682  if (id == ID_NULL) {
683  ERR << "Weaken: " << *iter << " not found" << endl;
684  }
685  MIL << "Weaken dependencies of " << *iter << endl;
686  queue_push( &(_jobQueue), SOLVER_WEAKENDEPS | SOLVER_SOLVABLE );
687  queue_push( &(_jobQueue), id );
688  }
689 
690  // Ad rules for retracted patches and packages
691  {
692  queue_push( &(_jobQueue), SOLVER_BLACKLIST|SOLVER_SOLVABLE_PROVIDES );
693  queue_push( &(_jobQueue), sat::Solvable::retractedToken.id() );
694  queue_push( &(_jobQueue), SOLVER_BLACKLIST|SOLVER_SOLVABLE_PROVIDES );
695  queue_push( &(_jobQueue), sat::Solvable::ptfToken.id() );
696  }
697 
698  // Ad rules for changed requestedLocales
699  {
700  const auto & trackedLocaleIds( myPool().trackedLocaleIds() );
701 
702  // just track changed locakes
703  for ( const auto & locale : trackedLocaleIds.added() )
704  {
705  queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES );
706  queue_push( &(_jobQueue), Capability( ResolverNamespace::language, IdString(locale) ).id() );
707  }
708 
709  for ( const auto & locale : trackedLocaleIds.removed() )
710  {
711  queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES | SOLVER_CLEANDEPS ); // needs uncond. SOLVER_CLEANDEPS!
712  queue_push( &(_jobQueue), Capability( ResolverNamespace::language, IdString(locale) ).id() );
713  }
714  }
715 
716  // Add rules for parallel installable resolvables with different versions
717  for ( const sat::Solvable & solv : myPool().multiversionList() )
718  {
719  queue_push( &(_jobQueue), SOLVER_NOOBSOLETES | SOLVER_SOLVABLE );
720  queue_push( &(_jobQueue), solv.id() );
721  }
722 
723  ::pool_add_userinstalled_jobs(_satPool, sat::Pool::instance().autoInstalled(), &(_jobQueue), GET_USERINSTALLED_NAMES|GET_USERINSTALLED_INVERTED);
724 }
725 
726 void
727 SATResolver::solverEnd()
728 {
729  // cleanup
730  if ( _satSolver )
731  {
732  solver_free(_satSolver);
733  _satSolver = NULL;
734  queue_free( &(_jobQueue) );
735  }
736 }
737 
738 
739 bool
740 SATResolver::resolvePool(const CapabilitySet & requires_caps,
741  const CapabilitySet & conflict_caps,
742  const PoolItemList & weakItems,
743  const std::set<Repository> & upgradeRepos)
744 {
745  MIL << "SATResolver::resolvePool()" << endl;
746 
747  // initialize
748  solverInit(weakItems);
749 
750  for (PoolItemList::const_iterator iter = _items_to_install.begin(); iter != _items_to_install.end(); iter++) {
751  Id id = (*iter)->satSolvable().id();
752  if (id == ID_NULL) {
753  ERR << "Install: " << *iter << " not found" << endl;
754  } else {
755  MIL << "Install " << *iter << endl;
756  queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE );
757  queue_push( &(_jobQueue), id );
758  }
759  }
760 
761  for (PoolItemList::const_iterator iter = _items_to_remove.begin(); iter != _items_to_remove.end(); iter++) {
762  Id id = (*iter)->satSolvable().id();
763  if (id == ID_NULL) {
764  ERR << "Delete: " << *iter << " not found" << endl;
765  } else {
766  MIL << "Delete " << *iter << endl;
767  queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE | MAYBE_CLEANDEPS );
768  queue_push( &(_jobQueue), id);
769  }
770  }
771 
772  for_( iter, upgradeRepos.begin(), upgradeRepos.end() )
773  {
774  queue_push( &(_jobQueue), SOLVER_DISTUPGRADE | SOLVER_SOLVABLE_REPO );
775  queue_push( &(_jobQueue), iter->get()->repoid );
776  MIL << "Upgrade repo " << *iter << endl;
777  }
778 
779  for (CapabilitySet::const_iterator iter = requires_caps.begin(); iter != requires_caps.end(); iter++) {
780  queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES );
781  queue_push( &(_jobQueue), iter->id() );
782  MIL << "Requires " << *iter << endl;
783  }
784 
785  for (CapabilitySet::const_iterator iter = conflict_caps.begin(); iter != conflict_caps.end(); iter++) {
786  queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES | MAYBE_CLEANDEPS );
787  queue_push( &(_jobQueue), iter->id() );
788  MIL << "Conflicts " << *iter << endl;
789  }
790 
791  // set requirements for a running system
792  setSystemRequirements();
793 
794  // set locks for the solver
795  setLocks();
796 
797  // solving
798  bool ret = solving(requires_caps, conflict_caps);
799 
800  (ret?MIL:WAR) << "SATResolver::resolvePool() done. Ret:" << ret << endl;
801  return ret;
802 }
803 
804 
805 bool
806 SATResolver::resolveQueue(const SolverQueueItemList &requestQueue,
807  const PoolItemList & weakItems)
808 {
809  MIL << "SATResolver::resolvQueue()" << endl;
810 
811  // initialize
812  solverInit(weakItems);
813 
814  // generate solver queue
815  for (SolverQueueItemList::const_iterator iter = requestQueue.begin(); iter != requestQueue.end(); iter++) {
816  (*iter)->addRule(_jobQueue);
817  }
818 
819  // Add addition item status to the resolve-queue cause these can be set by problem resolutions
820  for (PoolItemList::const_iterator iter = _items_to_install.begin(); iter != _items_to_install.end(); iter++) {
821  Id id = (*iter)->satSolvable().id();
822  if (id == ID_NULL) {
823  ERR << "Install: " << *iter << " not found" << endl;
824  } else {
825  MIL << "Install " << *iter << endl;
826  queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE );
827  queue_push( &(_jobQueue), id );
828  }
829  }
830  for (PoolItemList::const_iterator iter = _items_to_remove.begin(); iter != _items_to_remove.end(); iter++) {
831  sat::detail::IdType ident( (*iter)->satSolvable().ident().id() );
832  MIL << "Delete " << *iter << ident << endl;
833  queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_NAME | MAYBE_CLEANDEPS );
834  queue_push( &(_jobQueue), ident);
835  }
836 
837  // set requirements for a running system
838  setSystemRequirements();
839 
840  // set locks for the solver
841  setLocks();
842 
843  // solving
844  bool ret = solving();
845 
846  MIL << "SATResolver::resolveQueue() done. Ret:" << ret << endl;
847  return ret;
848 }
849 
851 void SATResolver::doUpdate()
852 {
853  MIL << "SATResolver::doUpdate()" << endl;
854 
855  // initialize
856  solverInit(PoolItemList());
857 
858  // set requirements for a running system
859  setSystemRequirements();
860 
861  // set locks for the solver
862  setLocks();
863 
864  _satSolver = solver_create( _satPool );
865  ::pool_set_custom_vendorcheck( _satPool, &vendorCheck );
866  if (_fixsystem) {
867  queue_push( &(_jobQueue), SOLVER_VERIFY|SOLVER_SOLVABLE_ALL);
868  queue_push( &(_jobQueue), 0 );
869  }
870  if (1) {
871  queue_push( &(_jobQueue), SOLVER_UPDATE|SOLVER_SOLVABLE_ALL);
872  queue_push( &(_jobQueue), 0 );
873  }
874  if (_distupgrade) {
875  queue_push( &(_jobQueue), SOLVER_DISTUPGRADE|SOLVER_SOLVABLE_ALL);
876  queue_push( &(_jobQueue), 0 );
877  }
878  if (_distupgrade_removeunsupported) {
879  queue_push( &(_jobQueue), SOLVER_DROP_ORPHANED|SOLVER_SOLVABLE_ALL);
880  queue_push( &(_jobQueue), 0 );
881  }
882  solverSetFocus( *_satSolver, _focus );
883  solver_set_flag(_satSolver, SOLVER_FLAG_ADD_ALREADY_RECOMMENDED, !_ignorealreadyrecommended);
884  solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_DOWNGRADE, _allowdowngrade);
885  solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_NAMECHANGE, _allownamechange);
886  solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_ARCHCHANGE, _allowarchchange);
887  solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_VENDORCHANGE, _allowvendorchange);
888  solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_UNINSTALL, _allowuninstall);
889  solver_set_flag(_satSolver, SOLVER_FLAG_NO_UPDATEPROVIDE, _noupdateprovide);
890  solver_set_flag(_satSolver, SOLVER_FLAG_SPLITPROVIDES, _dosplitprovides);
891  solver_set_flag(_satSolver, SOLVER_FLAG_IGNORE_RECOMMENDED, false); // resolve recommended namespaces
892  solver_set_flag(_satSolver, SOLVER_FLAG_ONLY_NAMESPACE_RECOMMENDED, _onlyRequires); //
893 
895 
896  // Solve !
897  MIL << "Starting solving for update...." << endl;
898  MIL << *this;
899  solver_solve( _satSolver, &(_jobQueue) );
900  MIL << "....Solver end" << endl;
901 
902  // copying solution back to zypp pool
903  //-----------------------------------------
904 
905  /* solvables to be installed */
906  Queue decisionq;
907  queue_init(&decisionq);
908  solver_get_decisionqueue(_satSolver, &decisionq);
909  for (int i = 0; i < decisionq.count; i++)
910  {
911  Id p = decisionq.elements[i];
912  if ( p < 0 )
913  continue;
914 
915  sat::Solvable solv { (sat::detail::SolvableIdType)p };
916  if ( ! solv || solv.isSystem() )
917  continue;
918 
920  }
921  queue_free(&decisionq);
922 
923  /* solvables to be erased */
924  for (int i = _satSolver->pool->installed->start; i < _satSolver->pool->installed->start + _satSolver->pool->installed->nsolvables; i++)
925  {
926  if (solver_get_decisionlevel(_satSolver, i) > 0)
927  continue;
928 
929  PoolItem poolItem( _pool.find( sat::Solvable(i) ) );
930  if (poolItem) {
931  // Check if this is an update
932  CheckIfUpdate info( (sat::Solvable(i)) );
933  invokeOnEach( _pool.byIdentBegin( poolItem ),
934  _pool.byIdentEnd( poolItem ),
935  resfilter::ByUninstalled(), // ByUninstalled
936  functor::functorRef<bool,PoolItem> (info) );
937 
938  if (info.is_updated) {
940  } else {
942  }
943  } else {
944  ERR << "id " << i << " not found in ZYPP pool." << endl;
945  }
946  }
947 
948  // copy back computed status values to pool
949  // (on the fly cache orphaned items for the UI)
950  solverCopyBackWeak( *_satSolver, _problem_items );
951  solverCopyBackValidate( *_satSolver, _pool );
952 
953  MIL << "SATResolver::doUpdate() done" << endl;
954 }
955 
956 
957 
958 //----------------------------------------------------------------------------
959 //----------------------------------------------------------------------------
960 // error handling
961 //----------------------------------------------------------------------------
962 //----------------------------------------------------------------------------
963 
964 //----------------------------------------------------------------------------
965 // helper function
966 //----------------------------------------------------------------------------
967 
969 {
970  ProblemSolutionCombi *problemSolution;
971  TransactionKind action;
972  FindPackage (ProblemSolutionCombi *p, const TransactionKind act)
973  : problemSolution (p)
974  , action (act)
975  {
976  }
977 
979  {
980  problemSolution->addSingleAction (p, action);
981  return true;
982  }
983 };
984 
985 
986 //----------------------------------------------------------------------------
987 // Checking if this solvable/item has a buddy which reflect the real
988 // user visible description of an item
989 // e.g. The release package has a buddy to the concerning product item.
990 // This user want's the message "Product foo conflicts with product bar" and
991 // NOT "package release-foo conflicts with package release-bar"
992 // (ma: that's why we should map just packages to buddies, not vice versa)
993 //----------------------------------------------------------------------------
994 inline sat::Solvable mapBuddy( const PoolItem & item_r )
995 {
996  if ( item_r.satSolvable().isKind<Package>() )
997  {
998  sat::Solvable buddy = item_r.buddy();
999  if ( buddy )
1000  return buddy;
1001  }
1002  return item_r.satSolvable();
1003 }
1005 { return mapBuddy( PoolItem( item_r ) ); }
1006 
1007 PoolItem SATResolver::mapItem ( const PoolItem & item )
1008 { return PoolItem( mapBuddy( item ) ); }
1009 
1010 sat::Solvable SATResolver::mapSolvable ( const Id & id )
1011 { return mapBuddy( sat::Solvable(id) ); }
1012 
1013 std::vector<std::string> SATResolver::SATgetCompleteProblemInfoStrings ( Id problem )
1014 {
1015  std::vector<std::string> ret;
1016  sat::Queue problems;
1017  solver_findallproblemrules( _satSolver, problem, problems );
1018 
1019  bool nobad = false;
1020 
1021  //filter out generic rule information if more explicit ones are available
1022  for ( sat::Queue::size_type i = 0; i < problems.size(); i++ ) {
1023  SolverRuleinfo ruleClass = solver_ruleclass( _satSolver, problems[i]);
1024  if ( ruleClass != SolverRuleinfo::SOLVER_RULE_UPDATE && ruleClass != SolverRuleinfo::SOLVER_RULE_JOB ) {
1025  nobad = true;
1026  break;
1027  }
1028  }
1029  for ( sat::Queue::size_type i = 0; i < problems.size(); i++ ) {
1030  SolverRuleinfo ruleClass = solver_ruleclass( _satSolver, problems[i]);
1031  if ( nobad && ( ruleClass == SolverRuleinfo::SOLVER_RULE_UPDATE || ruleClass == SolverRuleinfo::SOLVER_RULE_JOB ) ) {
1032  continue;
1033  }
1034 
1035  std::string detail;
1036  Id ignore = 0;
1037  std::string pInfo = SATproblemRuleInfoString( problems[i], detail, ignore );
1038 
1039  //we get the same string multiple times, reduce the noise
1040  if ( std::find( ret.begin(), ret.end(), pInfo ) == ret.end() )
1041  ret.push_back( pInfo );
1042  }
1043  return ret;
1044 }
1045 
1046 std::string SATResolver::SATprobleminfoString(Id problem, std::string &detail, Id &ignoreId)
1047 {
1048  // FIXME: solver_findallproblemrules to get all rules for this problem
1049  // (the 'most relevabt' one returned by solver_findproblemrule is embedded
1050  Id probr = solver_findproblemrule(_satSolver, problem);
1051  return SATproblemRuleInfoString( probr, detail, ignoreId );
1052 }
1053 
1054 std::string SATResolver::SATproblemRuleInfoString (Id probr, std::string &detail, Id &ignoreId)
1055 {
1056  std::string ret;
1057  sat::detail::CPool *pool = _satSolver->pool;
1058  Id dep, source, target;
1059  SolverRuleinfo type = solver_ruleinfo(_satSolver, probr, &source, &target, &dep);
1060 
1061  ignoreId = 0;
1062 
1063  sat::Solvable s = mapSolvable( source );
1064  sat::Solvable s2 = mapSolvable( target );
1065 
1066  // @FIXME, these strings are a duplicate copied from the libsolv library
1067  // to provide translations. Instead of having duplicate code we should
1068  // translate those strings directly in libsolv
1069  switch ( type )
1070  {
1071  case SOLVER_RULE_DISTUPGRADE:
1072  ret = str::form (_("%s does not belong to a distupgrade repository"), s.asString().c_str());
1073  break;
1074  case SOLVER_RULE_INFARCH:
1075  ret = str::form (_("%s has inferior architecture"), s.asString().c_str());
1076  break;
1077  case SOLVER_RULE_UPDATE:
1078  ret = str::form (_("problem with installed package %s"), s.asString().c_str());
1079  break;
1080  case SOLVER_RULE_JOB:
1081  ret = _("conflicting requests");
1082  break;
1083  case SOLVER_RULE_PKG:
1084  ret = _("some dependency problem");
1085  break;
1086  case SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP:
1087  ret = str::form (_("nothing provides requested %s"), pool_dep2str(pool, dep));
1088  detail += _("Have you enabled all requested repositories?");
1089  break;
1090  case SOLVER_RULE_JOB_UNKNOWN_PACKAGE:
1091  ret = str::form (_("package %s does not exist"), pool_dep2str(pool, dep));
1092  detail += _("Have you enabled all requested repositories?");
1093  break;
1094  case SOLVER_RULE_JOB_UNSUPPORTED:
1095  ret = _("unsupported request");
1096  break;
1097  case SOLVER_RULE_JOB_PROVIDED_BY_SYSTEM:
1098  ret = str::form (_("%s is provided by the system and cannot be erased"), pool_dep2str(pool, dep));
1099  break;
1100  case SOLVER_RULE_PKG_NOT_INSTALLABLE:
1101  ret = str::form (_("%s is not installable"), s.asString().c_str());
1102  break;
1103  case SOLVER_RULE_PKG_NOTHING_PROVIDES_DEP:
1104  ignoreId = source; // for setting weak dependencies
1105  ret = str::form (_("nothing provides %s needed by %s"), pool_dep2str(pool, dep), s.asString().c_str());
1106  break;
1107  case SOLVER_RULE_PKG_SAME_NAME:
1108  ret = str::form (_("cannot install both %s and %s"), s.asString().c_str(), s2.asString().c_str());
1109  break;
1110  case SOLVER_RULE_PKG_CONFLICTS:
1111  ret = str::form (_("%s conflicts with %s provided by %s"), s.asString().c_str(), pool_dep2str(pool, dep), s2.asString().c_str());
1112  break;
1113  case SOLVER_RULE_PKG_OBSOLETES:
1114  ret = str::form (_("%s obsoletes %s provided by %s"), s.asString().c_str(), pool_dep2str(pool, dep), s2.asString().c_str());
1115  break;
1116  case SOLVER_RULE_PKG_INSTALLED_OBSOLETES:
1117  ret = str::form (_("installed %s obsoletes %s provided by %s"), s.asString().c_str(), pool_dep2str(pool, dep), s2.asString().c_str());
1118  break;
1119  case SOLVER_RULE_PKG_SELF_CONFLICT:
1120  ret = str::form (_("solvable %s conflicts with %s provided by itself"), s.asString().c_str(), pool_dep2str(pool, dep));
1121  break;
1122  case SOLVER_RULE_PKG_REQUIRES: {
1123  ignoreId = source; // for setting weak dependencies
1124  Capability cap(dep);
1125  sat::WhatProvides possibleProviders(cap);
1126 
1127  // check, if a provider will be deleted
1128  typedef std::list<PoolItem> ProviderList;
1129  ProviderList providerlistInstalled, providerlistUninstalled;
1130  for_( iter1, possibleProviders.begin(), possibleProviders.end() ) {
1131  PoolItem provider1 = ResPool::instance().find( *iter1 );
1132  // find pair of an installed/uninstalled item with the same NVR
1133  bool found = false;
1134  for_( iter2, possibleProviders.begin(), possibleProviders.end() ) {
1135  PoolItem provider2 = ResPool::instance().find( *iter2 );
1136  if (compareByNVR (provider1,provider2) == 0
1137  && ( (provider1.status().isInstalled() && provider2.status().isUninstalled())
1138  || (provider2.status().isInstalled() && provider1.status().isUninstalled()) )) {
1139  found = true;
1140  break;
1141  }
1142  }
1143  if (!found) {
1144  if (provider1.status().isInstalled())
1145  providerlistInstalled.push_back(provider1);
1146  else
1147  providerlistUninstalled.push_back(provider1);
1148  }
1149  }
1150 
1151  ret = str::form (_("%s requires %s, but this requirement cannot be provided"), s.asString().c_str(), pool_dep2str(pool, dep));
1152  if (providerlistInstalled.size() > 0) {
1153  detail += _("deleted providers: ");
1154  for (ProviderList::const_iterator iter = providerlistInstalled.begin(); iter != providerlistInstalled.end(); iter++) {
1155  if (iter == providerlistInstalled.begin())
1156  detail += itemToString( *iter );
1157  else
1158  detail += "\n " + itemToString( mapItem(*iter) );
1159  }
1160  }
1161  if (providerlistUninstalled.size() > 0) {
1162  if (detail.size() > 0)
1163  detail += _("\nnot installable providers: ");
1164  else
1165  detail = _("not installable providers: ");
1166  for (ProviderList::const_iterator iter = providerlistUninstalled.begin(); iter != providerlistUninstalled.end(); iter++) {
1167  if (iter == providerlistUninstalled.begin())
1168  detail += itemToString( *iter );
1169  else
1170  detail += "\n " + itemToString( mapItem(*iter) );
1171  }
1172  }
1173  break;
1174  }
1175  default: {
1176  DBG << "Unknown rule type(" << type << ") going to query libsolv for rule information." << endl;
1177  ret = str::asString( ::solver_problemruleinfo2str( _satSolver, type, static_cast<Id>(s.id()), static_cast<Id>(s2.id()), dep ) );
1178  break;
1179  }
1180  }
1181  return ret;
1182 }
1183 
1185 SATResolver::problems ()
1186 {
1187  ResolverProblemList resolverProblems;
1188  if (_satSolver && solver_problem_count(_satSolver)) {
1189  sat::detail::CPool *pool = _satSolver->pool;
1190  int pcnt;
1191  Id p, rp, what;
1192  Id problem, solution, element;
1193  sat::Solvable s, sd;
1194 
1195  CapabilitySet system_requires = SystemCheck::instance().requiredSystemCap();
1196  CapabilitySet system_conflicts = SystemCheck::instance().conflictSystemCap();
1197 
1198  MIL << "Encountered problems! Here are the solutions:\n" << endl;
1199  pcnt = 1;
1200  problem = 0;
1201  while ((problem = solver_next_problem(_satSolver, problem)) != 0) {
1202  MIL << "Problem " << pcnt++ << ":" << endl;
1203  MIL << "====================================" << endl;
1204  std::string detail;
1205  Id ignoreId;
1206  std::string whatString = SATprobleminfoString (problem,detail,ignoreId);
1207  MIL << whatString << endl;
1208  MIL << "------------------------------------" << endl;
1209  ResolverProblem_Ptr resolverProblem = new ResolverProblem (whatString, detail, SATgetCompleteProblemInfoStrings( problem ));
1210 
1211  solution = 0;
1212  while ((solution = solver_next_solution(_satSolver, problem, solution)) != 0) {
1213  element = 0;
1214  ProblemSolutionCombi *problemSolution = new ProblemSolutionCombi;
1215  while ((element = solver_next_solutionelement(_satSolver, problem, solution, element, &p, &rp)) != 0) {
1216  if (p == SOLVER_SOLUTION_JOB) {
1217  /* job, rp is index into job queue */
1218  what = _jobQueue.elements[rp];
1219  switch (_jobQueue.elements[rp-1]&(SOLVER_SELECTMASK|SOLVER_JOBMASK))
1220  {
1221  case SOLVER_INSTALL | SOLVER_SOLVABLE: {
1222  s = mapSolvable (what);
1223  PoolItem poolItem = _pool.find (s);
1224  if (poolItem) {
1225  if (pool->installed && s.get()->repo == pool->installed) {
1226  problemSolution->addSingleAction (poolItem, REMOVE);
1227  std::string description = str::form (_("remove lock to allow removal of %s"), s.asString().c_str() );
1228  MIL << description << endl;
1229  problemSolution->addDescription (description);
1230  } else {
1231  problemSolution->addSingleAction (poolItem, KEEP);
1232  std::string description = str::form (_("do not install %s"), s.asString().c_str());
1233  MIL << description << endl;
1234  problemSolution->addDescription (description);
1235  }
1236  } else {
1237  ERR << "SOLVER_INSTALL_SOLVABLE: No item found for " << s.asString() << endl;
1238  }
1239  }
1240  break;
1241  case SOLVER_ERASE | SOLVER_SOLVABLE: {
1242  s = mapSolvable (what);
1243  PoolItem poolItem = _pool.find (s);
1244  if (poolItem) {
1245  if (pool->installed && s.get()->repo == pool->installed) {
1246  problemSolution->addSingleAction (poolItem, KEEP);
1247  std::string description = str::form (_("keep %s"), s.asString().c_str());
1248  MIL << description << endl;
1249  problemSolution->addDescription (description);
1250  } else {
1251  problemSolution->addSingleAction (poolItem, UNLOCK);
1252  std::string description = str::form (_("remove lock to allow installation of %s"), itemToString( poolItem ).c_str());
1253  MIL << description << endl;
1254  problemSolution->addDescription (description);
1255  }
1256  } else {
1257  ERR << "SOLVER_ERASE_SOLVABLE: No item found for " << s.asString() << endl;
1258  }
1259  }
1260  break;
1261  case SOLVER_INSTALL | SOLVER_SOLVABLE_NAME:
1262  {
1263  IdString ident( what );
1264  SolverQueueItemInstall_Ptr install =
1265  new SolverQueueItemInstall(_pool, ident.asString(), false );
1266  problemSolution->addSingleAction (install, REMOVE_SOLVE_QUEUE_ITEM);
1267 
1268  std::string description = str::form (_("do not install %s"), ident.c_str() );
1269  MIL << description << endl;
1270  problemSolution->addDescription (description);
1271  }
1272  break;
1273  case SOLVER_ERASE | SOLVER_SOLVABLE_NAME:
1274  {
1275  // As we do not know, if this request has come from resolvePool or
1276  // resolveQueue we will have to take care for both cases.
1277  IdString ident( what );
1278  FindPackage info (problemSolution, KEEP);
1279  invokeOnEach( _pool.byIdentBegin( ident ),
1280  _pool.byIdentEnd( ident ),
1281  functor::chain (resfilter::ByInstalled (), // ByInstalled
1282  resfilter::ByTransact ()), // will be deinstalled
1283  functor::functorRef<bool,PoolItem> (info) );
1284 
1285  SolverQueueItemDelete_Ptr del =
1286  new SolverQueueItemDelete(_pool, ident.asString(), false );
1287  problemSolution->addSingleAction (del, REMOVE_SOLVE_QUEUE_ITEM);
1288 
1289  std::string description = str::form (_("keep %s"), ident.c_str());
1290  MIL << description << endl;
1291  problemSolution->addDescription (description);
1292  }
1293  break;
1294  case SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES:
1295  {
1296  problemSolution->addSingleAction (Capability(what), REMOVE_EXTRA_REQUIRE);
1297  std::string description = "";
1298 
1299  // Checking if this problem solution would break your system
1300  if (system_requires.find(Capability(what)) != system_requires.end()) {
1301  // Show a better warning
1302  resolverProblem->setDetails( resolverProblem->description() + "\n" + resolverProblem->details() );
1303  resolverProblem->setDescription(_("This request will break your system!"));
1304  description = _("ignore the warning of a broken system");
1305  description += std::string(" (requires:")+pool_dep2str(pool, what)+")";
1306  MIL << description << endl;
1307  problemSolution->addFrontDescription (description);
1308  } else {
1309  description = str::form (_("do not ask to install a solvable providing %s"), pool_dep2str(pool, what));
1310  MIL << description << endl;
1311  problemSolution->addDescription (description);
1312  }
1313  }
1314  break;
1315  case SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES:
1316  {
1317  problemSolution->addSingleAction (Capability(what), REMOVE_EXTRA_CONFLICT);
1318  std::string description = "";
1319 
1320  // Checking if this problem solution would break your system
1321  if (system_conflicts.find(Capability(what)) != system_conflicts.end()) {
1322  // Show a better warning
1323  resolverProblem->setDetails( resolverProblem->description() + "\n" + resolverProblem->details() );
1324  resolverProblem->setDescription(_("This request will break your system!"));
1325  description = _("ignore the warning of a broken system");
1326  description += std::string(" (conflicts:")+pool_dep2str(pool, what)+")";
1327  MIL << description << endl;
1328  problemSolution->addFrontDescription (description);
1329 
1330  } else {
1331  description = str::form (_("do not ask to delete all solvables providing %s"), pool_dep2str(pool, what));
1332  MIL << description << endl;
1333  problemSolution->addDescription (description);
1334  }
1335  }
1336  break;
1337  case SOLVER_UPDATE | SOLVER_SOLVABLE:
1338  {
1339  s = mapSolvable (what);
1340  PoolItem poolItem = _pool.find (s);
1341  if (poolItem) {
1342  if (pool->installed && s.get()->repo == pool->installed) {
1343  problemSolution->addSingleAction (poolItem, KEEP);
1344  std::string description = str::form (_("do not install most recent version of %s"), s.asString().c_str());
1345  MIL << description << endl;
1346  problemSolution->addDescription (description);
1347  } else {
1348  ERR << "SOLVER_INSTALL_SOLVABLE_UPDATE " << poolItem << " is not selected for installation" << endl;
1349  }
1350  } else {
1351  ERR << "SOLVER_INSTALL_SOLVABLE_UPDATE: No item found for " << s.asString() << endl;
1352  }
1353  }
1354  break;
1355  default:
1356  MIL << "- do something different" << endl;
1357  ERR << "No valid solution available" << endl;
1358  break;
1359  }
1360  } else if (p == SOLVER_SOLUTION_INFARCH) {
1361  s = mapSolvable (rp);
1362  PoolItem poolItem = _pool.find (s);
1363  if (pool->installed && s.get()->repo == pool->installed) {
1364  problemSolution->addSingleAction (poolItem, LOCK);
1365  std::string description = str::form (_("keep %s despite the inferior architecture"), s.asString().c_str());
1366  MIL << description << endl;
1367  problemSolution->addDescription (description);
1368  } else {
1369  problemSolution->addSingleAction (poolItem, INSTALL);
1370  std::string description = str::form (_("install %s despite the inferior architecture"), s.asString().c_str());
1371  MIL << description << endl;
1372  problemSolution->addDescription (description);
1373  }
1374  } else if (p == SOLVER_SOLUTION_DISTUPGRADE) {
1375  s = mapSolvable (rp);
1376  PoolItem poolItem = _pool.find (s);
1377  if (pool->installed && s.get()->repo == pool->installed) {
1378  problemSolution->addSingleAction (poolItem, LOCK);
1379  std::string description = str::form (_("keep obsolete %s"), s.asString().c_str());
1380  MIL << description << endl;
1381  problemSolution->addDescription (description);
1382  } else {
1383  problemSolution->addSingleAction (poolItem, INSTALL);
1384  std::string description = str::form (_("install %s from excluded repository"), s.asString().c_str());
1385  MIL << description << endl;
1386  problemSolution->addDescription (description);
1387  }
1388  } else if ( p == SOLVER_SOLUTION_BLACK ) {
1389  // Allow to install a blacklisted package (PTF, retracted,...).
1390  // For not-installed items only
1391  s = mapSolvable (rp);
1392  PoolItem poolItem = _pool.find (s);
1393 
1394  problemSolution->addSingleAction (poolItem, INSTALL);
1395  std::string description;
1396  if ( s.isRetracted() ) {
1397  // translator: %1% is a package name
1398  description = str::Format(_("install %1% although it has been retracted")) % s.asString();
1399  } else if ( s.isPtf() ) {
1400  // translator: %1% is a package name
1401  description = str::Format(_("allow to install the PTF %1%")) % s.asString();
1402  } else {
1403  // translator: %1% is a package name
1404  description = str::Format(_("install %1% although it is blacklisted")) % s.asString();
1405  }
1406  MIL << description << endl;
1407  problemSolution->addDescription( description );
1408  } else if ( p > 0 ) {
1409  /* policy, replace p with rp */
1410  s = mapSolvable (p);
1411  PoolItem itemFrom = _pool.find (s);
1412  if (rp)
1413  {
1414  int gotone = 0;
1415 
1416  sd = mapSolvable (rp);
1417  PoolItem itemTo = _pool.find (sd);
1418  if (itemFrom && itemTo) {
1419  problemSolution->addSingleAction (itemTo, INSTALL);
1420  int illegal = policy_is_illegal(_satSolver, s.get(), sd.get(), 0);
1421 
1422  if ((illegal & POLICY_ILLEGAL_DOWNGRADE) != 0)
1423  {
1424  std::string description = str::form (_("downgrade of %s to %s"), s.asString().c_str(), sd.asString().c_str());
1425  MIL << description << endl;
1426  problemSolution->addDescription (description);
1427  gotone = 1;
1428  }
1429  if ((illegal & POLICY_ILLEGAL_ARCHCHANGE) != 0)
1430  {
1431  std::string description = str::form (_("architecture change of %s to %s"), s.asString().c_str(), sd.asString().c_str());
1432  MIL << description << endl;
1433  problemSolution->addDescription (description);
1434  gotone = 1;
1435  }
1436  if ((illegal & POLICY_ILLEGAL_VENDORCHANGE) != 0)
1437  {
1438  IdString s_vendor( s.vendor() );
1439  IdString sd_vendor( sd.vendor() );
1440  std::string description = str::form (_("install %s (with vendor change)\n %s --> %s") ,
1441  sd.asString().c_str(),
1442  ( s_vendor ? s_vendor.c_str() : " (no vendor) " ),
1443  ( sd_vendor ? sd_vendor.c_str() : " (no vendor) " ) );
1444  MIL << description << endl;
1445  problemSolution->addDescription (description);
1446  gotone = 1;
1447  }
1448  if (!gotone) {
1449  std::string description = str::form (_("replacement of %s with %s"), s.asString().c_str(), sd.asString().c_str());
1450  MIL << description << endl;
1451  problemSolution->addDescription (description);
1452  }
1453  } else {
1454  ERR << s.asString() << " or " << sd.asString() << " not found" << endl;
1455  }
1456  }
1457  else
1458  {
1459  if (itemFrom) {
1460  std::string description = str::form (_("deinstallation of %s"), s.asString().c_str());
1461  MIL << description << endl;
1462  problemSolution->addDescription (description);
1463  problemSolution->addSingleAction (itemFrom, REMOVE);
1464  }
1465  }
1466  }
1467  else
1468  {
1469  INT << "Unknown solution " << p << endl;
1470  }
1471 
1472  }
1473  resolverProblem->addSolution (problemSolution,
1474  problemSolution->actionCount() > 1 ? true : false); // Solutions with more than 1 action will be shown first.
1475  MIL << "------------------------------------" << endl;
1476  }
1477 
1478  if (ignoreId > 0) {
1479  // There is a possibility to ignore this error by setting weak dependencies
1480  PoolItem item = _pool.find (sat::Solvable(ignoreId));
1481  ProblemSolutionIgnore *problemSolution = new ProblemSolutionIgnore(item);
1482  resolverProblem->addSolution (problemSolution,
1483  false); // Solutions will be shown at the end
1484  MIL << "ignore some dependencies of " << item << endl;
1485  MIL << "------------------------------------" << endl;
1486  }
1487 
1488  // save problem
1489  resolverProblems.push_back (resolverProblem);
1490  }
1491  }
1492  return resolverProblems;
1493 }
1494 
1495 void SATResolver::applySolutions( const ProblemSolutionList & solutions )
1496 { Resolver( _pool ).applySolutions( solutions ); }
1497 
1498 void SATResolver::setLocks()
1499 {
1500  unsigned icnt = 0;
1501  unsigned acnt = 0;
1502 
1503  for (PoolItemList::const_iterator iter = _items_to_lock.begin(); iter != _items_to_lock.end(); ++iter) {
1504  sat::detail::SolvableIdType ident( (*iter)->satSolvable().id() );
1505  if (iter->status().isInstalled()) {
1506  ++icnt;
1507  queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE );
1508  queue_push( &(_jobQueue), ident );
1509  } else {
1510  ++acnt;
1511  queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE | MAYBE_CLEANDEPS );
1512  queue_push( &(_jobQueue), ident );
1513  }
1514  }
1515  MIL << "Locked " << icnt << " installed items and " << acnt << " NOT installed items." << endl;
1516 
1518  // Weak locks: Ignore if an item with this name is already installed.
1519  // If it's not installed try to keep it this way using a weak delete
1521  std::set<IdString> unifiedByName;
1522  for (PoolItemList::const_iterator iter = _items_to_keep.begin(); iter != _items_to_keep.end(); ++iter) {
1523  IdString ident( (*iter)->satSolvable().ident() );
1524  if ( unifiedByName.insert( ident ).second )
1525  {
1526  if ( ! ui::Selectable::get( *iter )->hasInstalledObj() )
1527  {
1528  MIL << "Keep NOT installed name " << ident << " (" << *iter << ")" << endl;
1529  queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_NAME | SOLVER_WEAK | MAYBE_CLEANDEPS );
1530  queue_push( &(_jobQueue), ident.id() );
1531  }
1532  }
1533  }
1534 }
1535 
1536 void SATResolver::setSystemRequirements()
1537 {
1538  CapabilitySet system_requires = SystemCheck::instance().requiredSystemCap();
1539  CapabilitySet system_conflicts = SystemCheck::instance().conflictSystemCap();
1540 
1541  for (CapabilitySet::const_iterator iter = system_requires.begin(); iter != system_requires.end(); ++iter) {
1542  queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES );
1543  queue_push( &(_jobQueue), iter->id() );
1544  MIL << "SYSTEM Requires " << *iter << endl;
1545  }
1546 
1547  for (CapabilitySet::const_iterator iter = system_conflicts.begin(); iter != system_conflicts.end(); ++iter) {
1548  queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES | MAYBE_CLEANDEPS );
1549  queue_push( &(_jobQueue), iter->id() );
1550  MIL << "SYSTEM Conflicts " << *iter << endl;
1551  }
1552 
1553  // Lock the architecture of the running systems rpm
1554  // package on distupgrade.
1555  if ( _distupgrade && ZConfig::instance().systemRoot() == "/" )
1556  {
1557  ResPool pool( ResPool::instance() );
1558  IdString rpm( "rpm" );
1559  for_( it, pool.byIdentBegin(rpm), pool.byIdentEnd(rpm) )
1560  {
1561  if ( (*it)->isSystem() )
1562  {
1563  Capability archrule( (*it)->arch(), rpm.c_str(), Capability::PARSED );
1564  queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE_NAME | SOLVER_ESSENTIAL );
1565  queue_push( &(_jobQueue), archrule.id() );
1566 
1567  }
1568  }
1569  }
1570 }
1571 
1572 sat::StringQueue SATResolver::autoInstalled() const
1573 {
1574  sat::StringQueue ret;
1575  if ( _satSolver )
1576  ::solver_get_userinstalled( _satSolver, ret, GET_USERINSTALLED_NAMES|GET_USERINSTALLED_INVERTED );
1577  return ret;
1578 }
1579 
1580 sat::StringQueue SATResolver::userInstalled() const
1581 {
1582  sat::StringQueue ret;
1583  if ( _satSolver )
1584  ::solver_get_userinstalled( _satSolver, ret, GET_USERINSTALLED_NAMES );
1585  return ret;
1586 }
1587 
1588 
1590 };// namespace detail
1593  };// namespace solver
1596 };// namespace zypp
1598 
zypp::sat::Pool::instance
static Pool instance()
Singleton ctor.
Definition: Pool.h:55
zypp::PoolItem
Combining sat::Solvable and ResStatus.
Definition: PoolItem.h:50
zypp::ResStatus::isToBeInstalled
bool isToBeInstalled() const
Definition: ResStatus.h:253
zypp::sat::sameNVRA
bool sameNVRA(const SolvableType< Derived > &lhs, const Solvable &rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: SolvableType.h:228
zypp::solver::detail::SATSolutionToPool
static void SATSolutionToPool(PoolItem item, const ResStatus &status, const ResStatus::TransactByValue causer)
Definition: SATResolver.cc:335
zypp::solver::detail::SATCollectTransact::_solveSrcPackages
bool _solveSrcPackages
Definition: SATResolver.cc:426
zypp::solver::detail::FindPackage::action
TransactionKind action
Definition: SATResolver.cc:971
zypp::sat::SolvableType::isKind
bool isKind(const ResKind &kind_r) const
Definition: SolvableType.h:64
Resolver.h
zypp::sat::Solvable
A Solvable object within the sat Pool.
Definition: Solvable.h:53
zypp::solver::detail::SATCollectTransact::_items_to_remove
PoolItemList & _items_to_remove
Definition: SATResolver.cc:423
std::dumpOn
std::ostream & dumpOn(std::ostream &str, const zypp::shared_ptr< void > &obj)
Definition: PtrTypes.h:151
zypp::Repository::alias
std::string alias() const
Short unique string to identify a repo.
Definition: Repository.cc:59
zypp::VendorAttr::equivalent
bool equivalent(const Vendor &lVendor, const Vendor &rVendor) const
Return whether two vendor strings should be treated as the same vendor.
Definition: VendorAttr.cc:264
zypp::solver::detail::FindPackage
Definition: SATResolver.cc:968
zypp::traits::isPseudoInstalled
bool isPseudoInstalled(ResKind kind_r)
Those are denoted to be installed, if the solver verifies them as being satisfied.
Definition: ResTraits.h:28
zypp::ResolverFocus::Default
Request the standard behavior (as defined in zypp.conf or 'Job')
zypp::sat::SolvableType::satSolvable
Solvable satSolvable() const
Return the corresponding sat::Solvable.
Definition: SolvableType.h:57
zypp::sat::Solvable::ptfToken
static const IdString ptfToken
Indicator provides ptf()
Definition: Solvable.h:59
zypp::sat::Solvable::isKind
bool isKind(const ResKind &kind_r) const
Test whether a Solvable is of a certain ResKind.
Definition: Solvable.cc:301
zypp::sat::detail::CPool
::s_Pool CPool
Wrapped libsolv C data type exposed as backdoor.
Definition: PoolMember.h:61
zypp::sat::StringQueue
Queue StringQueue
Queue with String ids.
Definition: Queue.h:27
zypp::solver::detail::IMPL_PTR_TYPE
IMPL_PTR_TYPE(SATResolver)
ZConfig.h
zypp::ResStatus::SOLVER
Definition: ResStatus.h:108
MIL
#define MIL
Definition: Logger.h:79
SolverQueueItem.h
zypp::ResStatus::toBeInstalled
static const ResStatus toBeInstalled
Definition: ResStatus.h:662
SolverQueueItemDelete.h
zypp::sat::compareByNVR
bool compareByNVR(const SolvableType< Derived > &lhs, const Solvable &rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: SolvableType.h:256
zypp::ResolverNamespace::language
language support
zypp::ResPool::instance
static ResPool instance()
Singleton ctor.
Definition: ResPool.cc:37
INT
#define INT
Definition: Logger.h:83
Product.h
zypp::ResStatus::TransactByValue
TransactByValue
Definition: ResStatus.h:106
zypp::solver::detail::_dup_allowdowngrade
_dup_allowdowngrade
Definition: Resolver.cc:123
zypp::ProblemSolutionList
std::list< ProblemSolution_Ptr > ProblemSolutionList
Definition: ProblemTypes.h:43
zypp::ResolverFocus
ResolverFocus
The resolvers general attitude.
Definition: ResolverFocus.h:21
zypp::solver::detail::mapBuddy
sat::Solvable mapBuddy(sat::Solvable item_r)
Definition: SATResolver.cc:1004
zypp::ResStatus::resetTransact
bool resetTransact(TransactByValue causer_r)
Not the same as setTransact( false ).
Definition: ResStatus.h:485
zypp::sat::Solvable::repository
Repository repository() const
The Repository this Solvable belongs to.
Definition: Solvable.cc:362
zypp::solver::detail::CheckIfUpdate::is_updated
bool is_updated
Definition: SATResolver.cc:442
zypp::solver::detail::itemToString
std::string itemToString(const PoolItem &item)
Definition: SATResolver.cc:228
zypp::sat::detail::CSolver
::s_Solver CSolver
Wrapped libsolv C data type exposed as backdoor.
Definition: PoolMember.h:65
zypp::ResStatus::setToBeUninstalledDueToUpgrade
bool setToBeUninstalledDueToUpgrade(TransactByValue causer)
Definition: ResStatus.h:569
SolverQueueItemInstall.h
WhatProvides.h
zypp::IdString
Access to the sat-pools string space.
Definition: IdString.h:41
zypp::ResStatus::toBeUninstalledDueToUpgrade
static const ResStatus toBeUninstalledDueToUpgrade
Definition: ResStatus.h:664
LogTools.h
zypp::sat::Pool::prepare
void prepare() const
Update housekeeping data if necessary (e.g.
Definition: Pool.cc:61
zypp::CapabilitySet
std::unordered_set< Capability > CapabilitySet
Definition: Capability.h:33
zypp::ResStatus::TRANSACT
Definition: ResStatus.h:104
zypp::ResStatus::KEEP_STATE
Definition: ResStatus.h:102
zypp::ResolverFocus::Update
Focus on updating requested packages and their dependencies as much as possible.
zypp::solver::detail::SolverQueueItemList
std::list< SolverQueueItem_Ptr > SolverQueueItemList
Definition: Types.h:45
zypp::sat::detail::SolvableIdType
unsigned SolvableIdType
Id type to connect Solvable and sat-solvable.
Definition: PoolMember.h:125
OUTS
#define OUTS(X)
zypp::solver::detail::CheckIfUpdate::CheckIfUpdate
CheckIfUpdate(const sat::Solvable &installed_r)
Definition: SATResolver.cc:445
PoolImpl.h
Algorithm.h
zypp::solver::detail::CheckIfUpdate
Definition: SATResolver.cc:439
zypp::ResolverFocus::Job
Focus on installing the best version of the requested packages.
WAR
#define WAR
Definition: Logger.h:80
zypp::solver::detail::CheckIfUpdate::operator()
bool operator()(const PoolItem &item)
Definition: SATResolver.cc:452
zypp::Package
Package interface.
Definition: Package.h:32
zypp::solver::detail::SATCollectTransact::SATCollectTransact
SATCollectTransact(PoolItemList &items_to_install_r, PoolItemList &items_to_remove_r, PoolItemList &items_to_lock_r, PoolItemList &items_to_keep_r, bool solveSrcPackages_r)
Definition: SATResolver.cc:374
_
#define _(MSG)
Definition: Gettext.h:37
zypp::sat::detail::IdType
int IdType
Generic Id type.
Definition: PoolMember.h:104
zypp::invokeOnEach
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
zypp::str::form
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Definition: String.cc:35
zypp::solver::detail::CheckIfUpdate::_installed
sat::Solvable _installed
Definition: SATResolver.cc:443
zypp::ZConfig::instance
static ZConfig & instance()
Singleton ctor.
Definition: Resolver.cc:126
zypp::solver::detail::SATCollectTransact::operator()
bool operator()(const PoolItem &item_r)
Definition: SATResolver.cc:391
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
SolutionAction.h
zypp::SrcPackage
SrcPackage interface.
Definition: SrcPackage.h:29
SystemCheck.h
zypp::sat::Queue::size
size_type size() const
Definition: Queue.cc:49
AutoDispose.h
zypp::ResPool::find
PoolItem find(const sat::Solvable &slv_r) const
Return the corresponding PoolItem.
Definition: ResPool.cc:73
zypp::sat::Queue
Libsolv Id queue wrapper.
Definition: Queue.h:34
zypp::solver::detail::SATCollectTransact::_items_to_lock
PoolItemList & _items_to_lock
Definition: SATResolver.cc:424
zypp::solver::detail::SATCollectTransact::_items_to_keep
PoolItemList & _items_to_keep
Definition: SATResolver.cc:425
MAYBE_CLEANDEPS
#define MAYBE_CLEANDEPS
Definition: SATResolver.cc:171
zypp::solver::detail::SATCollectTransact
Commit helper functor distributing PoolItem by status into lists.
Definition: SATResolver.cc:372
zypp::ResStatus::setToBeUninstalled
bool setToBeUninstalled(TransactByValue causer)
Definition: ResStatus.h:545
zypp::sat::Queue::empty
bool empty() const
Definition: Queue.cc:46
zypp::ResolverProblemList
std::list< ResolverProblem_Ptr > ResolverProblemList
Definition: ProblemTypes.h:46
zypp::PoolItem::buddy
sat::Solvable buddy() const
Return the buddy we share our status object with.
Definition: PoolItem.cc:206
Gettext.h
zypp::AutoDispose
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Definition: AutoDispose.h:92
zypp::resfilter::ResObjectFilterFunctor
std::unary_function< ResObject::constPtr, bool > ResObjectFilterFunctor
Definition: ResFilters.h:151
zypp::solver::detail::SATCollectTransact::_items_to_install
PoolItemList & _items_to_install
Definition: SATResolver.cc:422
zypp::PoolItem::status
ResStatus & status() const
Returns the current status.
Definition: PoolItem.cc:204
for_
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:28
zypp::str::asString
const std::string & asString(const std::string &t)
Global asString() that works with std::string too.
Definition: String.h:136
zypp::ResStatus::LOCKED
Definition: ResStatus.h:103
zypp::ResStatus
Status bitfield.
Definition: ResStatus.h:53
zypp::solver::detail::establish
void establish(sat::Queue &pseudoItems_r, sat::Queue &pseudoFlags_r)
ResPool helper to compute the initial status of Patches etc.
Definition: SATResolver.cc:187
zypp::ResolverFocus::Installed
Focus on applying as little changes to the installed packages as needed.
zypp::sat::SolvableQueue
Queue SolvableQueue
Queue with Solvable ids.
Definition: Queue.h:25
XDEBUG
#define XDEBUG(x)
Definition: SATResolver.cc:58
zypp::ResStatus::isToBeUninstalled
bool isToBeUninstalled() const
Definition: ResStatus.h:261
zypp::ResStatus::APPL_LOW
Definition: ResStatus.h:109
zypp::ui::Selectable::get
static Ptr get(const pool::ByIdent &ident_r)
Get the Selctable.
Definition: Selectable.cc:28
zypp::Capability::PARSED
Definition: Capability.h:62
zypp::ResStatus::resetWeak
void resetWeak()
Definition: ResStatus.h:197
zypp::solver::detail::FindPackage::problemSolution
ProblemSolutionCombi * problemSolution
Definition: SATResolver.cc:970
ProblemSolutionCombi.h
ERR
#define ERR
Definition: Logger.h:81
zypp::VendorAttr::instance
static const VendorAttr & instance()
Singleton.
Definition: VendorAttr.cc:121
zypp::solver::detail::FindPackage::operator()
bool operator()(PoolItem p)
Definition: SATResolver.cc:978
ProblemSolutionIgnore.h
DBG
#define DBG
Definition: Logger.h:78
zypp::ZConfig::systemRoot
Pathname systemRoot() const
The target root directory.
Definition: ZConfig.cc:830
zypp::ResStatus::toBeUninstalled
static const ResStatus toBeUninstalled
Definition: ResStatus.h:663
zypp::resfilter::PoolItemFilterFunctor
std::unary_function< PoolItem, bool > PoolItemFilterFunctor
Definition: ResFilters.h:285
zypp::ResStatus::setToBeInstalled
bool setToBeInstalled(TransactByValue causer)
Definition: ResStatus.h:531
zypp::solver::detail::_dup_allowvendorchange
_dup_allowvendorchange
Definition: Resolver.cc:126
zypp::solver::detail::_dup_allownamechange
_dup_allownamechange
Definition: Resolver.cc:124
zypp::sat::Solvable::retractedToken
static const IdString retractedToken
Indicator provides retracted-patch-package()
Definition: Solvable.h:58
SATResolver.h
zypp::functor::chain
Chain< TACondition, TBCondition > chain(TACondition conda_r, TBCondition condb_r)
Convenience function for creating a Chain from two conditions conda_r and condb_r.
Definition: Functional.h:346
WhatObsoletes.h
zypp::ResStatus::isToBeUninstalledDueToUpgrade
bool isToBeUninstalledDueToUpgrade() const
Definition: ResStatus.h:318
zypp::sat::Queue::size_type
unsigned size_type
Definition: Queue.h:37
zypp::solver::detail::_allowvendorchange
_allowvendorchange
Definition: Resolver.cc:121
zypp::solver::detail::vendorCheck
int vendorCheck(sat::detail::CPool *pool, Solvable *solvable1, Solvable *solvable2)
Definition: SATResolver.cc:177
zypp::sat::Pool::get
detail::CPool * get() const
Expert backdoor.
Definition: Pool.cc:49
zypp::sat::Queue::push
void push(value_type val_r)
Push a value to the end off the Queue.
Definition: Queue.cc:103
zypp::solver::detail::FindPackage::FindPackage
FindPackage(ProblemSolutionCombi *p, const TransactionKind act)
Definition: SATResolver.cc:972
zypp::solver::detail::_dup_allowarchchange
_dup_allowarchchange
Definition: Resolver.cc:125
zypp::sat::SolvableType::multiversionInstall
bool multiversionInstall() const
Definition: SolvableType.h:82