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