libzypp 17.28.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 */
21extern "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>
43#include <zypp/sat/detail/PoolImpl.h>
44
45#include <zypp/solver/detail/Resolver.h>
47
55
56using 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
64namespace zypp
65{
67 namespace solver
68 {
70 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
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
169IMPL_PTR_TYPE(SATResolver);
170
171#define MAYBE_CLEANDEPS (cleandepsOnRemove()?SOLVER_CLEANDEPS:0)
172
173//---------------------------------------------------------------------------
174// Callbacks for SAT policies
175//---------------------------------------------------------------------------
176
177int vendorCheck( sat::detail::CPool *pool, Solvable *solvable1, Solvable *solvable2 )
178{ return VendorAttr::instance().equivalent( IdString(solvable1->vendor), IdString(solvable2->vendor) ) ? 0 : 1; }
179
180int relaxedVendorCheck( sat::detail::CPool *pool, Solvable *solvable1, Solvable *solvable2 )
181{ return VendorAttr::instance().relaxedEquivalent( IdString(solvable1->vendor), IdString(solvable2->vendor) ) ? 0 : 1; }
182
187void 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
228inline 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
246std::ostream &
247SATResolver::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
288SATResolver::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
316SATResolver::~SATResolver()
317{
318 solverEnd();
319}
320
321//---------------------------------------------------------------------------
322
323ResPool
324SATResolver::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
334static 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
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 {
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
421private:
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
467bool
468SATResolver::solving(const CapabilitySet & requires_caps,
469 const CapabilitySet & conflict_caps)
470{
471 if (_fixsystem) {
472 queue_push( &(_jobQueue), SOLVER_VERIFY|SOLVER_SOLVABLE_ALL);
473 queue_push( &(_jobQueue), 0 );
474 }
475 if (_updatesystem) {
476 queue_push( &(_jobQueue), SOLVER_UPDATE|SOLVER_SOLVABLE_ALL);
477 queue_push( &(_jobQueue), 0 );
478 }
479 if (_distupgrade) {
480 queue_push( &(_jobQueue), SOLVER_DISTUPGRADE|SOLVER_SOLVABLE_ALL);
481 queue_push( &(_jobQueue), 0 );
482 }
483 if (_distupgrade_removeunsupported) {
484 queue_push( &(_jobQueue), SOLVER_DROP_ORPHANED|SOLVER_SOLVABLE_ALL);
485 queue_push( &(_jobQueue), 0 );
486 }
487 solverSetFocus( *_satSolver, _focus );
488 solver_set_flag(_satSolver, SOLVER_FLAG_ADD_ALREADY_RECOMMENDED, !_ignorealreadyrecommended);
489 solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_DOWNGRADE, _allowdowngrade);
490 solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_NAMECHANGE, _allownamechange);
491 solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_ARCHCHANGE, _allowarchchange);
492 solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_VENDORCHANGE, _allowvendorchange);
493 solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_UNINSTALL, _allowuninstall);
494 solver_set_flag(_satSolver, SOLVER_FLAG_NO_UPDATEPROVIDE, _noupdateprovide);
495 solver_set_flag(_satSolver, SOLVER_FLAG_SPLITPROVIDES, _dosplitprovides);
496 solver_set_flag(_satSolver, SOLVER_FLAG_IGNORE_RECOMMENDED, false); // resolve recommended namespaces
497 solver_set_flag(_satSolver, SOLVER_FLAG_ONLY_NAMESPACE_RECOMMENDED, _onlyRequires); //
498 solver_set_flag(_satSolver, SOLVER_FLAG_DUP_ALLOW_DOWNGRADE, _dup_allowdowngrade );
499 solver_set_flag(_satSolver, SOLVER_FLAG_DUP_ALLOW_NAMECHANGE, _dup_allownamechange );
500 solver_set_flag(_satSolver, SOLVER_FLAG_DUP_ALLOW_ARCHCHANGE, _dup_allowarchchange );
501 solver_set_flag(_satSolver, SOLVER_FLAG_DUP_ALLOW_VENDORCHANGE, _dup_allowvendorchange );
502
504
505 // Solve !
506 MIL << "Starting solving...." << endl;
507 MIL << *this;
508 if ( solver_solve( _satSolver, &(_jobQueue) ) == 0 )
509 {
510 // bsc#1155819: Weakremovers of future product not evaluated.
511 // Do a 2nd run to cleanup weakremovers() of to be installed
512 // Produtcs unless removeunsupported is active (cleans up all).
513 if ( _distupgrade )
514 {
515 if ( _distupgrade_removeunsupported )
516 MIL << "Droplist processing not needed. RemoveUnsupported is On." << endl;
517 else if ( ! ZConfig::instance().solverUpgradeRemoveDroppedPackages() )
518 MIL << "Droplist processing is disabled in ZConfig." << endl;
519 else
520 {
521 bool resolve = false;
522 MIL << "Checking droplists ..." << endl;
523 // get Solvables to be installed...
524 sat::SolvableQueue decisionq;
525 solver_get_decisionqueue( _satSolver, decisionq );
526 for ( sat::detail::IdType id : decisionq )
527 {
528 if ( id < 0 )
529 continue;
530 sat::Solvable slv { (sat::detail::SolvableIdType)id };
531 // get product buddies (they carry the weakremover)...
532 static const Capability productCap { "product()" };
533 if ( slv && slv.provides().matches( productCap ) )
534 {
535 CapabilitySet droplist { slv.valuesOfNamespace( "weakremover" ) };
536 MIL << "Droplist for " << slv << ": size " << droplist.size() << endl;
537 if ( !droplist.empty() )
538 {
539 for ( const auto & cap : droplist )
540 {
541 queue_push( &_jobQueue, SOLVER_DROP_ORPHANED | SOLVER_SOLVABLE_NAME );
542 queue_push( &_jobQueue, cap.id() );
543 }
544 // PIN product - a safety net to prevent cleanup from changing the decision for this product
545 queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE );
546 queue_push( &(_jobQueue), id );
547 resolve = true;
548 }
549 }
550 }
551 if ( resolve )
552 solver_solve( _satSolver, &(_jobQueue) );
553 }
554 }
555 }
556 MIL << "....Solver end" << endl;
557
558 // copying solution back to zypp pool
559 //-----------------------------------------
560 _result_items_to_install.clear();
561 _result_items_to_remove.clear();
562
563 /* solvables to be installed */
564 Queue decisionq;
565 queue_init(&decisionq);
566 solver_get_decisionqueue(_satSolver, &decisionq);
567 for ( int i = 0; i < decisionq.count; ++i )
568 {
569 Id p = decisionq.elements[i];
570 if ( p < 0 )
571 continue;
572
573 sat::Solvable slv { (sat::detail::SolvableIdType)p };
574 if ( ! slv || slv.isSystem() )
575 continue;
576
577 PoolItem poolItem( slv );
579 _result_items_to_install.push_back( poolItem );
580 }
581 queue_free(&decisionq);
582
583 /* solvables to be erased */
584 Repository systemRepo( sat::Pool::instance().findSystemRepo() ); // don't create if it does not exist
585 if ( systemRepo && ! systemRepo.solvablesEmpty() )
586 {
587 bool mustCheckObsoletes = false;
588 for_( it, systemRepo.solvablesBegin(), systemRepo.solvablesEnd() )
589 {
590 if (solver_get_decisionlevel(_satSolver, it->id()) > 0)
591 continue;
592
593 // Check if this is an update
594 CheckIfUpdate info( *it );
595 PoolItem poolItem( *it );
596 invokeOnEach( _pool.byIdentBegin( poolItem ),
597 _pool.byIdentEnd( poolItem ),
598 resfilter::ByUninstalled(), // ByUninstalled
599 functor::functorRef<bool,PoolItem> (info) );
600
601 if (info.is_updated) {
603 } else {
605 if ( ! mustCheckObsoletes )
606 mustCheckObsoletes = true; // lazy check for UninstalledDueToObsolete
607 }
608 _result_items_to_remove.push_back (poolItem);
609 }
610 if ( mustCheckObsoletes )
611 {
612 sat::WhatObsoletes obsoleted( _result_items_to_install.begin(), _result_items_to_install.end() );
613 for_( it, obsoleted.poolItemBegin(), obsoleted.poolItemEnd() )
614 {
615 ResStatus & status( it->status() );
616 // WhatObsoletes contains installed items only!
617 if ( status.transacts() && ! status.isToBeUninstalledDueToUpgrade() )
618 status.setToBeUninstalledDueToObsolete();
619 }
620 }
621 }
622
623 // copy back computed status values to pool
624 // (on the fly cache orphaned items for the UI)
625 solverCopyBackWeak( *_satSolver, _problem_items );
626 solverCopyBackValidate( *_satSolver, _pool );
627
628 // Solvables which were selected due requirements which have been made by the user will
629 // be selected by APPL_LOW. We can't use any higher level, because this setting must
630 // not serve as a request for the next solver run. APPL_LOW is reset before solving.
631 for (CapabilitySet::const_iterator iter = requires_caps.begin(); iter != requires_caps.end(); iter++) {
632 sat::WhatProvides rpmProviders(*iter);
633 for_( iter2, rpmProviders.begin(), rpmProviders.end() ) {
634 PoolItem poolItem(*iter2);
635 if (poolItem.status().isToBeInstalled()) {
636 MIL << "User requirement " << *iter << " sets " << poolItem << endl;
637 poolItem.status().setTransactByValue (ResStatus::APPL_LOW);
638 }
639 }
640 }
641 for (CapabilitySet::const_iterator iter = conflict_caps.begin(); iter != conflict_caps.end(); iter++) {
642 sat::WhatProvides rpmProviders(*iter);
643 for_( iter2, rpmProviders.begin(), rpmProviders.end() ) {
644 PoolItem poolItem(*iter2);
645 if (poolItem.status().isToBeUninstalled()) {
646 MIL << "User conflict " << *iter << " sets " << poolItem << endl;
647 poolItem.status().setTransactByValue (ResStatus::APPL_LOW);
648 }
649 }
650 }
651
652 if (solver_problem_count(_satSolver) > 0 )
653 {
654 ERR << "Solverrun finished with an ERROR" << endl;
655 return false;
656 }
657
658 return true;
659}
660
661
662void
663SATResolver::solverInit(const PoolItemList & weakItems)
664{
665
666 MIL << "SATResolver::solverInit()" << endl;
667
668 // remove old stuff
669 solverEnd();
670 _satSolver = solver_create( _satPool );
671 {
672 // bsc#1182629: in dup allow an available -release package providing 'dup-vendor-relax(suse)'
673 // to let (suse/opensuse) vendor being treated as being equivalent.
674 bool toRelax = false;
675 if ( _distupgrade ) {
676 for ( sat::Solvable solv : sat::WhatProvides( Capability("dup-vendor-relax(suse)") ) ) {
677 if ( ! solv.isSystem() ) {
678 MIL << "Relaxed vendor check requested by " << solv << endl;
679 toRelax = true;
680 break;
681 }
682 }
683 }
684 ::pool_set_custom_vendorcheck( _satPool, toRelax ? &relaxedVendorCheck : &vendorCheck );
685 }
686
687 queue_init( &_jobQueue );
688
689 // clear and rebuild: _items_to_install, _items_to_remove, _items_to_lock, _items_to_keep
690 {
691 SATCollectTransact collector( _items_to_install, _items_to_remove, _items_to_lock, _items_to_keep, solveSrcPackages() );
692 invokeOnEach ( _pool.begin(), _pool.end(), functor::functorRef<bool,PoolItem>( collector ) );
693 }
694
695 for (PoolItemList::const_iterator iter = weakItems.begin(); iter != weakItems.end(); iter++) {
696 Id id = (*iter)->satSolvable().id();
697 if (id == ID_NULL) {
698 ERR << "Weaken: " << *iter << " not found" << endl;
699 }
700 MIL << "Weaken dependencies of " << *iter << endl;
701 queue_push( &(_jobQueue), SOLVER_WEAKENDEPS | SOLVER_SOLVABLE );
702 queue_push( &(_jobQueue), id );
703 }
704
705 // Ad rules for retracted patches and packages
706 {
707 queue_push( &(_jobQueue), SOLVER_BLACKLIST|SOLVER_SOLVABLE_PROVIDES );
708 queue_push( &(_jobQueue), sat::Solvable::retractedToken.id() );
709 queue_push( &(_jobQueue), SOLVER_BLACKLIST|SOLVER_SOLVABLE_PROVIDES );
710 queue_push( &(_jobQueue), sat::Solvable::ptfMasterToken.id() );
711 // bsc#1186503: ptfPackageToken should not be blacklisted
712 }
713
714 // Ad rules for changed requestedLocales
715 {
716 const auto & trackedLocaleIds( myPool().trackedLocaleIds() );
717
718 // just track changed locakes
719 for ( const auto & locale : trackedLocaleIds.added() )
720 {
721 queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES );
722 queue_push( &(_jobQueue), Capability( ResolverNamespace::language, IdString(locale) ).id() );
723 }
724
725 for ( const auto & locale : trackedLocaleIds.removed() )
726 {
727 queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES | SOLVER_CLEANDEPS ); // needs uncond. SOLVER_CLEANDEPS!
728 queue_push( &(_jobQueue), Capability( ResolverNamespace::language, IdString(locale) ).id() );
729 }
730 }
731
732 // Add rules for parallel installable resolvables with different versions
733 for ( const sat::Solvable & solv : myPool().multiversionList() )
734 {
735 queue_push( &(_jobQueue), SOLVER_NOOBSOLETES | SOLVER_SOLVABLE );
736 queue_push( &(_jobQueue), solv.id() );
737 }
738
739 ::pool_add_userinstalled_jobs(_satPool, sat::Pool::instance().autoInstalled(), &(_jobQueue), GET_USERINSTALLED_NAMES|GET_USERINSTALLED_INVERTED);
740}
741
742void
743SATResolver::solverEnd()
744{
745 // cleanup
746 if ( _satSolver )
747 {
748 solver_free(_satSolver);
749 _satSolver = NULL;
750 queue_free( &(_jobQueue) );
751 }
752}
753
754
755bool
756SATResolver::resolvePool(const CapabilitySet & requires_caps,
757 const CapabilitySet & conflict_caps,
758 const PoolItemList & weakItems,
759 const std::set<Repository> & upgradeRepos)
760{
761 MIL << "SATResolver::resolvePool()" << endl;
762
763 // initialize
764 solverInit(weakItems);
765
766 for (PoolItemList::const_iterator iter = _items_to_install.begin(); iter != _items_to_install.end(); iter++) {
767 Id id = (*iter)->satSolvable().id();
768 if (id == ID_NULL) {
769 ERR << "Install: " << *iter << " not found" << endl;
770 } else {
771 MIL << "Install " << *iter << endl;
772 queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE );
773 queue_push( &(_jobQueue), id );
774 }
775 }
776
777 for (PoolItemList::const_iterator iter = _items_to_remove.begin(); iter != _items_to_remove.end(); iter++) {
778 Id id = (*iter)->satSolvable().id();
779 if (id == ID_NULL) {
780 ERR << "Delete: " << *iter << " not found" << endl;
781 } else {
782 MIL << "Delete " << *iter << endl;
783 queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE | MAYBE_CLEANDEPS );
784 queue_push( &(_jobQueue), id);
785 }
786 }
787
788 for_( iter, upgradeRepos.begin(), upgradeRepos.end() )
789 {
790 queue_push( &(_jobQueue), SOLVER_DISTUPGRADE | SOLVER_SOLVABLE_REPO );
791 queue_push( &(_jobQueue), iter->get()->repoid );
792 MIL << "Upgrade repo " << *iter << endl;
793 }
794
795 for (CapabilitySet::const_iterator iter = requires_caps.begin(); iter != requires_caps.end(); iter++) {
796 queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES );
797 queue_push( &(_jobQueue), iter->id() );
798 MIL << "Requires " << *iter << endl;
799 }
800
801 for (CapabilitySet::const_iterator iter = conflict_caps.begin(); iter != conflict_caps.end(); iter++) {
802 queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES | MAYBE_CLEANDEPS );
803 queue_push( &(_jobQueue), iter->id() );
804 MIL << "Conflicts " << *iter << endl;
805 }
806
807 // set requirements for a running system
808 setSystemRequirements();
809
810 // set locks for the solver
811 setLocks();
812
813 // solving
814 bool ret = solving(requires_caps, conflict_caps);
815
816 (ret?MIL:WAR) << "SATResolver::resolvePool() done. Ret:" << ret << endl;
817 return ret;
818}
819
820
821bool
822SATResolver::resolveQueue(const SolverQueueItemList &requestQueue,
823 const PoolItemList & weakItems)
824{
825 MIL << "SATResolver::resolvQueue()" << endl;
826
827 // initialize
828 solverInit(weakItems);
829
830 // generate solver queue
831 for (SolverQueueItemList::const_iterator iter = requestQueue.begin(); iter != requestQueue.end(); iter++) {
832 (*iter)->addRule(_jobQueue);
833 }
834
835 // Add addition item status to the resolve-queue cause these can be set by problem resolutions
836 for (PoolItemList::const_iterator iter = _items_to_install.begin(); iter != _items_to_install.end(); iter++) {
837 Id id = (*iter)->satSolvable().id();
838 if (id == ID_NULL) {
839 ERR << "Install: " << *iter << " not found" << endl;
840 } else {
841 MIL << "Install " << *iter << endl;
842 queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE );
843 queue_push( &(_jobQueue), id );
844 }
845 }
846 for (PoolItemList::const_iterator iter = _items_to_remove.begin(); iter != _items_to_remove.end(); iter++) {
847 sat::detail::IdType ident( (*iter)->satSolvable().ident().id() );
848 MIL << "Delete " << *iter << ident << endl;
849 queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_NAME | MAYBE_CLEANDEPS );
850 queue_push( &(_jobQueue), ident);
851 }
852
853 // set requirements for a running system
854 setSystemRequirements();
855
856 // set locks for the solver
857 setLocks();
858
859 // solving
860 bool ret = solving();
861
862 MIL << "SATResolver::resolveQueue() done. Ret:" << ret << endl;
863 return ret;
864}
865
867void SATResolver::doUpdate()
868{
869 MIL << "SATResolver::doUpdate()" << endl;
870
871 // initialize
872 solverInit(PoolItemList());
873
874 // set requirements for a running system
875 setSystemRequirements();
876
877 // set locks for the solver
878 setLocks();
879
880 if (_fixsystem) {
881 queue_push( &(_jobQueue), SOLVER_VERIFY|SOLVER_SOLVABLE_ALL);
882 queue_push( &(_jobQueue), 0 );
883 }
884 if (1) {
885 queue_push( &(_jobQueue), SOLVER_UPDATE|SOLVER_SOLVABLE_ALL);
886 queue_push( &(_jobQueue), 0 );
887 }
888 if (_distupgrade) {
889 queue_push( &(_jobQueue), SOLVER_DISTUPGRADE|SOLVER_SOLVABLE_ALL);
890 queue_push( &(_jobQueue), 0 );
891 }
892 if (_distupgrade_removeunsupported) {
893 queue_push( &(_jobQueue), SOLVER_DROP_ORPHANED|SOLVER_SOLVABLE_ALL);
894 queue_push( &(_jobQueue), 0 );
895 }
896 solverSetFocus( *_satSolver, _focus );
897 solver_set_flag(_satSolver, SOLVER_FLAG_ADD_ALREADY_RECOMMENDED, !_ignorealreadyrecommended);
898 solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_DOWNGRADE, _allowdowngrade);
899 solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_NAMECHANGE, _allownamechange);
900 solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_ARCHCHANGE, _allowarchchange);
901 solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_VENDORCHANGE, _allowvendorchange);
902 solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_UNINSTALL, _allowuninstall);
903 solver_set_flag(_satSolver, SOLVER_FLAG_NO_UPDATEPROVIDE, _noupdateprovide);
904 solver_set_flag(_satSolver, SOLVER_FLAG_SPLITPROVIDES, _dosplitprovides);
905 solver_set_flag(_satSolver, SOLVER_FLAG_IGNORE_RECOMMENDED, false); // resolve recommended namespaces
906 solver_set_flag(_satSolver, SOLVER_FLAG_ONLY_NAMESPACE_RECOMMENDED, _onlyRequires); //
907
909
910 // Solve !
911 MIL << "Starting solving for update...." << endl;
912 MIL << *this;
913 solver_solve( _satSolver, &(_jobQueue) );
914 MIL << "....Solver end" << endl;
915
916 // copying solution back to zypp pool
917 //-----------------------------------------
918
919 /* solvables to be installed */
920 Queue decisionq;
921 queue_init(&decisionq);
922 solver_get_decisionqueue(_satSolver, &decisionq);
923 for (int i = 0; i < decisionq.count; i++)
924 {
925 Id p = decisionq.elements[i];
926 if ( p < 0 )
927 continue;
928
929 sat::Solvable solv { (sat::detail::SolvableIdType)p };
930 if ( ! solv || solv.isSystem() )
931 continue;
932
934 }
935 queue_free(&decisionq);
936
937 /* solvables to be erased */
938 if ( _satSolver->pool->installed ) {
939 for (int i = _satSolver->pool->installed->start; i < _satSolver->pool->installed->start + _satSolver->pool->installed->nsolvables; i++)
940 {
941 if (solver_get_decisionlevel(_satSolver, i) > 0)
942 continue;
943
944 PoolItem poolItem( _pool.find( sat::Solvable(i) ) );
945 if (poolItem) {
946 // Check if this is an update
947 CheckIfUpdate info( (sat::Solvable(i)) );
948 invokeOnEach( _pool.byIdentBegin( poolItem ),
949 _pool.byIdentEnd( poolItem ),
950 resfilter::ByUninstalled(), // ByUninstalled
951 functor::functorRef<bool,PoolItem> (info) );
952
953 if (info.is_updated) {
955 } else {
957 }
958 } else {
959 ERR << "id " << i << " not found in ZYPP pool." << endl;
960 }
961 }
962 }
963
964 // copy back computed status values to pool
965 // (on the fly cache orphaned items for the UI)
966 solverCopyBackWeak( *_satSolver, _problem_items );
967 solverCopyBackValidate( *_satSolver, _pool );
968
969 MIL << "SATResolver::doUpdate() done" << endl;
970}
971
972
973
974//----------------------------------------------------------------------------
975//----------------------------------------------------------------------------
976// error handling
977//----------------------------------------------------------------------------
978//----------------------------------------------------------------------------
979
980//----------------------------------------------------------------------------
981// helper function
982//----------------------------------------------------------------------------
983
985{
986 ProblemSolutionCombi *problemSolution;
987 TransactionKind action;
988 FindPackage (ProblemSolutionCombi *p, const TransactionKind act)
989 : problemSolution (p)
990 , action (act)
991 {
992 }
993
995 {
996 problemSolution->addSingleAction (p, action);
997 return true;
998 }
999};
1000
1001
1002//----------------------------------------------------------------------------
1003// Checking if this solvable/item has a buddy which reflect the real
1004// user visible description of an item
1005// e.g. The release package has a buddy to the concerning product item.
1006// This user want's the message "Product foo conflicts with product bar" and
1007// NOT "package release-foo conflicts with package release-bar"
1008// (ma: that's why we should map just packages to buddies, not vice versa)
1009//----------------------------------------------------------------------------
1010inline sat::Solvable mapBuddy( const PoolItem & item_r )
1011{
1012 if ( item_r.satSolvable().isKind<Package>() )
1013 {
1014 sat::Solvable buddy = item_r.buddy();
1015 if ( buddy )
1016 return buddy;
1017 }
1018 return item_r.satSolvable();
1019}
1021{ return mapBuddy( PoolItem( item_r ) ); }
1022
1023PoolItem SATResolver::mapItem ( const PoolItem & item )
1024{ return PoolItem( mapBuddy( item ) ); }
1025
1026sat::Solvable SATResolver::mapSolvable ( const Id & id )
1027{ return mapBuddy( sat::Solvable(id) ); }
1028
1029std::vector<std::string> SATResolver::SATgetCompleteProblemInfoStrings ( Id problem )
1030{
1031 std::vector<std::string> ret;
1032 sat::Queue problems;
1033 solver_findallproblemrules( _satSolver, problem, problems );
1034
1035 bool nobad = false;
1036
1037 //filter out generic rule information if more explicit ones are available
1038 for ( sat::Queue::size_type i = 0; i < problems.size(); i++ ) {
1039 SolverRuleinfo ruleClass = solver_ruleclass( _satSolver, problems[i]);
1040 if ( ruleClass != SolverRuleinfo::SOLVER_RULE_UPDATE && ruleClass != SolverRuleinfo::SOLVER_RULE_JOB ) {
1041 nobad = true;
1042 break;
1043 }
1044 }
1045 for ( sat::Queue::size_type i = 0; i < problems.size(); i++ ) {
1046 SolverRuleinfo ruleClass = solver_ruleclass( _satSolver, problems[i]);
1047 if ( nobad && ( ruleClass == SolverRuleinfo::SOLVER_RULE_UPDATE || ruleClass == SolverRuleinfo::SOLVER_RULE_JOB ) ) {
1048 continue;
1049 }
1050
1051 std::string detail;
1052 Id ignore = 0;
1053 std::string pInfo = SATproblemRuleInfoString( problems[i], detail, ignore );
1054
1055 //we get the same string multiple times, reduce the noise
1056 if ( std::find( ret.begin(), ret.end(), pInfo ) == ret.end() )
1057 ret.push_back( pInfo );
1058 }
1059 return ret;
1060}
1061
1062std::string SATResolver::SATprobleminfoString(Id problem, std::string &detail, Id &ignoreId)
1063{
1064 // FIXME: solver_findallproblemrules to get all rules for this problem
1065 // (the 'most relevabt' one returned by solver_findproblemrule is embedded
1066 Id probr = solver_findproblemrule(_satSolver, problem);
1067 return SATproblemRuleInfoString( probr, detail, ignoreId );
1068}
1069
1070std::string SATResolver::SATproblemRuleInfoString (Id probr, std::string &detail, Id &ignoreId)
1071{
1072 std::string ret;
1073 sat::detail::CPool *pool = _satSolver->pool;
1074 Id dep, source, target;
1075 SolverRuleinfo type = solver_ruleinfo(_satSolver, probr, &source, &target, &dep);
1076
1077 ignoreId = 0;
1078
1079 sat::Solvable s = mapSolvable( source );
1080 sat::Solvable s2 = mapSolvable( target );
1081
1082 // @FIXME, these strings are a duplicate copied from the libsolv library
1083 // to provide translations. Instead of having duplicate code we should
1084 // translate those strings directly in libsolv
1085 switch ( type )
1086 {
1087 case SOLVER_RULE_DISTUPGRADE:
1088 if ( s.isSystem() )
1089 ret = str::Format(_("the installed %1% does not belong to a distupgrade repository and must be replaced") ) % s.asString();
1090 else /*just in case*/
1091 ret = str::Format(_("the to be installed %1% does not belong to a distupgrade repository") ) % s.asString();
1092 break;
1093 case SOLVER_RULE_INFARCH:
1094 if ( s.isSystem() )
1095 ret = str::Format(_("the installed %1% has inferior architecture") ) % s.asString();
1096 else
1097 ret = str::Format(_("the to be installed %1% has inferior architecture") ) % s.asString();
1098 break;
1099 case SOLVER_RULE_UPDATE:
1100 ret = str::Format(_("problem with the installed %1%") ) % s.asString();
1101 break;
1102 case SOLVER_RULE_JOB:
1103 ret = _("conflicting requests");
1104 break;
1105 case SOLVER_RULE_PKG:
1106 ret = _("some dependency problem");
1107 break;
1108 case SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP:
1109 ret = str::Format(_("nothing provides the requested '%1%'") ) % pool_dep2str(pool, dep);
1110 detail += _("Have you enabled all the required repositories?");
1111 break;
1112 case SOLVER_RULE_JOB_UNKNOWN_PACKAGE:
1113 ret = str::Format(_("the requested package %1% does not exist") ) % pool_dep2str(pool, dep);
1114 detail += _("Have you enabled all the required repositories?");
1115 break;
1116 case SOLVER_RULE_JOB_UNSUPPORTED:
1117 ret = _("unsupported request");
1118 break;
1119 case SOLVER_RULE_JOB_PROVIDED_BY_SYSTEM:
1120 ret = str::Format(_("'%1%' is provided by the system and cannot be erased") ) % pool_dep2str(pool, dep);
1121 break;
1122 case SOLVER_RULE_PKG_NOT_INSTALLABLE:
1123 ret = str::Format(_("%1% is not installable") ) % s.asString();
1124 break;
1125 case SOLVER_RULE_PKG_NOTHING_PROVIDES_DEP:
1126 ignoreId = source; // for setting weak dependencies
1127 if ( s.isSystem() )
1128 ret = str::Format(_("nothing provides '%1%' needed by the installed %2%") ) % pool_dep2str(pool, dep) % s.asString();
1129 else
1130 ret = str::Format(_("nothing provides '%1%' needed by the to be installed %2%") ) % pool_dep2str(pool, dep) % s.asString();
1131 break;
1132 case SOLVER_RULE_PKG_SAME_NAME:
1133 ret = str::Format(_("cannot install both %1% and %2%") ) % s.asString() % s2.asString();
1134 break;
1135 case SOLVER_RULE_PKG_CONFLICTS:
1136 if ( s.isSystem() ) {
1137 if ( s2.isSystem() )
1138 ret = str::Format(_("the installed %1% conflicts with '%2%' provided by the installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
1139 else
1140 ret = str::Format(_("the installed %1% conflicts with '%2%' provided by the to be installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
1141 }
1142 else {
1143 if ( s2.isSystem() )
1144 ret = str::Format(_("the to be installed %1% conflicts with '%2%' provided by the installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
1145 else
1146 ret = str::Format(_("the to be installed %1% conflicts with '%2%' provided by the to be installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
1147 }
1148 break;
1149 case SOLVER_RULE_PKG_OBSOLETES:
1150 case SOLVER_RULE_PKG_INSTALLED_OBSOLETES:
1151 if ( s.isSystem() ) {
1152 if ( s2.isSystem() )
1153 ret = str::Format(_("the installed %1% obsoletes '%2%' provided by the installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
1154 else
1155 ret = str::Format(_("the installed %1% obsoletes '%2%' provided by the to be installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
1156 }
1157 else {
1158 if ( s2.isSystem() )
1159 ret = str::Format(_("the to be installed %1% obsoletes '%2%' provided by the installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
1160 else
1161 ret = str::Format(_("the to be installed %1% obsoletes '%2%' provided by the to be installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
1162 }
1163 break;
1164 case SOLVER_RULE_PKG_SELF_CONFLICT:
1165 if ( s.isSystem() )
1166 ret = str::Format(_("the installed %1% conflicts with '%2%' provided by itself") ) % s.asString() % pool_dep2str(pool, dep);
1167 else
1168 ret = str::Format(_("the to be installed %1% conflicts with '%2%' provided by itself") ) % s.asString() % pool_dep2str(pool, dep);
1169 break;
1170 case SOLVER_RULE_PKG_REQUIRES: {
1171 ignoreId = source; // for setting weak dependencies
1172 Capability cap(dep);
1173 sat::WhatProvides possibleProviders(cap);
1174
1175 // check, if a provider will be deleted
1176 typedef std::list<PoolItem> ProviderList;
1177 ProviderList providerlistInstalled, providerlistUninstalled;
1178 for_( iter1, possibleProviders.begin(), possibleProviders.end() ) {
1179 PoolItem provider1 = ResPool::instance().find( *iter1 );
1180 // find pair of an installed/uninstalled item with the same NVR
1181 bool found = false;
1182 for_( iter2, possibleProviders.begin(), possibleProviders.end() ) {
1183 PoolItem provider2 = ResPool::instance().find( *iter2 );
1184 if (compareByNVR (provider1,provider2) == 0
1185 && ( (provider1.status().isInstalled() && provider2.status().isUninstalled())
1186 || (provider2.status().isInstalled() && provider1.status().isUninstalled()) )) {
1187 found = true;
1188 break;
1189 }
1190 }
1191 if (!found) {
1192 if (provider1.status().isInstalled())
1193 providerlistInstalled.push_back(provider1);
1194 else
1195 providerlistUninstalled.push_back(provider1);
1196 }
1197 }
1198
1199 if ( s.isSystem() )
1200 ret = str::Format(_("the installed %1% requires '%2%', but this requirement cannot be provided") ) % s.asString() % pool_dep2str(pool, dep);
1201 else
1202 ret = str::Format(_("the to be installed %1% requires '%2%', but this requirement cannot be provided") ) % s.asString() % pool_dep2str(pool, dep);
1203 if (providerlistInstalled.size() > 0) {
1204 detail += _("deleted providers: ");
1205 for (ProviderList::const_iterator iter = providerlistInstalled.begin(); iter != providerlistInstalled.end(); iter++) {
1206 if (iter == providerlistInstalled.begin())
1207 detail += itemToString( *iter );
1208 else
1209 detail += "\n " + itemToString( mapItem(*iter) );
1210 }
1211 }
1212 if (providerlistUninstalled.size() > 0) {
1213 if (detail.size() > 0)
1214 detail += _("\nnot installable providers: ");
1215 else
1216 detail = _("not installable providers: ");
1217 for (ProviderList::const_iterator iter = providerlistUninstalled.begin(); iter != providerlistUninstalled.end(); iter++) {
1218 if (iter == providerlistUninstalled.begin())
1219 detail += itemToString( *iter );
1220 else
1221 detail += "\n " + itemToString( mapItem(*iter) );
1222 }
1223 }
1224 break;
1225 }
1226 default: {
1227 DBG << "Unknown rule type(" << type << ") going to query libsolv for rule information." << endl;
1228 ret = str::asString( ::solver_problemruleinfo2str( _satSolver, type, static_cast<Id>(s.id()), static_cast<Id>(s2.id()), dep ) );
1229 break;
1230 }
1231 }
1232 return ret;
1233}
1234
1236SATResolver::problems ()
1237{
1238 ResolverProblemList resolverProblems;
1239 if (_satSolver && solver_problem_count(_satSolver)) {
1240 sat::detail::CPool *pool = _satSolver->pool;
1241 int pcnt;
1242 Id p, rp, what;
1243 Id problem, solution, element;
1244 sat::Solvable s, sd;
1245
1246 CapabilitySet system_requires = SystemCheck::instance().requiredSystemCap();
1247 CapabilitySet system_conflicts = SystemCheck::instance().conflictSystemCap();
1248
1249 MIL << "Encountered problems! Here are the solutions:\n" << endl;
1250 pcnt = 1;
1251 problem = 0;
1252 while ((problem = solver_next_problem(_satSolver, problem)) != 0) {
1253 MIL << "Problem " << pcnt++ << ":" << endl;
1254 MIL << "====================================" << endl;
1255 std::string detail;
1256 Id ignoreId;
1257 std::string whatString = SATprobleminfoString (problem,detail,ignoreId);
1258 MIL << whatString << endl;
1259 MIL << "------------------------------------" << endl;
1260 ResolverProblem_Ptr resolverProblem = new ResolverProblem (whatString, detail, SATgetCompleteProblemInfoStrings( problem ));
1261
1262 solution = 0;
1263 while ((solution = solver_next_solution(_satSolver, problem, solution)) != 0) {
1264 element = 0;
1265 ProblemSolutionCombi *problemSolution = new ProblemSolutionCombi;
1266 while ((element = solver_next_solutionelement(_satSolver, problem, solution, element, &p, &rp)) != 0) {
1267 if (p == SOLVER_SOLUTION_JOB) {
1268 /* job, rp is index into job queue */
1269 what = _jobQueue.elements[rp];
1270 switch (_jobQueue.elements[rp-1]&(SOLVER_SELECTMASK|SOLVER_JOBMASK))
1271 {
1272 case SOLVER_INSTALL | SOLVER_SOLVABLE: {
1273 s = mapSolvable (what);
1274 PoolItem poolItem = _pool.find (s);
1275 if (poolItem) {
1276 if (pool->installed && s.get()->repo == pool->installed) {
1277 problemSolution->addSingleAction (poolItem, REMOVE);
1278 std::string description = str::Format(_("remove lock to allow removal of %1%") ) % s.asString();
1279 MIL << description << endl;
1280 problemSolution->addDescription (description);
1281 } else {
1282 problemSolution->addSingleAction (poolItem, KEEP);
1283 std::string description = str::Format(_("do not install %1%") ) % s.asString();
1284 MIL << description << endl;
1285 problemSolution->addDescription (description);
1286 }
1287 } else {
1288 ERR << "SOLVER_INSTALL_SOLVABLE: No item found for " << s.asString() << endl;
1289 }
1290 }
1291 break;
1292 case SOLVER_ERASE | SOLVER_SOLVABLE: {
1293 s = mapSolvable (what);
1294 PoolItem poolItem = _pool.find (s);
1295 if (poolItem) {
1296 if (pool->installed && s.get()->repo == pool->installed) {
1297 problemSolution->addSingleAction (poolItem, KEEP);
1298 std::string description = str::Format(_("keep %1%") ) % s.asString();
1299 MIL << description << endl;
1300 problemSolution->addDescription (description);
1301 } else {
1302 problemSolution->addSingleAction (poolItem, UNLOCK);
1303 std::string description = str::Format(_("remove lock to allow installation of %1%") ) % itemToString( poolItem );
1304 MIL << description << endl;
1305 problemSolution->addDescription (description);
1306 }
1307 } else {
1308 ERR << "SOLVER_ERASE_SOLVABLE: No item found for " << s.asString() << endl;
1309 }
1310 }
1311 break;
1312 case SOLVER_INSTALL | SOLVER_SOLVABLE_NAME:
1313 {
1314 IdString ident( what );
1315 SolverQueueItemInstall_Ptr install =
1316 new SolverQueueItemInstall(_pool, ident.asString(), false );
1317 problemSolution->addSingleAction (install, REMOVE_SOLVE_QUEUE_ITEM);
1318
1319 std::string description = str::Format(_("do not install %1%") ) % ident;
1320 MIL << description << endl;
1321 problemSolution->addDescription (description);
1322 }
1323 break;
1324 case SOLVER_ERASE | SOLVER_SOLVABLE_NAME:
1325 {
1326 // As we do not know, if this request has come from resolvePool or
1327 // resolveQueue we will have to take care for both cases.
1328 IdString ident( what );
1329 FindPackage info (problemSolution, KEEP);
1330 invokeOnEach( _pool.byIdentBegin( ident ),
1331 _pool.byIdentEnd( ident ),
1332 functor::chain (resfilter::ByInstalled (), // ByInstalled
1333 resfilter::ByTransact ()), // will be deinstalled
1334 functor::functorRef<bool,PoolItem> (info) );
1335
1336 SolverQueueItemDelete_Ptr del =
1337 new SolverQueueItemDelete(_pool, ident.asString(), false );
1338 problemSolution->addSingleAction (del, REMOVE_SOLVE_QUEUE_ITEM);
1339
1340 std::string description = str::Format(_("keep %1%") ) % ident;
1341 MIL << description << endl;
1342 problemSolution->addDescription (description);
1343 }
1344 break;
1345 case SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES:
1346 {
1347 problemSolution->addSingleAction (Capability(what), REMOVE_EXTRA_REQUIRE);
1348 std::string description = "";
1349
1350 // Checking if this problem solution would break your system
1351 if (system_requires.find(Capability(what)) != system_requires.end()) {
1352 // Show a better warning
1353 resolverProblem->setDetails( resolverProblem->description() + "\n" + resolverProblem->details() );
1354 resolverProblem->setDescription(_("This request will break your system!"));
1355 description = _("ignore the warning of a broken system");
1356 description += std::string(" (requires:")+pool_dep2str(pool, what)+")";
1357 MIL << description << endl;
1358 problemSolution->addFrontDescription (description);
1359 } else {
1360 description = str::Format(_("do not ask to install a solvable providing %1%") ) % pool_dep2str(pool, what);
1361 MIL << description << endl;
1362 problemSolution->addDescription (description);
1363 }
1364 }
1365 break;
1366 case SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES:
1367 {
1368 problemSolution->addSingleAction (Capability(what), REMOVE_EXTRA_CONFLICT);
1369 std::string description = "";
1370
1371 // Checking if this problem solution would break your system
1372 if (system_conflicts.find(Capability(what)) != system_conflicts.end()) {
1373 // Show a better warning
1374 resolverProblem->setDetails( resolverProblem->description() + "\n" + resolverProblem->details() );
1375 resolverProblem->setDescription(_("This request will break your system!"));
1376 description = _("ignore the warning of a broken system");
1377 description += std::string(" (conflicts:")+pool_dep2str(pool, what)+")";
1378 MIL << description << endl;
1379 problemSolution->addFrontDescription (description);
1380
1381 } else {
1382 description = str::Format(_("do not ask to delete all solvables providing %1%") ) % pool_dep2str(pool, what);
1383 MIL << description << endl;
1384 problemSolution->addDescription (description);
1385 }
1386 }
1387 break;
1388 case SOLVER_UPDATE | SOLVER_SOLVABLE:
1389 {
1390 s = mapSolvable (what);
1391 PoolItem poolItem = _pool.find (s);
1392 if (poolItem) {
1393 if (pool->installed && s.get()->repo == pool->installed) {
1394 problemSolution->addSingleAction (poolItem, KEEP);
1395 std::string description = str::Format(_("do not install most recent version of %1%") ) % s.asString();
1396 MIL << description << endl;
1397 problemSolution->addDescription (description);
1398 } else {
1399 ERR << "SOLVER_INSTALL_SOLVABLE_UPDATE " << poolItem << " is not selected for installation" << endl;
1400 }
1401 } else {
1402 ERR << "SOLVER_INSTALL_SOLVABLE_UPDATE: No item found for " << s.asString() << endl;
1403 }
1404 }
1405 break;
1406 default:
1407 MIL << "- do something different" << endl;
1408 ERR << "No valid solution available" << endl;
1409 break;
1410 }
1411 } else if (p == SOLVER_SOLUTION_INFARCH) {
1412 s = mapSolvable (rp);
1413 PoolItem poolItem = _pool.find (s);
1414 if (pool->installed && s.get()->repo == pool->installed) {
1415 problemSolution->addSingleAction (poolItem, LOCK);
1416 std::string description = str::Format(_("keep %1% despite the inferior architecture") ) % s.asString();
1417 MIL << description << endl;
1418 problemSolution->addDescription (description);
1419 } else {
1420 problemSolution->addSingleAction (poolItem, INSTALL);
1421 std::string description = str::Format(_("install %1% despite the inferior architecture") ) % s.asString();
1422 MIL << description << endl;
1423 problemSolution->addDescription (description);
1424 }
1425 } else if (p == SOLVER_SOLUTION_DISTUPGRADE) {
1426 s = mapSolvable (rp);
1427 PoolItem poolItem = _pool.find (s);
1428 if (pool->installed && s.get()->repo == pool->installed) {
1429 problemSolution->addSingleAction (poolItem, LOCK);
1430 std::string description = str::Format(_("keep obsolete %1%") ) % s.asString();
1431 MIL << description << endl;
1432 problemSolution->addDescription (description);
1433 } else {
1434 problemSolution->addSingleAction (poolItem, INSTALL);
1435 std::string description = str::Format(_("install %1% from excluded repository") ) % s.asString();
1436 MIL << description << endl;
1437 problemSolution->addDescription (description);
1438 }
1439 } else if ( p == SOLVER_SOLUTION_BLACK ) {
1440 // Allow to install a blacklisted package (PTF, retracted,...).
1441 // For not-installed items only
1442 s = mapSolvable (rp);
1443 PoolItem poolItem = _pool.find (s);
1444
1445 problemSolution->addSingleAction (poolItem, INSTALL);
1446 std::string description;
1447 if ( s.isRetracted() ) {
1448 // translator: %1% is a package name
1449 description = str::Format(_("install %1% although it has been retracted")) % s.asString();
1450 } else if ( s.isPtf() ) {
1451 // translator: %1% is a package name
1452 description = str::Format(_("allow to install the PTF %1%")) % s.asString();
1453 } else {
1454 // translator: %1% is a package name
1455 description = str::Format(_("install %1% although it is blacklisted")) % s.asString();
1456 }
1457 MIL << description << endl;
1458 problemSolution->addDescription( description );
1459 } else if ( p > 0 ) {
1460 /* policy, replace p with rp */
1461 s = mapSolvable (p);
1462 PoolItem itemFrom = _pool.find (s);
1463 if (rp)
1464 {
1465 int gotone = 0;
1466
1467 sd = mapSolvable (rp);
1468 PoolItem itemTo = _pool.find (sd);
1469 if (itemFrom && itemTo) {
1470 problemSolution->addSingleAction (itemTo, INSTALL);
1471 int illegal = policy_is_illegal(_satSolver, s.get(), sd.get(), 0);
1472
1473 if ((illegal & POLICY_ILLEGAL_DOWNGRADE) != 0)
1474 {
1475 std::string description = str::Format(_("downgrade of %1% to %2%") ) % s.asString() % sd.asString();
1476 MIL << description << endl;
1477 problemSolution->addDescription (description);
1478 gotone = 1;
1479 }
1480 if ((illegal & POLICY_ILLEGAL_ARCHCHANGE) != 0)
1481 {
1482 std::string description = str::Format(_("architecture change of %1% to %2%") ) % s.asString() % sd.asString();
1483 MIL << description << endl;
1484 problemSolution->addDescription (description);
1485 gotone = 1;
1486 }
1487 if ((illegal & POLICY_ILLEGAL_VENDORCHANGE) != 0)
1488 {
1489 IdString s_vendor( s.vendor() );
1490 IdString sd_vendor( sd.vendor() );
1491 std::string description;
1492 if ( s == sd ) // FIXME? Actually .ident() must be eq. But the more verbose 'else' isn't bad either.
1493 description = str::Format(_("install %1% (with vendor change)\n %2% --> %3%") )
1494 % sd.asString()
1495 % ( s_vendor ? s_vendor.c_str() : " (no vendor) " )
1496 % ( sd_vendor ? sd_vendor.c_str() : " (no vendor) " );
1497 else
1498 description = str::Format(_("install %1% from vendor %2%\n replacing %3% from vendor %4%") )
1499 % sd.asString() % ( sd_vendor ? sd_vendor.c_str() : " (no vendor) " )
1500 % s.asString() % ( s_vendor ? s_vendor.c_str() : " (no vendor) " );
1501
1502 MIL << description << endl;
1503 problemSolution->addDescription (description);
1504 gotone = 1;
1505 }
1506 if (!gotone) {
1507 std::string description = str::Format(_("replacement of %1% with %2%") ) % s.asString() % sd.asString();
1508 MIL << description << endl;
1509 problemSolution->addDescription (description);
1510 }
1511 } else {
1512 ERR << s.asString() << " or " << sd.asString() << " not found" << endl;
1513 }
1514 }
1515 else
1516 {
1517 if (itemFrom) {
1518 std::string description = str::Format(_("deinstallation of %1%") ) % s.asString();
1519 MIL << description << endl;
1520 problemSolution->addDescription (description);
1521 problemSolution->addSingleAction (itemFrom, REMOVE);
1522 }
1523 }
1524 }
1525 else
1526 {
1527 INT << "Unknown solution " << p << endl;
1528 }
1529
1530 }
1531 resolverProblem->addSolution (problemSolution,
1532 problemSolution->actionCount() > 1 ? true : false); // Solutions with more than 1 action will be shown first.
1533 MIL << "------------------------------------" << endl;
1534 }
1535
1536 if (ignoreId > 0) {
1537 // There is a possibility to ignore this error by setting weak dependencies
1538 PoolItem item = _pool.find (sat::Solvable(ignoreId));
1539 ProblemSolutionIgnore *problemSolution = new ProblemSolutionIgnore(item);
1540 resolverProblem->addSolution (problemSolution,
1541 false); // Solutions will be shown at the end
1542 MIL << "ignore some dependencies of " << item << endl;
1543 MIL << "------------------------------------" << endl;
1544 }
1545
1546 // save problem
1547 resolverProblems.push_back (resolverProblem);
1548 }
1549 }
1550 return resolverProblems;
1551}
1552
1553void SATResolver::applySolutions( const ProblemSolutionList & solutions )
1554{ Resolver( _pool ).applySolutions( solutions ); }
1555
1556void SATResolver::setLocks()
1557{
1558 unsigned icnt = 0;
1559 unsigned acnt = 0;
1560
1561 for (PoolItemList::const_iterator iter = _items_to_lock.begin(); iter != _items_to_lock.end(); ++iter) {
1562 sat::detail::SolvableIdType ident( (*iter)->satSolvable().id() );
1563 if (iter->status().isInstalled()) {
1564 ++icnt;
1565 queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE );
1566 queue_push( &(_jobQueue), ident );
1567 } else {
1568 ++acnt;
1569 queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE | MAYBE_CLEANDEPS );
1570 queue_push( &(_jobQueue), ident );
1571 }
1572 }
1573 MIL << "Locked " << icnt << " installed items and " << acnt << " NOT installed items." << endl;
1574
1576 // Weak locks: Ignore if an item with this name is already installed.
1577 // If it's not installed try to keep it this way using a weak delete
1579 std::set<IdString> unifiedByName;
1580 for (PoolItemList::const_iterator iter = _items_to_keep.begin(); iter != _items_to_keep.end(); ++iter) {
1581 IdString ident( (*iter)->satSolvable().ident() );
1582 if ( unifiedByName.insert( ident ).second )
1583 {
1584 if ( ! ui::Selectable::get( *iter )->hasInstalledObj() )
1585 {
1586 MIL << "Keep NOT installed name " << ident << " (" << *iter << ")" << endl;
1587 queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_NAME | SOLVER_WEAK | MAYBE_CLEANDEPS );
1588 queue_push( &(_jobQueue), ident.id() );
1589 }
1590 }
1591 }
1592}
1593
1594void SATResolver::setSystemRequirements()
1595{
1596 CapabilitySet system_requires = SystemCheck::instance().requiredSystemCap();
1597 CapabilitySet system_conflicts = SystemCheck::instance().conflictSystemCap();
1598
1599 for (CapabilitySet::const_iterator iter = system_requires.begin(); iter != system_requires.end(); ++iter) {
1600 queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES );
1601 queue_push( &(_jobQueue), iter->id() );
1602 MIL << "SYSTEM Requires " << *iter << endl;
1603 }
1604
1605 for (CapabilitySet::const_iterator iter = system_conflicts.begin(); iter != system_conflicts.end(); ++iter) {
1606 queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES | MAYBE_CLEANDEPS );
1607 queue_push( &(_jobQueue), iter->id() );
1608 MIL << "SYSTEM Conflicts " << *iter << endl;
1609 }
1610
1611 // Lock the architecture of the running systems rpm
1612 // package on distupgrade.
1613 if ( _distupgrade && ZConfig::instance().systemRoot() == "/" )
1614 {
1615 ResPool pool( ResPool::instance() );
1616 IdString rpm( "rpm" );
1617 for_( it, pool.byIdentBegin(rpm), pool.byIdentEnd(rpm) )
1618 {
1619 if ( (*it)->isSystem() )
1620 {
1621 Capability archrule( (*it)->arch(), rpm.c_str(), Capability::PARSED );
1622 queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE_NAME | SOLVER_ESSENTIAL );
1623 queue_push( &(_jobQueue), archrule.id() );
1624
1625 }
1626 }
1627 }
1628}
1629
1630sat::StringQueue SATResolver::autoInstalled() const
1631{
1632 sat::StringQueue ret;
1633 if ( _satSolver )
1634 ::solver_get_userinstalled( _satSolver, ret, GET_USERINSTALLED_NAMES|GET_USERINSTALLED_INVERTED );
1635 return ret;
1636}
1637
1638sat::StringQueue SATResolver::userInstalled() const
1639{
1640 sat::StringQueue ret;
1641 if ( _satSolver )
1642 ::solver_get_userinstalled( _satSolver, ret, GET_USERINSTALLED_NAMES );
1643 return ret;
1644}
1645
1646
1648};// namespace detail
1651 };// namespace solver
1654};// namespace zypp
#define MAYBE_CLEANDEPS
Definition: SATResolver.cc:171
#define OUTS(X)
#define XDEBUG(x)
Definition: SATResolver.cc:58
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Definition: AutoDispose.h:94
Access to the sat-pools string space.
Definition: IdString.h:43
Package interface.
Definition: Package.h:33
Combining sat::Solvable and ResStatus.
Definition: PoolItem.h:51
ResStatus & status() const
Returns the current status.
Definition: PoolItem.cc:204
sat::Solvable buddy() const
Return the buddy we share our status object with.
Definition: PoolItem.cc:206
std::string alias() const
Short unique string to identify a repo.
Definition: Repository.cc:59
PoolItem find(const sat::Solvable &slv_r) const
Return the corresponding PoolItem.
Definition: ResPool.cc:73
static ResPool instance()
Singleton ctor.
Definition: ResPool.cc:37
Status bitfield.
Definition: ResStatus.h:54
static const ResStatus toBeInstalled
Definition: ResStatus.h:662
bool setToBeUninstalled(TransactByValue causer)
Definition: ResStatus.h:545
bool isByApplLow() const
Definition: ResStatus.h:293
bool isToBeInstalled() const
Definition: ResStatus.h:253
bool setToBeInstalled(TransactByValue causer)
Definition: ResStatus.h:531
void resetWeak()
Definition: ResStatus.h:197
TransactValue getTransactValue() const
Definition: ResStatus.h:279
static const ResStatus toBeUninstalledDueToUpgrade
Definition: ResStatus.h:664
static const ResStatus toBeUninstalled
Definition: ResStatus.h:663
bool isToBeUninstalled() const
Definition: ResStatus.h:261
bool isToBeUninstalledDueToUpgrade() const
Definition: ResStatus.h:318
bool resetTransact(TransactByValue causer_r)
Not the same as setTransact( false ).
Definition: ResStatus.h:485
bool isBySolver() const
Definition: ResStatus.h:290
bool setToBeUninstalledDueToUpgrade(TransactByValue causer)
Definition: ResStatus.h:569
bool isUninstalled() const
Definition: ResStatus.h:243
SrcPackage interface.
Definition: SrcPackage.h:30
bool equivalent(const Vendor &lVendor, const Vendor &rVendor) const
Return whether two vendor strings should be treated as the same vendor.
Definition: VendorAttr.cc:331
bool relaxedEquivalent(const Vendor &lVendor, const Vendor &rVendor) const
Like equivalent but always unifies suse and openSUSE vendor.
Definition: VendorAttr.cc:344
static const VendorAttr & instance()
(Pseudo)Singleton, mapped to the current Target::vendorAttr settings or to noTargetInstance.
Definition: VendorAttr.cc:230
static ZConfig & instance()
Singleton ctor.
Definition: Resolver.cc:126
static Pool instance()
Singleton ctor.
Definition: Pool.h:55
void prepare() const
Update housekeeping data if necessary (e.g.
Definition: Pool.cc:61
detail::CPool * get() const
Expert backdoor.
Definition: Pool.cc:49
Libsolv Id queue wrapper.
Definition: Queue.h:35
size_type size() const
Definition: Queue.cc:49
unsigned size_type
Definition: Queue.h:37
bool empty() const
Definition: Queue.cc:46
void push(value_type val_r)
Push a value to the end off the Queue.
Definition: Queue.cc:103
A Solvable object within the sat Pool.
Definition: Solvable.h:54
std::string asString() const
String representation "ident-edition.arch" or "noSolvable".
Definition: Solvable.cc:448
static const IdString ptfMasterToken
Indicator provides ptf()
Definition: Solvable.h:59
bool isSystem() const
Return whether this Solvable belongs to the system repo.
Definition: Solvable.cc:373
static const IdString retractedToken
Indicator provides retracted-patch-package()
Definition: Solvable.h:58
bool isKind(const ResKind &kind_r) const
Test whether a Solvable is of a certain ResKind.
Definition: Solvable.cc:302
Repository repository() const
The Repository this Solvable belongs to.
Definition: Solvable.cc:363
bool operator()(const PoolItem &item)
Definition: SATResolver.cc:452
CheckIfUpdate(const sat::Solvable &installed_r)
Definition: SATResolver.cc:445
static Ptr get(const pool::ByIdent &ident_r)
Get the Selctable.
Definition: Selectable.cc:28
std::ostream & dumpOn(std::ostream &str, const zypp::shared_ptr< void > &obj)
Definition: PtrTypes.h:151
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
std::unary_function< PoolItem, bool > PoolItemFilterFunctor
Definition: ResFilters.h:285
std::unary_function< ResObject::constPtr, bool > ResObjectFilterFunctor
Definition: ResFilters.h:151
typedef::s_Solver CSolver
Wrapped libsolv C data type exposed as backdoor.
Definition: PoolMember.h:65
int IdType
Generic Id type.
Definition: PoolMember.h:104
typedef::s_Pool CPool
Wrapped libsolv C data type exposed as backdoor.
Definition: PoolMember.h:61
unsigned SolvableIdType
Id type to connect Solvable and sat-solvable.
Definition: PoolMember.h:125
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:260
Queue SolvableQueue
Queue with Solvable ids.
Definition: Queue.h:25
Queue StringQueue
Queue with String ids.
Definition: Queue.h:27
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:232
static void SATSolutionToPool(PoolItem item, const ResStatus &status, const ResStatus::TransactByValue causer)
Definition: SATResolver.cc:335
int vendorCheck(sat::detail::CPool *pool, Solvable *solvable1, Solvable *solvable2)
Definition: SATResolver.cc:177
sat::Solvable mapBuddy(sat::Solvable item_r)
void establish(sat::Queue &pseudoItems_r, sat::Queue &pseudoFlags_r)
ResPool helper to compute the initial status of Patches etc.
Definition: SATResolver.cc:187
int relaxedVendorCheck(sat::detail::CPool *pool, Solvable *solvable1, Solvable *solvable2)
Definition: SATResolver.cc:180
IMPL_PTR_TYPE(SATResolver)
std::list< SolverQueueItem_Ptr > SolverQueueItemList
Definition: Types.h:45
std::string itemToString(const PoolItem &item)
Definition: SATResolver.cc:228
const std::string & asString(const std::string &t)
Global asString() that works with std::string too.
Definition: String.h:139
bool isPseudoInstalled(ResKind kind_r)
Those are denoted to be installed, if the solver verifies them as being satisfied.
Definition: ResTraits.h:28
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
std::unordered_set< Capability > CapabilitySet
Definition: Capability.h:33
@ language
language support
ResolverFocus
The resolvers general attitude.
Definition: ResolverFocus.h:22
@ Update
Focus on updating requested packages and their dependencies as much as possible.
@ Default
Request the standard behavior (as defined in zypp.conf or 'Job')
@ Installed
Focus on applying as little changes to the installed packages as needed.
@ Job
Focus on installing the best version of the requested packages.
std::list< ResolverProblem_Ptr > ResolverProblemList
Definition: ProblemTypes.h:46
std::list< ProblemSolution_Ptr > ProblemSolutionList
Definition: ProblemTypes.h:43
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
bool isKind(const ResKind &kind_r) const
Definition: SolvableType.h:64
Solvable satSolvable() const
Return the corresponding sat::Solvable.
Definition: SolvableType.h:57
std::string asString() const
Definition: SolvableType.h:94
bool multiversionInstall() const
Definition: SolvableType.h:82
FindPackage(ProblemSolutionCombi *p, const TransactionKind act)
Definition: SATResolver.cc:988
ProblemSolutionCombi * problemSolution
Definition: SATResolver.cc:986
Commit helper functor distributing PoolItem by status into lists.
Definition: SATResolver.cc:373
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
bool operator()(const PoolItem &item_r)
Definition: SATResolver.cc:391
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:28
#define _(MSG)
Definition: Gettext.h:37
#define DBG
Definition: Logger.h:95
#define MIL
Definition: Logger.h:96
#define ERR
Definition: Logger.h:98
#define WAR
Definition: Logger.h:97
#define INT
Definition: Logger.h:100