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 ( false )
244 _DEBUG (
"Resolver::verifySystem() ");
250 functor::functorRef<bool,PoolItem>(resetting) );
262 MIL <<
"*** undo ***" << endl;
265 functor::functorRef<bool,PoolItem>(info) );
279 static bool poolDumped =
false;
280 MIL <<
"-------------- Calling SAT Solver -------------------" << endl;
281 if ( getenv(
"ZYPP_FULLLOG") ) {
282 Testcase testcase(
"/var/log/YaST2/autoTestcase");
330 for (SolverQueueItemList::const_iterator iterQueue = queue.begin(); iterQueue != queue.end(); iterQueue++) {
331 if ( (*iterQueue)->cmp(*iter) == 0) {
332 MIL <<
"remove from queue" << *iter;
333 queue.remove(*iterQueue);
342 for (SolverQueueItemList::const_iterator iterQueue = queue.begin(); iterQueue != queue.end(); iterQueue++) {
343 if ( (*iterQueue)->cmp(*iter) == 0) {
349 MIL <<
"add to queue" << *iter;
350 queue.push_back(*iter);
373 MIL <<
"Resolver::problems()" << endl;
379 for_( iter, solutions.begin(), solutions.end() )
381 ProblemSolution_Ptr solution = *iter;
382 if ( !solution->apply( *
this ) )
396 for (PoolItemList::const_iterator instIter = itemsToInstall.begin();
397 instIter != itemsToInstall.end(); instIter++) {
402 for_( iter, possibleProviders.
begin(), possibleProviders.
end() ) {
407 bool alreadySetForInstallation =
false;
408 ItemCapKindMap::const_iterator pos =
_isInstalledBy.find(provider);
410 && pos->first == provider
412 alreadySetForInstallation =
true;
414 if (capKind.
item == *instIter) found =
true;
422 _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
426 _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
429 _installs.insert (make_pair( *instIter, capKindisInstalledBy));
447 for_( iter, possibleProviders.
begin(), possibleProviders.
end() ) {
452 bool alreadySetForInstallation =
false;
453 ItemCapKindMap::const_iterator pos =
_isInstalledBy.find(provider);
455 && pos->first == provider
457 alreadySetForInstallation =
true;
459 if (capKind.
item == *instIter) found =
true;
467 _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
471 _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
474 _installs.insert (make_pair( *instIter, capKindisInstalledBy));
491 for_( iter, possibleProviders.
begin(), possibleProviders.
end() ) {
495 bool alreadySetForInstallation =
false;
496 ItemCapKindMap::const_iterator pos =
_isInstalledBy.find(*instIter);
498 && pos->first == *instIter
500 alreadySetForInstallation =
true;
502 if (capKind.
item == provider) found =
true;
507 && instIter->status().isToBeInstalled()) {
508 if (instIter->status().isBySolver()) {
510 _isInstalledBy.insert (make_pair( *instIter, capKindisInstalledBy));
514 _isInstalledBy.insert (make_pair( *instIter, capKindisInstalledBy));
517 _installs.insert (make_pair( provider, capKindisInstalledBy));
520 if (instIter->status().staysInstalled()) {
543 if (iterItem == item) {
559 for (ItemCapKindMap::const_iterator iter =
_installs.find(item); iter !=
_installs.end();) {
562 if (iterItem == item) {
581 if (iterItem == item) {
600 if (iterItem == item) {
::_Pool * get() const
Expert backdoor.
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.
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,...
bool resolveQueue(const SolverQueueItemList &requestQueue, const PoolItemList &weakItems)
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)