21 #include <boost/static_assert.hpp>
41 #define MAXSOLVERRUNS 5
63 os <<
"<resolver>" << endl;
64 #define OUTS(t) os << " " << #t << ":\t" << t << endl;
65 OUTS( _forceResolve );
69 OUTS( _onlyRequires );
70 OUTS( _allowVendorChange );
71 OUTS( _solveSrcPackages );
72 OUTS( _cleandepsOnRemove );
73 OUTS( _ignoreAlreadyRecommended );
75 return os <<
"<resolver/>";
84 , _poolchanged(_pool.serial() )
85 , _forceResolve (false)
86 , _upgradeMode (false)
89 , _onlyRequires (
ZConfig::instance().solver_onlyRequires() )
90 , _allowVendorChange (
ZConfig::instance().solver_allowVendorChange() )
91 , _solveSrcPackages ( false )
92 , _cleandepsOnRemove (
ZConfig::instance().solver_cleandepsOnRemove() )
93 , _ignoreAlreadyRecommended ( true )
108 #define ZOLV_FLAG_TRIBOOL( ZSETTER, ZGETTER, ZVARNAME, ZVARDEFAULT ) \
109 void Resolver::ZSETTER( TriBool state_r ) \
110 { _satResolver->ZVARNAME = indeterminate(state_r) ? ZVARDEFAULT : bool(state_r); } \
111 bool Resolver::ZGETTER() const \
112 { return _satResolver->ZVARNAME; } \
114 ZOLV_FLAG_TRIBOOL( dupSetAllowDowngrade, dupAllowDowngrade, _dup_allowdowngrade,
true )
115 ZOLV_FLAG_TRIBOOL( dupSetAllowNameChange, dupAllowNameChange, _dup_allownamechange, true )
116 ZOLV_FLAG_TRIBOOL( dupSetAllowArchChange, dupAllowArchChange, _dup_allowarchchange, true )
117 ZOLV_FLAG_TRIBOOL( dupSetAllowVendorChange, dupAllowVendorChange, _dup_allowvendorchange, true )
119 #undef ZOLV_FLAG_TRIBOOL
258 _DEBUG (
"Resolver::verifySystem() ");
264 functor::functorRef<bool,PoolItem>(resetting) );
275 MIL <<
"*** undo ***" << endl;
278 functor::functorRef<bool,PoolItem>(info) );
292 static bool poolDumped =
false;
293 MIL <<
"-------------- Calling SAT Solver -------------------" << endl;
294 if ( getenv(
"ZYPP_FULLLOG") ) {
295 Testcase testcase(
"/var/log/YaST2/autoTestcase");
343 for (SolverQueueItemList::const_iterator iterQueue = queue.begin(); iterQueue != queue.end(); iterQueue++) {
344 if ( (*iterQueue)->cmp(*iter) == 0) {
345 MIL <<
"remove from queue" << *iter;
346 queue.remove(*iterQueue);
355 for (SolverQueueItemList::const_iterator iterQueue = queue.begin(); iterQueue != queue.end(); iterQueue++) {
356 if ( (*iterQueue)->cmp(*iter) == 0) {
362 MIL <<
"add to queue" << *iter;
363 queue.push_back(*iter);
389 MIL <<
"Resolver::problems()" << endl;
395 for_( iter, solutions.begin(), solutions.end() )
397 ProblemSolution_Ptr solution = *iter;
398 if ( !solution->apply( *
this ) )
412 for (PoolItemList::const_iterator instIter = itemsToInstall.begin();
413 instIter != itemsToInstall.end(); instIter++) {
418 for_( iter, possibleProviders.
begin(), possibleProviders.
end() ) {
423 bool alreadySetForInstallation =
false;
424 ItemCapKindMap::const_iterator pos =
_isInstalledBy.find(provider);
426 && pos->first == provider
428 alreadySetForInstallation =
true;
430 if (capKind.
item == *instIter) found =
true;
438 _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
442 _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
445 _installs.insert (make_pair( *instIter, capKindisInstalledBy));
463 for_( iter, possibleProviders.
begin(), possibleProviders.
end() ) {
468 bool alreadySetForInstallation =
false;
469 ItemCapKindMap::const_iterator pos =
_isInstalledBy.find(provider);
471 && pos->first == provider
473 alreadySetForInstallation =
true;
475 if (capKind.
item == *instIter) found =
true;
483 _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
487 _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
490 _installs.insert (make_pair( *instIter, capKindisInstalledBy));
507 for_( iter, possibleProviders.
begin(), possibleProviders.
end() ) {
511 bool alreadySetForInstallation =
false;
512 ItemCapKindMap::const_iterator pos =
_isInstalledBy.find(*instIter);
514 && pos->first == *instIter
516 alreadySetForInstallation =
true;
518 if (capKind.
item == provider) found =
true;
523 && instIter->status().isToBeInstalled()) {
524 if (instIter->status().isBySolver()) {
526 _isInstalledBy.insert (make_pair( *instIter, capKindisInstalledBy));
530 _isInstalledBy.insert (make_pair( *instIter, capKindisInstalledBy));
533 _installs.insert (make_pair( provider, capKindisInstalledBy));
536 if (instIter->status().staysInstalled()) {
559 if (iterItem == item) {
575 for (ItemCapKindMap::const_iterator iter =
_installs.find(item); iter !=
_installs.end();) {
578 if (iterItem == item) {
597 if (iterItem == item) {
616 if (iterItem == item) {
StringQueue autoInstalled() const
Return the ident strings of all packages that would be auto-installed after the transaction is run...
void removeExtraConflict(const Capability &capability)
ItemCapKindMap _isInstalledBy
std::list< ProblemSolution_Ptr > ProblemSolutionList
void setSolveSrcPackages(bool state_r)
bool operator()(PoolItem item)
const_iterator begin() const
void setCleandepsOnRemove(bool state_r)
Container of Solvable providing a Capability (read only).
static const Dep RECOMMENDS
static const Dep SUPPLEMENTS
void addExtraRequire(const Capability &capability)
ItemCapKindList isInstalledBy(const PoolItem &item)
bool ignoreAlreadyRecommended() const
void removeQueueItem(SolverQueueItem_Ptr item)
void addQueueItem(SolverQueueItem_Ptr item)
ResolverProblemList problems() const
static ZConfig & instance()
Singleton ctor.
PoolItemList problematicUpdateItems(void) const
bool onlyRequires() const
bool resolveQueue(SolverQueueItemList &queue)
void setAllowarchchange(const bool allowarchchange)
bool solveSrcPackages() const
void collectResolverInfo()
PoolItemList resultItemsToInstall()
void addExtraConflict(const Capability &capability)
void setAllowVendorChange(TriBool state_r)
UndoTransact(const ResStatus::TransactByValue &status)
CapabilitySet _extra_conflicts
int invokeOnEach(_Iterator begin_r, _Iterator end_r, _Filter filter_r, _Function fnc_r)
Iterate through [begin_r,end_r) and invoke fnc_r on each item that passes filter_r.
detail::CPool * get() const
Expert backdoor.
std::list< PoolItem > PoolItemList
Libsolv transaction wrapper.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
bool resetTransact(TransactByValue causer_r)
Not the same as setTransact( false ).
bool solver_cleandepsOnRemove() const
Whether removing a package should also remove no longer needed requirements.
Generating a testcase of the current pool and solver state.
const_iterator end() const
std::list< SolverQueueItem_Ptr > SolverQueueItemList
void reset(bool keepExtras=false)
SATResolver * _satResolver
void setUpdatesystem(const bool updatesystem)
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
void setOnlyRequires(const bool onlyRequires)
std::list< ResolverProblem_Ptr > ResolverProblemList
static Pool instance()
Singleton ctor.
solver::detail::SolverQueueItemList _removed_queue_items
const_iterator begin() const
Iterator pointing to the first Solvable.
void setAllowdowngrade(const bool allowdowngrade)
void setCleandepsOnRemove(TriBool state_r)
const_iterator end() const
Iterator pointing behind the last Solvable.
solver::detail::SolverQueueItemList _added_queue_items
sat::Transaction getTransaction()
ResStatus::TransactByValue resStatus
void setNoupdateprovide(const bool noupdateprovide)
std::unary_function< PoolItem, bool > PoolItemFilterFunctor
void addWeak(const PoolItem &item)
Interim helper class to collect global options and settings.
void removeExtraRequire(const Capability &capability)
void setAllowvendorchange(const bool allowvendorchange)
void setDistupgrade_removeunsupported(const bool distupgrade_removeunsupported)
virtual std::ostream & dumpOn(std::ostream &str) const
Overload to realize std::ostream & operator<<.
static const Dep REQUIRES
void setIgnorealreadyrecommended(const bool ignorealreadyrecommended)
ResStatus & status() const
Returns the current status.
void setOnlyRequires(TriBool state_r)
bool allowVendorChange() const
bool cleandepsOnRemove() const
void applySolutions(const ProblemSolutionList &solutions)
bool operator()(PoolItem item)
Select PoolItem by transact.
void setDosplitprovides(const bool dosplitprovides)
bool setTransact(bool toTansact_r, TransactByValue causer_r)
Toggle between TRANSACT and KEEP_STATE.
bool isVerifyingMode() const
ItemCapKindMap _satifiedByInstalled
bool solver_allowVendorChange() const
Whether vendor check is by default enabled.
bool solver_onlyRequires() const
Solver regards required packages,patterns,...
#define ZOLV_FLAG_TRIBOOL(ZSETTER, ZGETTER, ZVARNAME, ZVARDEFAULT)
bool resolveQueue(const SolverQueueItemList &requestQueue, const PoolItemList &weakItems)
sat::StringQueue autoInstalled() const
static constexpr LoadFromPoolType loadFromPool
std::list< ItemCapKind > ItemCapKindList
CapabilitySet _extra_requires
ResStatus::TransactByValue resStatus
ItemCapKindList installs(const PoolItem &item)
bool createTestcase(Resolver &resolver, bool dumpPool=true, bool runSolver=true)
bool isToBeInstalled() const
ItemCapKindMap _installedSatisfied
void setDistupgrade(const bool distupgrade)
bool resolvePool(const CapabilitySet &requires_caps, const CapabilitySet &conflict_caps, const PoolItemList &weakItems, const std::set< Repository > &upgradeRepos)
IMPL_PTR_TYPE(ProblemSolutionCombi)
std::set< Repository > _upgradeRepos
DoTransact(const ResStatus::TransactByValue &status)
Reference to a PoolItem connecting ResObject and ResStatus.
PoolItemList problematicUpdateItems() const
ItemCapKindList satifiedByInstalled(const PoolItem &item)
PoolItem find(const sat::Solvable &slv_r) const
Return the corresponding PoolItem.
ItemCapKindList installedSatisfied(const PoolItem &item)
void setAllowuninstall(const bool allowuninstall)
ResolverProblemList problems()
bool onlyRequires() const
Resolver(const ResPool &pool)
bool staysInstalled() const
bool forceResolve() const
static ResPool instance()
Singleton ctor.
void setFixsystem(const bool fixsystem)