23#include <solv/repo_solv.h>
24#include <solv/poolarch.h>
26#include <solv/poolvendor.h>
27#include <solv/policy.h>
28#include <solv/bitmap.h>
29#include <solv/queue.h>
32#define ZYPP_USE_RESOLVER_INTERNALS
59#define XDEBUG(x) do { if (base::logger::isExcessive()) XXX << x << std::endl;} while (0)
61#undef ZYPP_BASE_LOGGER_LOGGROUP
62#define ZYPP_BASE_LOGGER_LOGGROUP "zypp::solver"
83 solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_INSTALLED, 0 );
84 solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_BEST, 0 );
87 solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_INSTALLED, 1 );
88 solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_BEST, 0 );
91 solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_INSTALLED, 0 );
92 solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_BEST, 1 );
100 inline sat::Queue collectPseudoInstalled(
const ResPool & pool_r )
103 for (
const PoolItem & pi : pool_r )
111 inline void solverCopyBackWeak(
sat::detail::CSolver & satSolver_r, PoolItemList & orphanedItems_r )
115 sat::Queue recommendations;
116 sat::Queue suggestions;
117 ::solver_get_recommendations( &satSolver_r, recommendations, suggestions, 0 );
119 PoolItem(sat::Solvable(recommendations[i])).status().setRecommended(
true );
121 PoolItem(sat::Solvable(suggestions[i])).status().setSuggested(
true );
124 orphanedItems_r.clear();
126 ::solver_get_orphaned( &satSolver_r, orphaned );
129 PoolItem pi { sat::Solvable(orphaned[i]) };
130 pi.status().setOrphaned(
true );
131 orphanedItems_r.push_back( pi );
136 ::solver_get_unneeded( &satSolver_r, unneeded, 1 );
138 PoolItem(sat::Solvable(unneeded[i])).status().setUnneeded(
true );
143 inline void solverCopyBackValidate(
sat::detail::CSolver & satSolver_r,
const ResPool & pool_r )
145 sat::Queue pseudoItems { collectPseudoInstalled( pool_r ) };
146 if ( ! pseudoItems.empty() )
148 sat::Queue pseudoFlags;
149 ::solver_trivial_installable( &satSolver_r, pseudoItems, pseudoFlags );
153 PoolItem pi { sat::Solvable(pseudoItems[i]) };
154 switch ( pseudoFlags[i] )
156 case 0: pi.status().setBroken();
break;
157 case 1: pi.status().setSatisfied();
break;
158 case -1: pi.status().setNonRelevant();
break;
159 default: pi.status().setUndetermined();
break;
172#define MAYBE_CLEANDEPS (cleandepsOnRemove()?SOLVER_CLEANDEPS:0)
194 MIL <<
"Establish..." << endl;
209 INT <<
"How can establish fail?" << endl;
218 case 0:
pi.status().setBroken();
break;
219 case 1:
pi.status().setSatisfied();
break;
220 case -1:
pi.status().setNonRelevant();
break;
221 default:
pi.status().setUndetermined();
break;
224 MIL <<
"Establish DONE" << endl;
227 MIL <<
"Establish not needed." << endl;
233 return std::string();
236 std::string
ret(
slv.asString() );
237 if ( !
slv.isSystem() )
240 ret +=
slv.repository().alias();
249SATResolver::dumpOn( std::ostream &
os )
const
251 os <<
"<resolver>" << endl;
253#define OUTS(X) os << " " << #X << "\t= " << solver_get_flag(_satSolver, SOLVER_FLAG_##X) << endl
275 os <<
" focus = " <<
_focus << endl;
278 os <<
" solveSrcPackages = " << _solveSrcPackages << endl;
284 return os <<
"<resolver/>" << endl;
291 : _pool(
std::move(pool))
294 , _focus ( ZConfig::instance().solver_focus() )
296 , _allowdowngrade ( false )
297 , _allownamechange ( true )
298 , _allowarchchange ( false )
299 , _allowvendorchange ( ZConfig::instance().solver_allowVendorChange() )
300 , _allowuninstall ( false )
301 , _updatesystem(false)
302 , _noupdateprovide ( false )
303 , _dosplitprovides ( true )
304 , _onlyRequires (ZConfig::instance().solver_onlyRequires())
305 , _ignorealreadyrecommended(true)
306 , _distupgrade(false)
307 , _removeOrphaned(false)
308 , _removeUnneeded(false)
309 , _dup_allowdowngrade ( ZConfig::instance().solver_dupAllowDowngrade() )
310 , _dup_allownamechange ( ZConfig::instance().solver_dupAllowNameChange() )
311 , _dup_allowarchchange ( ZConfig::instance().solver_dupAllowArchChange() )
312 , _dup_allowvendorchange ( ZConfig::instance().solver_dupAllowVendorChange() )
313 , _solveSrcPackages(false)
314 , _cleandepsOnRemove(ZConfig::instance().solver_cleandepsOnRemove())
319SATResolver::~SATResolver()
327SATResolver::pool (
void)
const
341 item.status().resetTransact (causer);
342 item.status().resetWeak ();
348 r =
item.status().setToBeInstalled (causer);
349 XDEBUG(
"SATSolutionToPool install returns " <<
item <<
", " <<
r);
352 r =
item.status().setToBeUninstalledDueToUpgrade (causer);
353 XDEBUG(
"SATSolutionToPool upgrade returns " <<
item <<
", " <<
r);
356 r =
item.status().setToBeUninstalled (causer);
357 XDEBUG(
"SATSolutionToPool remove returns " <<
item <<
", " <<
r);
388 _items_to_install.clear();
389 _items_to_remove.clear();
390 _items_to_lock.clear();
391 _items_to_keep.clear();
403 itemStatus.resetTransact( ResStatus::APPL_LOW );
415 case ResStatus::TRANSACT:
417 : _items_to_remove.push_back(
item_r );
break;
418 case ResStatus::LOCKED: _items_to_lock.push_back(
item_r );
break;
419 case ResStatus::KEEP_STATE: _items_to_keep.push_back(
item_r );
break;
435SATResolver::solverEnd()
447SATResolver::solverInit(
const PoolItemList &
weakItems)
449 MIL <<
"SATResolver::solverInit()" << endl;
462 if ( !
solv.isSystem() ) {
463 MIL <<
"Relaxed vendor check requested by " <<
solv << endl;
469 ::pool_set_custom_vendorcheck( _satPool, toRelax ? &relaxedVendorCheck : &
vendorCheck );
473 ::pool_add_userinstalled_jobs(_satPool,
sat::Pool::instance().autoInstalled(), &(_jobQueue), GET_USERINSTALLED_NAMES|GET_USERINSTALLED_INVERTED);
478 SATCollectTransact collector( _items_to_install, _items_to_remove, _items_to_lock, _items_to_keep, solveSrcPackages() );
479 invokeOnEach ( _pool.begin(), _pool.end(), std::ref( collector ) );
483 for (PoolItemList::const_iterator iter = weakItems.begin(); iter != weakItems.end(); iter++) {
486 ERR <<
"Weaken: " << *iter <<
" not found" << endl;
488 MIL <<
"Weaken dependencies of " << *iter << endl;
489 queue_push( &(_jobQueue), SOLVER_WEAKENDEPS | SOLVER_SOLVABLE );
490 queue_push( &(_jobQueue),
id );
495 queue_push( &(_jobQueue), SOLVER_BLACKLIST|SOLVER_SOLVABLE_PROVIDES );
497 queue_push( &(_jobQueue), SOLVER_BLACKLIST|SOLVER_SOLVABLE_PROVIDES );
504 const auto & trackedLocaleIds( myPool().trackedLocaleIds() );
507 for (
const auto & locale : trackedLocaleIds.added() )
509 queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES );
513 for (
const auto & locale : trackedLocaleIds.removed() )
515 queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES | SOLVER_CLEANDEPS );
521 for (
const sat::Solvable & solv : myPool().multiversionList() )
523 queue_push( &(_jobQueue), SOLVER_NOOBSOLETES | SOLVER_SOLVABLE );
524 queue_push( &(_jobQueue), solv.id() );
533 if ( _protectPTFs ) {
534 for (
const auto & solv : sat::AllPTFs() ) {
535 if ( solv.isSystem() ) {
536 queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE );
537 queue_push( &(_jobQueue), solv.id() );
544 solverInitSetSystemRequirements();
547 solverInitSetLocks();
550 solverInitSetModeJobsAndFlags();
553void SATResolver::solverInitSetSystemRequirements()
555 CapabilitySet system_requires = SystemCheck::instance().requiredSystemCap();
556 CapabilitySet system_conflicts = SystemCheck::instance().conflictSystemCap();
558 for (CapabilitySet::const_iterator iter = system_requires.begin(); iter != system_requires.end(); ++iter) {
559 queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES );
560 queue_push( &(_jobQueue), iter->id() );
561 MIL <<
"SYSTEM Requires " << *iter << endl;
564 for (CapabilitySet::const_iterator iter = system_conflicts.begin(); iter != system_conflicts.end(); ++iter) {
565 queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES |
MAYBE_CLEANDEPS );
566 queue_push( &(_jobQueue), iter->id() );
567 MIL <<
"SYSTEM Conflicts " << *iter << endl;
576 for_( it, pool.byIdentBegin(rpm), pool.byIdentEnd(rpm) )
578 if ( (*it)->isSystem() )
581 queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE_NAME | SOLVER_ESSENTIAL );
582 queue_push( &(_jobQueue), archrule.id() );
589void SATResolver::solverInitSetLocks()
594 for (PoolItemList::const_iterator iter = _items_to_lock.begin(); iter != _items_to_lock.end(); ++iter) {
596 if (iter->status().isInstalled()) {
598 queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE );
599 queue_push( &(_jobQueue),
id );
602 queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE |
MAYBE_CLEANDEPS );
603 queue_push( &(_jobQueue),
id );
606 MIL <<
"Locked " << icnt <<
" installed items and " << acnt <<
" NOT installed items." << endl;
612 std::set<IdString> unifiedByName;
613 for (PoolItemList::const_iterator iter = _items_to_keep.begin(); iter != _items_to_keep.end(); ++iter) {
615 if ( unifiedByName.insert( ident ).second )
619 MIL <<
"Keep NOT installed name " << ident <<
" (" << *iter <<
")" << endl;
620 queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_NAME | SOLVER_WEAK |
MAYBE_CLEANDEPS );
621 queue_push( &(_jobQueue), ident.id() );
627void SATResolver::solverInitSetModeJobsAndFlags()
630 queue_push( &(_jobQueue), SOLVER_VERIFY|SOLVER_SOLVABLE_ALL);
631 queue_push( &(_jobQueue), 0 );
634 queue_push( &(_jobQueue), SOLVER_UPDATE|SOLVER_SOLVABLE_ALL);
635 queue_push( &(_jobQueue), 0 );
638 queue_push( &(_jobQueue), SOLVER_DISTUPGRADE|SOLVER_SOLVABLE_ALL);
639 queue_push( &(_jobQueue), 0 );
644 if (_removeOrphaned) {
645 queue_push( &(_jobQueue), SOLVER_DROP_ORPHANED|SOLVER_SOLVABLE_ALL);
646 queue_push( &(_jobQueue), 0 );
649 if (_removeUnneeded) {
650 invokeOnEach ( _pool.begin(), _pool.end(), [
this](
const PoolItem & pi_r ) {
651 if ( pi_r.status().isUnneeded() ) {
652 queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_NAME | SOLVER_WEAK | MAYBE_CLEANDEPS );
653 queue_push( &(_jobQueue), pi_r.ident().id() );
659 solverSetFocus( *_satSolver, _focus );
660 solver_set_flag(_satSolver, SOLVER_FLAG_ADD_ALREADY_RECOMMENDED, !_ignorealreadyrecommended);
661 solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_DOWNGRADE, _allowdowngrade);
662 solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_NAMECHANGE, _allownamechange);
663 solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_ARCHCHANGE, _allowarchchange);
664 solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_VENDORCHANGE, _allowvendorchange);
665 solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_UNINSTALL, _allowuninstall);
666 solver_set_flag(_satSolver, SOLVER_FLAG_NO_UPDATEPROVIDE, _noupdateprovide);
667 solver_set_flag(_satSolver, SOLVER_FLAG_SPLITPROVIDES, _dosplitprovides);
668 solver_set_flag(_satSolver, SOLVER_FLAG_IGNORE_RECOMMENDED,
false);
669 solver_set_flag(_satSolver, SOLVER_FLAG_ONLY_NAMESPACE_RECOMMENDED, _onlyRequires);
670 solver_set_flag(_satSolver, SOLVER_FLAG_DUP_ALLOW_DOWNGRADE, _dup_allowdowngrade );
671 solver_set_flag(_satSolver, SOLVER_FLAG_DUP_ALLOW_NAMECHANGE, _dup_allownamechange );
672 solver_set_flag(_satSolver, SOLVER_FLAG_DUP_ALLOW_ARCHCHANGE, _dup_allowarchchange );
673 solver_set_flag(_satSolver, SOLVER_FLAG_DUP_ALLOW_VENDORCHANGE, _dup_allowvendorchange );
689 : is_updated(
false )
697 if (
item.status().isToBeInstalled() )
699 if ( !
item.multiversionInstall() || sameNVRA( _installed,
item ) )
717 MIL <<
"Starting solving...." << endl;
727 MIL <<
"Droplist processing not needed. RemoveUnsupported is On." << endl;
729 MIL <<
"Droplist processing is disabled in ZConfig." << endl;
732 bool resolve =
false;
733 MIL <<
"Checking droplists ..." << endl;
747 MIL <<
"Droplist for " <<
slv <<
": size " << droplist.size() << endl;
748 if ( !droplist.empty() )
750 for (
const auto &
cap : droplist )
767 MIL <<
"....Solver end" << endl;
785 if ( !
slv ||
slv.isSystem() )
788 PoolItem poolItem(
slv );
796 if ( systemRepo && ! systemRepo.solvablesEmpty() )
799 for_(
it, systemRepo.solvablesBegin(), systemRepo.solvablesEnd() )
805 CheckIfUpdate info( *
it );
806 PoolItem poolItem( *
it );
808 _pool.byIdentEnd( poolItem ),
809 resfilter::ByUninstalled(),
812 if (info.is_updated) {
826 ResStatus & status(
it->status() );
828 if ( status.transacts() && ! status.isToBeUninstalledDueToUpgrade() )
829 status.setToBeUninstalledDueToObsolete();
845 PoolItem poolItem(*
iter2);
846 if (poolItem.status().isToBeInstalled()) {
847 MIL <<
"User requirement " << *
iter <<
" sets " << poolItem << endl;
855 PoolItem poolItem(*
iter2);
856 if (poolItem.status().isToBeUninstalled()) {
857 MIL <<
"User conflict " << *
iter <<
" sets " << poolItem << endl;
865 ERR <<
"Solverrun finished with an ERROR" << endl;
872void SATResolver::solverAddJobsFromPool()
874 for (PoolItemList::const_iterator
iter = _items_to_install.begin();
iter != _items_to_install.end();
iter++) {
877 ERR <<
"Install: " << *
iter <<
" not found" << endl;
879 MIL <<
"Install " << *
iter << endl;
885 for (PoolItemList::const_iterator
iter = _items_to_remove.begin();
iter != _items_to_remove.end();
iter++) {
888 ERR <<
"Delete: " << *
iter <<
" not found" << endl;
890 MIL <<
"Delete " << *
iter << endl;
902 MIL <<
"Requires " << *
iter << endl;
908 MIL <<
"Conflicts " << *
iter << endl;
915 const PoolItemList & weakItems,
916 const std::set<Repository> & upgradeRepos)
918 MIL <<
"SATResolver::resolvePool()" << endl;
931 MIL <<
"Upgrade repo " << *
iter << endl;
937 (
ret?
MIL:
WAR) <<
"SATResolver::resolvePool() done. Ret:" <<
ret << endl;
943SATResolver::resolveQueue(
const SolverQueueItemList &requestQueue,
944 const PoolItemList & weakItems)
946 MIL <<
"SATResolver::resolvQueue()" << endl;
952 for (SolverQueueItemList::const_iterator
iter = requestQueue.begin();
iter != requestQueue.end();
iter++) {
962 (
ret?
MIL:
WAR) <<
"SATResolver::resolveQueue() done. Ret:" <<
ret << endl;
967void SATResolver::doUpdate()
969 MIL <<
"SATResolver::doUpdate()" << endl;
982 MIL <<
"Starting solving for update...." << endl;
985 MIL <<
"....Solver end" << endl;
1015 PoolItem poolItem( _pool.find( sat::Solvable(
i) ) );
1018 CheckIfUpdate info( (sat::Solvable(
i)) );
1020 _pool.byIdentEnd( poolItem ),
1021 resfilter::ByUninstalled(),
1024 if (info.is_updated) {
1030 ERR <<
"id " <<
i <<
" not found in ZYPP pool." << endl;
1040 MIL <<
"SATResolver::doUpdate() done" << endl;
1060 : problemSolution (
p)
1067 problemSolution->addSingleAction (
p, action);
1089 return item_r.satSolvable();
1100std::vector<std::string> SATResolver::SATgetCompleteProblemInfoStrings ( Id problem )
1102 std::vector<std::string>
ret;
1103 sat::Queue problems;
1111 if (
ruleClass != SolverRuleinfo::SOLVER_RULE_UPDATE &&
ruleClass != SolverRuleinfo::SOLVER_RULE_JOB ) {
1118 if (
nobad && (
ruleClass == SolverRuleinfo::SOLVER_RULE_UPDATE ||
ruleClass == SolverRuleinfo::SOLVER_RULE_JOB ) ) {
1133std::string SATResolver::SATprobleminfoString(Id problem, std::string &detail, Id &ignoreId)
1141std::string SATResolver::SATproblemRuleInfoString (Id probr, std::string &detail, Id &ignoreId)
1145 Id dep = 0, source = 0, target = 0;
1160 ret = str::Format(
_(
"the installed %1% does not belong to a distupgrade repository and must be replaced") ) %
s.asString();
1162 ret = str::Format(
_(
"the to be installed %1% does not belong to a distupgrade repository") ) %
s.asString();
1166 ret = str::Format(
_(
"the installed %1% has inferior architecture") ) %
s.asString();
1168 ret = str::Format(
_(
"the to be installed %1% has inferior architecture") ) %
s.asString();
1171 ret = str::Format(
_(
"problem with the installed %1%") ) %
s.asString();
1174 ret =
_(
"conflicting requests");
1177 ret =
_(
"some dependency problem");
1180 ret = str::Format(
_(
"nothing provides the requested '%1%'") ) %
pool_dep2str(pool, dep);
1181 detail +=
_(
"Have you enabled all the required repositories?");
1184 ret = str::Format(
_(
"the requested package %1% does not exist") ) %
pool_dep2str(pool, dep);
1185 detail +=
_(
"Have you enabled all the required repositories?");
1188 ret =
_(
"unsupported request");
1191 ret = str::Format(
_(
"'%1%' is provided by the system and cannot be erased") ) %
pool_dep2str(pool, dep);
1194 ret = str::Format(
_(
"%1% is not installable") ) %
s.asString();
1199 ret = str::Format(
_(
"nothing provides '%1%' needed by the installed %2%") ) %
pool_dep2str(pool, dep) %
s.asString();
1201 ret = str::Format(
_(
"nothing provides '%1%' needed by the to be installed %2%") ) %
pool_dep2str(pool, dep) %
s.asString();
1204 ret = str::Format(
_(
"cannot install both %1% and %2%") ) %
s.asString() %
s2.asString();
1207 if (
s.isSystem() ) {
1208 if (
s2.isSystem() )
1209 ret = str::Format(
_(
"the installed %1% conflicts with '%2%' provided by the installed %3%") ) %
s.asString() %
pool_dep2str(pool, dep) %
s2.asString();
1211 ret = str::Format(
_(
"the installed %1% conflicts with '%2%' provided by the to be installed %3%") ) %
s.asString() %
pool_dep2str(pool, dep) %
s2.asString();
1214 if (
s2.isSystem() )
1215 ret = str::Format(
_(
"the to be installed %1% conflicts with '%2%' provided by the installed %3%") ) %
s.asString() %
pool_dep2str(pool, dep) %
s2.asString();
1217 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();
1222 if (
s.isSystem() ) {
1223 if (
s2.isSystem() )
1224 ret = str::Format(
_(
"the installed %1% obsoletes '%2%' provided by the installed %3%") ) %
s.asString() %
pool_dep2str(pool, dep) %
s2.asString();
1226 ret = str::Format(
_(
"the installed %1% obsoletes '%2%' provided by the to be installed %3%") ) %
s.asString() %
pool_dep2str(pool, dep) %
s2.asString();
1229 if (
s2.isSystem() )
1230 ret = str::Format(
_(
"the to be installed %1% obsoletes '%2%' provided by the installed %3%") ) %
s.asString() %
pool_dep2str(pool, dep) %
s2.asString();
1232 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();
1237 ret = str::Format(
_(
"the installed %1% conflicts with '%2%' provided by itself") ) %
s.asString() %
pool_dep2str(pool, dep);
1239 ret = str::Format(
_(
"the to be installed %1% conflicts with '%2%' provided by itself") ) %
s.asString() %
pool_dep2str(pool, dep);
1243 Capability
cap(dep);
1271 ret = str::Format(
_(
"the installed %1% requires '%2%', but this requirement cannot be provided") ) %
s.asString() %
pool_dep2str(pool, dep);
1273 ret = str::Format(
_(
"the to be installed %1% requires '%2%', but this requirement cannot be provided") ) %
s.asString() %
pool_dep2str(pool, dep);
1275 detail +=
_(
"deleted providers: ");
1284 if (detail.size() > 0)
1285 detail +=
_(
"\nnot installable providers: ");
1287 detail =
_(
"not installable providers: ");
1298 DBG <<
"Unknown rule type(" << type <<
") going to query libsolv for rule information." << endl;
1311 void notInstallPatch( sat::Solvable slv_r )
1312 {
_patch.push_back( slv_r.ident() ); }
1314 void removePtf( sat::Solvable slv_r,
bool showremoveProtectHint_r =
false )
1317 bool applies()
const
1318 {
return not
_ptf.empty(); }
1320 std::string description()
const {
1321 if ( not
_patch.empty() ) {
1324 << (str::Format(
_(
"%1% is not yet fully integrated into %2%.") ) % printlist(
_ptf) % printlist(
_patch)) << endl
1325 <<
_(
"Typically you want to keep the PTF and choose to not install the maintenance patches.");
1330 const std::string & removeptfCommand { str::Format(
"zypper removeptf %1%") % printlist(
_ptf) };
1333 << (str::Format(
_(
"Removing the installed %1% in this context will remove (not replace!) the included PTF-packages too." ) ) % printlist(
_ptf)) << endl
1334 << (str::Format(
_(
"The PTF should be removed by calling '%1%'. This will update the included PTF-packages rather than removing them." ) ) % removeptfCommand) << endl
1335 <<
_(
"Typically you want to keep the PTF or choose to cancel the action.");
1340 << (str::Format(
_(
"The installed %1% blocks the desired action.") ) % printlist(
_ptf)) << endl
1341 <<
_(
"Typically you want to keep the PTF and choose to cancel the action.");
1345 static std::string printlist(
const std::vector<StoreType> & list_r )
1346 { str::Str ret;
dumpRange( ret.stream(), list_r.begin(), list_r.end(),
"",
"",
", ",
"",
"" );
return ret; }
1356SATResolver::problems ()
1362 Id p = 0,
rp = 0, what = 0;
1364 sat::Solvable
s,
sd;
1369 MIL <<
"Encountered problems! Here are the solutions:\n" << endl;
1373 MIL <<
"Problem " <<
pcnt++ <<
":" << endl;
1374 MIL <<
"====================================" << endl;
1379 MIL <<
"------------------------------------" << endl;
1394 PoolItem poolItem = _pool.find (
s);
1396 if (pool->installed &&
s.get()->repo == pool->installed) {
1397 problemSolution->addSingleAction (poolItem, REMOVE);
1398 std::string description = str::Format(
_(
"remove lock to allow removal of %1%") ) %
s.asString();
1399 MIL << description << endl;
1400 problemSolution->addDescription (description);
1404 problemSolution->addSingleAction (poolItem,
KEEP);
1405 std::string description = str::Format(
_(
"do not install %1%") ) %
s.asString();
1406 MIL << description << endl;
1407 problemSolution->addDescription (description);
1408 if (
s.isKind<Patch>() )
1412 ERR <<
"SOLVER_INSTALL_SOLVABLE: No item found for " <<
s.asString() << endl;
1418 PoolItem poolItem = _pool.find (
s);
1420 if (pool->installed &&
s.get()->repo == pool->installed) {
1421 problemSolution->addSingleAction (poolItem,
KEEP);
1422 std::string description = str::Format(
_(
"keep %1%") ) %
s.asString();
1423 MIL << description << endl;
1424 problemSolution->addDescription (description);
1426 problemSolution->addSingleAction (poolItem,
UNLOCK);
1427 std::string description = str::Format(
_(
"remove lock to allow installation of %1%") ) %
itemToString( poolItem );
1428 MIL << description << endl;
1429 problemSolution->addDescription (description);
1432 ERR <<
"SOLVER_ERASE_SOLVABLE: No item found for " <<
s.asString() << endl;
1440 new SolverQueueItemInstall(_pool, ident.asString(),
false );
1443 std::string description = str::Format(
_(
"do not install %1%") ) % ident;
1444 MIL << description << endl;
1445 problemSolution->addDescription (description);
1453 FindPackage info (problemSolution,
KEEP);
1455 _pool.byIdentEnd( ident ),
1457 resfilter::ByTransact ()),
1461 new SolverQueueItemDelete(_pool, ident.asString(),
false );
1464 std::string description = str::Format(
_(
"keep %1%") ) % ident;
1465 MIL << description << endl;
1466 problemSolution->addDescription (description);
1472 std::string description =
"";
1478 resolverProblem->setDescription(
_(
"This request will break your system!"));
1479 description =
_(
"ignore the warning of a broken system");
1480 description += std::string(
" (requires:")+
pool_dep2str(pool, what)+
")";
1481 MIL << description << endl;
1482 problemSolution->addFrontDescription (description);
1484 description = str::Format(
_(
"do not ask to install a solvable providing %1%") ) %
pool_dep2str(pool, what);
1485 MIL << description << endl;
1486 problemSolution->addDescription (description);
1493 std::string description =
"";
1499 resolverProblem->setDescription(
_(
"This request will break your system!"));
1500 description =
_(
"ignore the warning of a broken system");
1501 description += std::string(
" (conflicts:")+
pool_dep2str(pool, what)+
")";
1502 MIL << description << endl;
1503 problemSolution->addFrontDescription (description);
1506 description = str::Format(
_(
"do not ask to delete all solvables providing %1%") ) %
pool_dep2str(pool, what);
1507 MIL << description << endl;
1508 problemSolution->addDescription (description);
1515 PoolItem poolItem = _pool.find (
s);
1517 if (pool->installed &&
s.get()->repo == pool->installed) {
1518 problemSolution->addSingleAction (poolItem,
KEEP);
1519 std::string description = str::Format(
_(
"do not install most recent version of %1%") ) %
s.asString();
1520 MIL << description << endl;
1521 problemSolution->addDescription (description);
1523 ERR <<
"SOLVER_INSTALL_SOLVABLE_UPDATE " << poolItem <<
" is not selected for installation" << endl;
1526 ERR <<
"SOLVER_INSTALL_SOLVABLE_UPDATE: No item found for " <<
s.asString() << endl;
1531 MIL <<
"- do something different" << endl;
1532 ERR <<
"No valid solution available" << endl;
1537 PoolItem poolItem = _pool.find (
s);
1538 if (pool->installed &&
s.get()->repo == pool->installed) {
1539 problemSolution->addSingleAction (poolItem,
LOCK);
1540 std::string description = str::Format(
_(
"keep %1% despite the inferior architecture") ) %
s.asString();
1541 MIL << description << endl;
1542 problemSolution->addDescription (description);
1544 problemSolution->addSingleAction (poolItem, INSTALL);
1545 std::string description = str::Format(
_(
"install %1% despite the inferior architecture") ) %
s.asString();
1546 MIL << description << endl;
1547 problemSolution->addDescription (description);
1551 PoolItem poolItem = _pool.find (
s);
1552 if (pool->installed &&
s.get()->repo == pool->installed) {
1553 problemSolution->addSingleAction (poolItem,
LOCK);
1554 std::string description = str::Format(
_(
"keep obsolete %1%") ) %
s.asString();
1555 MIL << description << endl;
1556 problemSolution->addDescription (description);
1558 problemSolution->addSingleAction (poolItem, INSTALL);
1559 std::string description = str::Format(
_(
"install %1% from excluded repository") ) %
s.asString();
1560 MIL << description << endl;
1561 problemSolution->addDescription (description);
1567 PoolItem poolItem = _pool.find (
s);
1569 problemSolution->addSingleAction (poolItem, INSTALL);
1570 std::string description;
1571 if (
s.isRetracted() ) {
1573 description = str::Format(
_(
"install %1% although it has been retracted")) %
s.asString();
1574 }
else if (
s.isPtf() ) {
1576 description = str::Format(
_(
"allow installing the PTF %1%")) %
s.asString();
1579 description = str::Format(
_(
"install %1% although it is blacklisted")) %
s.asString();
1581 MIL << description << endl;
1582 problemSolution->addDescription( description );
1583 }
else if (
p > 0 ) {
1594 problemSolution->addSingleAction (
itemTo, INSTALL);
1599 std::string description = str::Format(
_(
"downgrade of %1% to %2%") ) %
s.asString() %
sd.asString();
1600 MIL << description << endl;
1601 problemSolution->addDescription (description);
1606 std::string description = str::Format(
_(
"architecture change of %1% to %2%") ) %
s.asString() %
sd.asString();
1607 MIL << description << endl;
1608 problemSolution->addDescription (description);
1615 std::string description;
1617 description = str::Format(
_(
"install %1% (with vendor change)\n %2% --> %3%") )
1622 description = str::Format(
_(
"install %1% from vendor %2%\n replacing %3% from vendor %4%") )
1626 MIL << description << endl;
1627 problemSolution->addDescription (description);
1631 std::string description = str::Format(
_(
"replacement of %1% with %2%") ) %
s.asString() %
sd.asString();
1632 MIL << description << endl;
1633 problemSolution->addDescription (description);
1636 ERR <<
s.asString() <<
" or " <<
sd.asString() <<
" not found" << endl;
1642 std::string description = str::Format(
_(
"deinstallation of %1%") ) %
s.asString();
1643 MIL << description << endl;
1644 problemSolution->addDescription (description);
1645 problemSolution->addSingleAction (
itemFrom, REMOVE);
1646 if (
s.isPtfMaster() )
1653 INT <<
"Unknown solution " <<
p << endl;
1658 problemSolution->actionCount() > 1 ?
true :
false);
1659 MIL <<
"------------------------------------" << endl;
1668 MIL <<
"ignore some dependencies of " <<
item << endl;
1669 MIL <<
"------------------------------------" << endl;
1684{ Resolver( _pool ).applySolutions( solutions ); }
std::vector< StoreType > _ptf
std::vector< StoreType > _patch
bool _showremoveProtectHint
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
AutoDispose()
Default Ctor using default constructed value and no dispose function.
Access to the sat-pools string space.
Combining sat::Solvable and ResStatus.
static ResPool instance()
Singleton ctor.
static const ResStatus toBeInstalled
bool isToBeInstalled() const
static const ResStatus toBeUninstalledDueToUpgrade
static const ResStatus toBeUninstalled
bool isToBeUninstalled() const
bool isToBeUninstalledDueToUpgrade() const
static const VendorAttr & instance()
(Pseudo)Singleton, mapped to the current Target::vendorAttr settings or to noTargetInstance.
static ZConfig & instance()
Singleton ctor.
static Pool instance()
Singleton ctor.
Libsolv Id queue wrapper.
A Solvable object within the sat Pool.
static const IdString ptfMasterToken
Indicator provides ptf()
static const IdString retractedToken
Indicator provides retracted-patch-package()
bool operator()(const PoolItem &item)
CheckIfUpdate(const sat::Solvable &installed_r)
static Ptr get(const pool::ByIdent &ident_r)
Get the Selctable.
Chain< TACondition, TBCondition > chain(TACondition conda_r, TBCondition condb_r)
Convenience function for creating a Chain from two conditions conda_r and condb_r.
unsigned int SolvableIdType
Id type to connect Solvable and sat-solvable.
int IdType
Generic Id type.
::s_Solver CSolver
Wrapped libsolv C data type exposed as backdoor.
::s_Pool CPool
Wrapped libsolv C data type exposed as backdoor.
Queue StringQueue
Queue with String ids.
int vendorCheck(sat::detail::CPool *pool, Solvable *solvable1, Solvable *solvable2)
static void SATSolutionToPool(const PoolItem &item, const ResStatus &status, const ResStatus::TransactByValue causer)
void establish(sat::Queue &pseudoItems_r, sat::Queue &pseudoFlags_r)
ResPool helper to compute the initial status of Patches etc.
int relaxedVendorCheck(sat::detail::CPool *pool, Solvable *solvable1, Solvable *solvable2)
sat::Solvable mapBuddy(const PoolItem &item_r)
std::string itemToString(const PoolItem &item)
const std::string & asString(const std::string &t)
Global asString() that works with std::string too.
bool isPseudoInstalled(const ResKind &kind_r)
Those are denoted to be installed, if the solver verifies them as being satisfied.
Easy-to use interface to the ZYPP dependency resolver.
@ language
language support
std::list< ProblemSolution_Ptr > ProblemSolutionList
std::ostream & dumpRange(std::ostream &str, TIterator begin, TIterator end, const std::string &intro="{", const std::string &pfx="\n ", const std::string &sep="\n ", const std::string &sfx="\n", const std::string &extro="}")
Print range defined by iterators (multiline style).
@ 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
std::unordered_set< Capability > CapabilitySet
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.
bool operator()(const PoolItem &p)
FindPackage(ProblemSolutionCombi *p, const TransactionKind act)
ProblemSolutionCombi * problemSolution
Commit helper functor distributing PoolItem by status into lists.
PoolItemList & _items_to_lock
SATCollectTransact(PoolItemList &items_to_install_r, PoolItemList &items_to_remove_r, PoolItemList &items_to_lock_r, PoolItemList &items_to_keep_r, bool solveSrcPackages_r)
PoolItemList & _items_to_install
PoolItemList & _items_to_remove
PoolItemList & _items_to_keep
bool operator()(const PoolItem &item_r)
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
#define IMPL_PTR_TYPE(NAME)