libzypp 17.32.0
Resolver.cc
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2/* Resolver.cc
3 *
4 * Copyright (C) 2000-2002 Ximian, Inc.
5 * Copyright (C) 2005 SUSE Linux Products GmbH
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 * 02111-1307, USA.
20 */
21#include <boost/static_assert.hpp>
22#include <utility>
23
24#define ZYPP_USE_RESOLVER_INTERNALS
25
26#include <zypp/base/LogTools.h>
27#include <zypp/base/Algorithm.h>
28
29#include <zypp/solver/detail/Resolver.h>
35
38
39#define MAXSOLVERRUNS 5
40
41using std::endl;
42using std::make_pair;
43
44#undef ZYPP_BASE_LOGGER_LOGGROUP
45#define ZYPP_BASE_LOGGER_LOGGROUP "zypp::solver"
46
48namespace zypp
49{
51 namespace solver
52 {
54 namespace detail
55 {
57
58//---------------------------------------------------------------------------
60
61std::ostream & Resolver::dumpOn( std::ostream & os ) const
63 os << "<resolver>" << endl;
64 #define OUTS(t) os << " " << #t << ":\t" << t << endl;
65 OUTS( _upgradeMode );
66 OUTS( _updateMode );
67 OUTS( _verifying );
68 OUTS( _solveSrcPackages );
69 OUTS( _ignoreAlreadyRecommended );
70 #undef OUT
71 return os << "<resolver/>";
72}
73
75//---------------------------------------------------------------------------
76
78 : _pool(std::move(pool))
79 , _satResolver(NULL)
80 , _poolchanged(_pool.serial() )
81 , _upgradeMode ( false )
82 , _updateMode ( false )
83 , _verifying ( false )
84 , _solveSrcPackages ( false )
85 , _ignoreAlreadyRecommended ( true )
86 , _applyDefault_focus ( true )
87 , _applyDefault_forceResolve ( true )
88 , _applyDefault_cleandepsOnRemove ( true )
89 , _applyDefault_onlyRequires ( true )
90 , _applyDefault_allowDowngrade ( true )
91 , _applyDefault_allowNameChange ( true )
92 , _applyDefault_allowArchChange ( true )
93 , _applyDefault_allowVendorChange ( true )
94 , _applyDefault_dupAllowDowngrade ( true )
95 , _applyDefault_dupAllowNameChange ( true )
96 , _applyDefault_dupAllowArchChange ( true )
97 , _applyDefault_dupAllowVendorChange ( true )
98{
100 _satResolver = new SATResolver(_pool, satPool.get());
101}
106 delete _satResolver;
107}
110{ return _satResolver->get(); }
111
115 MIL << "setDefaultSolverFlags all=" << all_r << endl;
117 if ( all_r || _applyDefault_focus ) setFocus( ResolverFocus::Default );
119#define ZOLV_FLAG_DEFAULT( ZSETTER, ZGETTER ) \
120 if ( all_r || _applyDefault_##ZGETTER ) ZSETTER( indeterminate )
121
122 ZOLV_FLAG_DEFAULT( setForceResolve ,forceResolve );
123 ZOLV_FLAG_DEFAULT( setCleandepsOnRemove ,cleandepsOnRemove );
124 ZOLV_FLAG_DEFAULT( setOnlyRequires ,onlyRequires );
125 ZOLV_FLAG_DEFAULT( setAllowDowngrade ,allowDowngrade );
126 ZOLV_FLAG_DEFAULT( setAllowNameChange ,allowNameChange );
127 ZOLV_FLAG_DEFAULT( setAllowArchChange ,allowArchChange );
128 ZOLV_FLAG_DEFAULT( setAllowVendorChange ,allowVendorChange );
129 ZOLV_FLAG_DEFAULT( dupSetAllowDowngrade ,dupAllowDowngrade );
130 ZOLV_FLAG_DEFAULT( dupSetAllowNameChange ,dupAllowNameChange );
131 ZOLV_FLAG_DEFAULT( dupSetAllowArchChange ,dupAllowArchChange );
132 ZOLV_FLAG_DEFAULT( dupSetAllowVendorChange ,dupAllowVendorChange );
133#undef ZOLV_FLAG_TRIBOOL
134}
135//---------------------------------------------------------------------------
136// forward flags too SATResolver
137void Resolver::setFocus( ResolverFocus focus_r ) {
138 _applyDefault_focus = ( focus_r == ResolverFocus::Default );
139 _satResolver->_focus = _applyDefault_focus ? ZConfig::instance().solver_focus() : focus_r;
140}
141ResolverFocus Resolver::focus() const { return _satResolver->_focus; }
143void Resolver::setRemoveOrphaned( bool yesno_r ) { _satResolver->_removeOrphaned = yesno_r; }
144bool Resolver::removeOrphaned() const { return _satResolver->_removeOrphaned; }
146#define ZOLV_FLAG_TRIBOOL( ZSETTER, ZGETTER, ZVARDEFAULT, ZVARNAME ) \
147 void Resolver::ZSETTER( TriBool state_r ) \
148 { _applyDefault_##ZGETTER = indeterminate(state_r); \
149 bool newval = _applyDefault_##ZGETTER ? ZVARDEFAULT : bool(state_r); \
150 if ( ZVARNAME != newval ) { \
151 DBG << #ZGETTER << ": changed from " << (bool)ZVARNAME << " to " << newval << endl;\
152 ZVARNAME = newval; \
153 } \
154 } \
155 bool Resolver::ZGETTER() const \
156 { return ZVARNAME; } \
157
158// Flags stored here follow the naming convention,...
159// Flags down in _satResolver don't. Could match `_satResolver->_##ZGETTER`
160#define ZOLV_FLAG_SATSOLV( ZSETTER, ZGETTER, ZVARDEFAULT, ZVARNAME ) \
161 ZOLV_FLAG_TRIBOOL( ZSETTER, ZGETTER, ZVARDEFAULT, _satResolver->ZVARNAME )
162
163// NOTE: ZVARDEFAULT must be in sync with SATResolver ctor
164ZOLV_FLAG_SATSOLV( setForceResolve ,forceResolve ,false ,_allowuninstall )
165ZOLV_FLAG_SATSOLV( setCleandepsOnRemove ,cleandepsOnRemove ,ZConfig::instance().solver_cleandepsOnRemove() ,_cleandepsOnRemove )
166ZOLV_FLAG_SATSOLV( setOnlyRequires ,onlyRequires ,ZConfig::instance().solver_onlyRequires() ,_onlyRequires )
167ZOLV_FLAG_SATSOLV( setAllowDowngrade ,allowDowngrade ,false ,_allowdowngrade )
168ZOLV_FLAG_SATSOLV( setAllowNameChange ,allowNameChange ,true /*bsc#1071466*/ ,_allownamechange )
169ZOLV_FLAG_SATSOLV( setAllowArchChange ,allowArchChange ,false ,_allowarchchange )
170ZOLV_FLAG_SATSOLV( setAllowVendorChange ,allowVendorChange ,ZConfig::instance().solver_allowVendorChange() ,_allowvendorchange )
171ZOLV_FLAG_SATSOLV( dupSetAllowDowngrade ,dupAllowDowngrade ,ZConfig::instance().solver_dupAllowDowngrade() ,_dup_allowdowngrade )
172ZOLV_FLAG_SATSOLV( dupSetAllowNameChange ,dupAllowNameChange ,ZConfig::instance().solver_dupAllowNameChange() ,_dup_allownamechange )
173ZOLV_FLAG_SATSOLV( dupSetAllowArchChange ,dupAllowArchChange ,ZConfig::instance().solver_dupAllowArchChange() ,_dup_allowarchchange )
174ZOLV_FLAG_SATSOLV( dupSetAllowVendorChange ,dupAllowVendorChange ,ZConfig::instance().solver_dupAllowVendorChange() ,_dup_allowvendorchange )
175#undef ZOLV_FLAG_SATSOLV
176#undef ZOLV_FLAG_TRIBOOL
177//---------------------------------------------------------------------------
178
179ResPool Resolver::pool() const
180{ return _pool; }
181
182void Resolver::reset( bool keepExtras )
183{
184 _verifying = false;
185
186 if (!keepExtras) {
187 _extra_requires.clear();
188 _extra_conflicts.clear();
189 }
190
191 _isInstalledBy.clear();
192 _installs.clear();
193 _satifiedByInstalled.clear();
194 _installedSatisfied.clear();
195}
196
197PoolItemList Resolver::problematicUpdateItems() const
198{ return _satResolver->problematicUpdateItems(); }
199
200void Resolver::addExtraRequire( const Capability & capability )
201{ _extra_requires.insert (capability); }
202
203void Resolver::removeExtraRequire( const Capability & capability )
204{ _extra_requires.erase (capability); }
205
206void Resolver::addExtraConflict( const Capability & capability )
207{ _extra_conflicts.insert (capability); }
208
209void Resolver::removeExtraConflict( const Capability & capability )
210{ _extra_conflicts.erase (capability); }
211
212void Resolver::removeQueueItem( const SolverQueueItem_Ptr& item )
213{
214 bool found = false;
215 for (SolverQueueItemList::const_iterator iter = _added_queue_items.begin();
216 iter != _added_queue_items.end(); iter++) {
217 if (*iter == item) {
218 _added_queue_items.remove(*iter);
219 found = true;
220 break;
221 }
222 }
223 if (!found) {
224 _removed_queue_items.push_back (item);
225 _removed_queue_items.unique ();
226 }
227}
228
229void Resolver::addQueueItem( const SolverQueueItem_Ptr& item )
230{
231 bool found = false;
232 for (SolverQueueItemList::const_iterator iter = _removed_queue_items.begin();
233 iter != _removed_queue_items.end(); iter++) {
234 if (*iter == item) {
235 _removed_queue_items.remove(*iter);
236 found = true;
237 break;
238 }
239 }
240 if (!found) {
241 _added_queue_items.push_back (item);
242 _added_queue_items.unique ();
243 }
244}
245
246void Resolver::addWeak( const PoolItem & item )
247{ _addWeak.push_back( item ); }
248
249//---------------------------------------------------------------------------
250
252{
255 :resStatus(status)
256 { }
257
258 bool operator()( const PoolItem& item ) // only transacts() items go here
259 {
260 item.status().resetTransact( resStatus );// clear any solver/establish transactions
261 return true;
262 }
263};
264
265
267{
270 :resStatus(status)
271 { }
272
273 bool operator()( const PoolItem& item ) // only transacts() items go here
274 {
275 item.status().setTransact( true, resStatus );
276 return true;
277 }
278};
279
280//----------------------------------------------------------------------------
281// undo
282void Resolver::undo()
283{
284 UndoTransact info(ResStatus::APPL_LOW);
285 MIL << "*** undo ***" << endl;
286 invokeOnEach ( _pool.begin(), _pool.end(),
287 resfilter::ByTransact( ), // collect transacts from Pool to resolver queue
288 std::ref(info) );
289 // Regard dependencies of the item weak onl
290 _addWeak.clear();
291
292 // Additional QueueItems which has to be regarded by the solver
293 _removed_queue_items.clear();
294 _added_queue_items.clear();
295
296 return;
297}
298
299void Resolver::solverInit()
300{
301 // Solving with libsolv
302 static bool poolDumped = false;
303 MIL << "-------------- Calling SAT Solver -------------------" << endl;
304 if ( getenv("ZYPP_FULLLOG") and get() ) { // libzypp/issues/317: get() to make sure a satsolver instance is actually present
305 Testcase testcase("/var/log/YaST2/autoTestcase");
306 if (!poolDumped) {
307 testcase.createTestcase (*this, true, false); // dump pool
308 poolDumped = true;
309 } else {
310 testcase.createTestcase (*this, false, false); // write control file only
311 }
312 }
313
314 // update solver mode flags
315 _satResolver->setDistupgrade (_upgradeMode);
316 _satResolver->setUpdatesystem (_updateMode);
317 _satResolver->setFixsystem ( isVerifyingMode() );
318 _satResolver->setSolveSrcPackages ( solveSrcPackages() );
319 _satResolver->setIgnorealreadyrecommended ( ignoreAlreadyRecommended() );
320
321 if (_upgradeMode) {
322 // Maybe depend on ZConfig::solverUpgradeRemoveDroppedPackages.
323 // For sure right but a change in behavior for old distros.
324 // (Will disable weakremover processing in SATResolver)
325 // _satResolver->setRemoveOrphaned( ... );
326 }
327
328 // Resetting additional solver information
329 _isInstalledBy.clear();
330 _installs.clear();
331 _satifiedByInstalled.clear();
332 _installedSatisfied.clear();
333}
334
336{
337 DBG << "Resolver::verifySystem()" << endl;
338 _verifying = true;
339 UndoTransact resetting (ResStatus::APPL_HIGH);
340 invokeOnEach ( _pool.begin(), _pool.end(),
341 resfilter::ByTransact( ), // Resetting all transcations
342 std::ref(resetting) );
343 return resolvePool();
344}
345
346
348{
349 // Setting Resolver to upgrade mode. SAT solver will do the update
350 _upgradeMode = true;
351 return resolvePool();
352}
353
355{
356 solverInit();
357 return _satResolver->resolvePool(_extra_requires, _extra_conflicts, _addWeak, _upgradeRepos );
358}
359
361{
362 _updateMode = true;
363 solverInit();
364 return _satResolver->doUpdate();
365}
366
368{
369 solverInit();
370
371 // add/remove additional SolverQueueItems
372 for (SolverQueueItemList::const_iterator iter = _removed_queue_items.begin();
373 iter != _removed_queue_items.end(); iter++) {
374 for (SolverQueueItemList::const_iterator iterQueue = queue.begin(); iterQueue != queue.end(); iterQueue++) {
375 if ( (*iterQueue)->cmp(*iter) == 0) {
376 MIL << "remove from queue" << *iter;
377 queue.remove(*iterQueue);
378 break;
379 }
380 }
381 }
382
383 for (SolverQueueItemList::const_iterator iter = _added_queue_items.begin();
384 iter != _added_queue_items.end(); iter++) {
385 bool found = false;
386 for (SolverQueueItemList::const_iterator iterQueue = queue.begin(); iterQueue != queue.end(); iterQueue++) {
387 if ( (*iterQueue)->cmp(*iter) == 0) {
388 found = true;
389 break;
390 }
391 }
392 if (!found) {
393 MIL << "add to queue" << *iter;
394 queue.push_back(*iter);
395 }
396 }
397
398 // The application has to take care to write these solutions back to e.g. selectables in order
399 // give the user a chance for changing these decisions again.
400 _removed_queue_items.clear();
401 _added_queue_items.clear();
402
403 return _satResolver->resolveQueue(queue, _addWeak);
404}
405
406sat::Transaction Resolver::getTransaction()
407{
408 // FIXME: That's an ugly way of pushing autoInstalled into the transaction.
409 sat::Transaction ret( sat::Transaction::loadFromPool );
410 ret.autoInstalled( _satResolver->autoInstalled() );
411 return ret;
412}
413
414
415//----------------------------------------------------------------------------
416// Getting more information about the solve results
417
419{
420 MIL << "Resolver::problems()" << endl;
421 return _satResolver->problems();
422}
423
424void Resolver::applySolutions( const ProblemSolutionList & solutions )
425{
426 for ( const ProblemSolution_Ptr& solution : solutions )
427 {
428 if ( ! applySolution( *solution ) )
429 break;
430 }
431}
432
433bool Resolver::applySolution( const ProblemSolution & solution )
434{
435 bool ret = true;
436 DBG << "apply solution " << solution << endl;
437 for ( const SolutionAction_Ptr& action : solution.actions() )
438 {
439 if ( ! action->execute( *this ) )
440 {
441 WAR << "apply solution action failed: " << action << endl;
442 ret = false;
443 break;
444 }
445 }
446 return ret;
447}
448
449//----------------------------------------------------------------------------
450
451void Resolver::collectResolverInfo()
452{
453 if ( _satResolver
454 && _isInstalledBy.empty()
455 && _installs.empty()) {
456
457 // generating new
458 PoolItemList itemsToInstall = _satResolver->resultItemsToInstall();
459
460 for (PoolItemList::const_iterator instIter = itemsToInstall.begin();
461 instIter != itemsToInstall.end(); instIter++) {
462 // Requires
463 for (Capabilities::const_iterator capIt = (*instIter)->dep (Dep::REQUIRES).begin(); capIt != (*instIter)->dep (Dep::REQUIRES).end(); ++capIt)
464 {
465 sat::WhatProvides possibleProviders(*capIt);
466 for_( iter, possibleProviders.begin(), possibleProviders.end() ) {
467 PoolItem provider = ResPool::instance().find( *iter );
468
469 // searching if this provider will already be installed
470 bool found = false;
471 bool alreadySetForInstallation = false;
472 ItemCapKindMap::const_iterator pos = _isInstalledBy.find(provider);
473 while (pos != _isInstalledBy.end()
474 && pos->first == provider
475 && !found) {
476 alreadySetForInstallation = true;
477 ItemCapKind capKind = pos->second;
478 if (capKind.item() == *instIter) found = true;
479 pos++;
480 }
481
482 if (!found
483 && provider.status().isToBeInstalled()) {
484 if (provider.status().isBySolver()) {
485 ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::REQUIRES, !alreadySetForInstallation );
486 _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
487 } else {
488 // no initial installation cause it has been set be e.g. user
489 ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::REQUIRES, false );
490 _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
491 }
492 ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::REQUIRES, !alreadySetForInstallation );
493 _installs.insert (make_pair( *instIter, capKindisInstalledBy));
494 }
495
496 if (provider.status().staysInstalled()) { // Is already satisfied by an item which is installed
497 ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::REQUIRES, false );
498 _satifiedByInstalled.insert (make_pair( *instIter, capKindisInstalledBy));
499
500 ItemCapKind installedSatisfied( *instIter, *capIt, Dep::REQUIRES, false );
501 _installedSatisfied.insert (make_pair( provider, installedSatisfied));
502 }
503 }
504 }
505
506 if (!(_satResolver->onlyRequires())) {
507 //Recommends
508 for (Capabilities::const_iterator capIt = (*instIter)->dep (Dep::RECOMMENDS).begin(); capIt != (*instIter)->dep (Dep::RECOMMENDS).end(); ++capIt)
509 {
510 sat::WhatProvides possibleProviders(*capIt);
511 for_( iter, possibleProviders.begin(), possibleProviders.end() ) {
512 PoolItem provider = ResPool::instance().find( *iter );
513
514 // searching if this provider will already be installed
515 bool found = false;
516 bool alreadySetForInstallation = false;
517 ItemCapKindMap::const_iterator pos = _isInstalledBy.find(provider);
518 while (pos != _isInstalledBy.end()
519 && pos->first == provider
520 && !found) {
521 alreadySetForInstallation = true;
522 ItemCapKind capKind = pos->second;
523 if (capKind.item() == *instIter) found = true;
524 pos++;
525 }
526
527 if (!found
528 && provider.status().isToBeInstalled()) {
529 if (provider.status().isBySolver()) {
530 ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::RECOMMENDS, !alreadySetForInstallation );
531 _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
532 } else {
533 // no initial installation cause it has been set be e.g. user
534 ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::RECOMMENDS, false );
535 _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
536 }
537 ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::RECOMMENDS, !alreadySetForInstallation );
538 _installs.insert (make_pair( *instIter, capKindisInstalledBy));
539 }
540
541 if (provider.status().staysInstalled()) { // Is already satisfied by an item which is installed
542 ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::RECOMMENDS, false );
543 _satifiedByInstalled.insert (make_pair( *instIter, capKindisInstalledBy));
544
545 ItemCapKind installedSatisfied( *instIter, *capIt, Dep::RECOMMENDS, false );
546 _installedSatisfied.insert (make_pair( provider, installedSatisfied));
547 }
548 }
549 }
550
551 //Supplements
552 for (Capabilities::const_iterator capIt = (*instIter)->dep (Dep::SUPPLEMENTS).begin(); capIt != (*instIter)->dep (Dep::SUPPLEMENTS).end(); ++capIt)
553 {
554 sat::WhatProvides possibleProviders(*capIt);
555 for_( iter, possibleProviders.begin(), possibleProviders.end() ) {
556 PoolItem provider = ResPool::instance().find( *iter );
557 // searching if this item will already be installed
558 bool found = false;
559 bool alreadySetForInstallation = false;
560 ItemCapKindMap::const_iterator pos = _isInstalledBy.find(*instIter);
561 while (pos != _isInstalledBy.end()
562 && pos->first == *instIter
563 && !found) {
564 alreadySetForInstallation = true;
565 ItemCapKind capKind = pos->second;
566 if (capKind.item() == provider) found = true;
567 pos++;
568 }
569
570 if (!found
571 && instIter->status().isToBeInstalled()) {
572 if (instIter->status().isBySolver()) {
573 ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::SUPPLEMENTS, !alreadySetForInstallation );
574 _isInstalledBy.insert (make_pair( *instIter, capKindisInstalledBy));
575 } else {
576 // no initial installation cause it has been set be e.g. user
577 ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::SUPPLEMENTS, false );
578 _isInstalledBy.insert (make_pair( *instIter, capKindisInstalledBy));
579 }
580 ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::SUPPLEMENTS, !alreadySetForInstallation );
581 _installs.insert (make_pair( provider, capKindisInstalledBy));
582 }
583
584 if (instIter->status().staysInstalled()) { // Is already satisfied by an item which is installed
585 ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::SUPPLEMENTS, !alreadySetForInstallation );
586 _satifiedByInstalled.insert (make_pair( provider, capKindisInstalledBy));
587
588 ItemCapKind installedSatisfied( provider, *capIt, Dep::SUPPLEMENTS, false );
589 _installedSatisfied.insert (make_pair( *instIter, installedSatisfied));
590 }
591 }
592 }
593 }
594 }
595 }
596}
597
598
599ItemCapKindList Resolver::isInstalledBy( const PoolItem & item )
600{
601 ItemCapKindList ret;
602 collectResolverInfo();
603
604 for (ItemCapKindMap::const_iterator iter = _isInstalledBy.find(item); iter != _isInstalledBy.end();) {
605 ItemCapKind info = iter->second;
606 PoolItem iterItem = iter->first;
607 if (iterItem == item) {
608 ret.push_back(info);
609 iter++;
610 } else {
611 // exit
612 iter = _isInstalledBy.end();
613 }
614 }
615 return ret;
616}
617
618ItemCapKindList Resolver::installs( const PoolItem & item )
619{
620 ItemCapKindList ret;
621 collectResolverInfo();
622
623 for (ItemCapKindMap::const_iterator iter = _installs.find(item); iter != _installs.end();) {
624 ItemCapKind info = iter->second;
625 PoolItem iterItem = iter->first;
626 if (iterItem == item) {
627 ret.push_back(info);
628 iter++;
629 } else {
630 // exit
631 iter = _installs.end();
632 }
633 }
634 return ret;
635}
636
637ItemCapKindList Resolver::satifiedByInstalled( const PoolItem & item )
638{
639 ItemCapKindList ret;
640 collectResolverInfo();
641
642 for (ItemCapKindMap::const_iterator iter = _satifiedByInstalled.find(item); iter != _satifiedByInstalled.end();) {
643 ItemCapKind info = iter->second;
644 PoolItem iterItem = iter->first;
645 if (iterItem == item) {
646 ret.push_back(info);
647 iter++;
648 } else {
649 // exit
650 iter = _satifiedByInstalled.end();
651 }
652 }
653 return ret;
654}
655
656ItemCapKindList Resolver::installedSatisfied( const PoolItem & item )
657{
658 ItemCapKindList ret;
659 collectResolverInfo();
660
661 for (ItemCapKindMap::const_iterator iter = _installedSatisfied.find(item); iter != _installedSatisfied.end();) {
662 ItemCapKind info = iter->second;
663 PoolItem iterItem = iter->first;
664 if (iterItem == item) {
665 ret.push_back(info);
666 iter++;
667 } else {
668 // exit
669 iter = _installedSatisfied.end();
670 }
671 }
672 return ret;
673}
674
675
677 };// namespace detail
680 };// namespace solver
683};// namespace zypp
685
#define OUTS(V)
Combining sat::Solvable and ResStatus.
Definition PoolItem.h:51
ResStatus & status() const
Returns the current status.
Definition PoolItem.cc:212
Global ResObject pool.
Definition ResPool.h:62
PoolItem find(const sat::Solvable &slv_r) const
Return the corresponding PoolItem.
Definition ResPool.cc:74
static ResPool instance()
Singleton ctor.
Definition ResPool.cc:38
bool setTransact(bool toTansact_r, TransactByValue causer_r)
Toggle between TRANSACT and KEEP_STATE.
Definition ResStatus.h:437
bool resetTransact(TransactByValue causer_r)
Not the same as setTransact( false ).
Definition ResStatus.h:489
bool resolveQueue(solver::detail::SolverQueueItemList &queue)
Resolve package dependencies:
Definition Resolver.cc:65
sat::detail::CSolver * get() const
Expert backdoor.
Definition Resolver.cc:56
void setRemoveOrphaned(bool yesno_r)
Set whether to remove unused orphans in 'upgrade' mode.
Definition Resolver.cc:105
void setDefaultSolverFlags(bool all_r=true)
Reset all solver flags to the systems default (e.g.
Definition Resolver.cc:53
ResolverProblemList problems()
Return the dependency problems found by the last call to resolveDependencies().
Definition Resolver.cc:71
sat::Transaction getTransaction()
Return the Transaction computed by the last solver run.
Definition Resolver.cc:77
void doUpdate()
Update to newest package.
Definition Resolver.cc:83
std::list< PoolItem > problematicUpdateItems() const
Unmaintained packages which does not fit to the updated system (broken dependencies) will be deleted.
Definition Resolver.cc:155
void applySolutions(const ProblemSolutionList &solutions)
Apply problem solutions.
Definition Resolver.cc:74
Resolver(const ResPool &pool)
Ctor.
Definition Resolver.cc:36
solver::detail::ItemCapKindList isInstalledBy(const PoolItem &item)
Gives information about WHO has pused an installation of an given item.
Definition Resolver.cc:164
solver::detail::ItemCapKindList installs(const PoolItem &item)
Gives information about WHICH additional items will be installed due the installation of an item.
Definition Resolver.cc:167
bool resolvePool()
Resolve package dependencies:
Definition Resolver.cc:62
void setFocus(ResolverFocus focus_r)
Define the resolver's general attitude when resolving jobs.
Definition Resolver.cc:86
bool removeOrphaned() const
Definition Resolver.cc:106
bool verifySystem()
Resolve package dependencies:
Definition Resolver.cc:59
~Resolver() override
Dtor.
Definition Resolver.cc:45
bool doUpgrade()
Do an distribution upgrade (DUP)
Definition Resolver.cc:80
ResolverFocus focus() const
Definition Resolver.cc:87
solver::detail::ItemCapKindList installedSatisfied(const PoolItem &item)
Gives information about WHICH items require an already installed item.
Definition Resolver.cc:173
solver::detail::ItemCapKindList satifiedByInstalled(const PoolItem &item)
Gives information about WHICH installed items are requested by the installation of an item.
Definition Resolver.cc:170
Interim helper class to collect global options and settings.
Definition ZConfig.h:64
ResolverFocus solver_focus() const
The resolver's general attitude when resolving jobs.
Definition ZConfig.cc:1227
static ZConfig & instance()
Singleton ctor.
Definition ZConfig.cc:925
virtual std::ostream & dumpOn(std::ostream &str) const
Overload to realize std::ostream & operator<<.
Global sat-pool.
Definition Pool.h:47
static Pool instance()
Singleton ctor.
Definition Pool.h:55
static constexpr LoadFromPoolType loadFromPool
Definition Transaction.h:82
Definition Arch.h:364
::s_Solver CSolver
Wrapped libsolv C data type exposed as backdoor.
Definition PoolMember.h:65
std::list< SolverQueueItem_Ptr > SolverQueueItemList
Definition Types.h:45
std::list< ItemCapKind > ItemCapKindList
Definition Types.h:42
_onlyRequires dupAllowDowngrade
Definition Resolver.cc:171
_onlyRequires _dup_allowdowngrade dupAllowArchChange
Definition Resolver.cc:173
Easy-to use interface to the ZYPP dependency resolver.
ResolverFocus
The resolver's general attitude.
@ Default
Request the standard behavior (as defined in zypp.conf or 'Job')
std::list< ProblemSolution_Ptr > ProblemSolutionList
std::list< ResolverProblem_Ptr > ResolverProblemList
int invokeOnEach(TIterator begin_r, TIterator end_r, TFilter filter_r, TFunction fnc_r)
Iterate through [begin_r,end_r) and invoke fnc_r on each item that passes filter_r.
Definition Algorithm.h:30
#define ZOLV_FLAG_SATSOLV(ZSETTER, ZGETTER, ZVARDEFAULT, ZVARNAME)
Definition Resolver.cc:160
#define ZOLV_FLAG_DEFAULT(ZSETTER, ZGETTER)
static const Dep REQUIRES
Definition Dep.h:44
static const Dep RECOMMENDS
Definition Dep.h:47
static const Dep SUPPLEMENTS
Definition Dep.h:50
Select PoolItem by transact.
Definition ResFilters.h:295
ResStatus::TransactByValue resStatus
Definition Resolver.cc:268
DoTransact(const ResStatus::TransactByValue &status)
Definition Resolver.cc:269
bool operator()(const PoolItem &item)
Definition Resolver.cc:273
bool operator()(const PoolItem &item)
Definition Resolver.cc:258
UndoTransact(const ResStatus::TransactByValue &status)
Definition Resolver.cc:254
ResStatus::TransactByValue resStatus
Definition Resolver.cc:253
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:28
#define DBG
Definition Logger.h:95
#define MIL
Definition Logger.h:96
#define WAR
Definition Logger.h:97