From: Stefan Schubert Date: Mon, 21 Apr 2008 08:50:25 +0000 (+0000) Subject: added weak X-Git-Tag: 6.6.0~1021 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ad46eb75259dc943e1cee0de62e1e81a7f0fc87e;p=platform%2Fupstream%2Flibzypp.git added weak --- diff --git a/zypp/solver/detail/SolverQueueItemInstallOneOf.cc b/zypp/solver/detail/SolverQueueItemInstallOneOf.cc index 4e8180d9d..3ba523dba 100644 --- a/zypp/solver/detail/SolverQueueItemInstallOneOf.cc +++ b/zypp/solver/detail/SolverQueueItemInstallOneOf.cc @@ -41,7 +41,7 @@ IMPL_PTR_TYPE(SolverQueueItemInstallOneOf); std::ostream & SolverQueueItemInstallOneOf::dumpOn( std::ostream & os ) const { - os << "[" << "InstallOneOf: "; + os << "[" << (_soft?"Soft":"") << "InstallOneOf: "; for (PoolItemList::const_iterator iter = _oneOfList.begin(); iter != _oneOfList.end(); iter++) @@ -53,9 +53,11 @@ SolverQueueItemInstallOneOf::dumpOn( std::ostream & os ) const //--------------------------------------------------------------------------- -SolverQueueItemInstallOneOf::SolverQueueItemInstallOneOf (const ResPool & pool, const PoolItemList & itemList) +SolverQueueItemInstallOneOf::SolverQueueItemInstallOneOf (const ResPool & pool, const PoolItemList & itemList, + bool soft) : SolverQueueItem (QUEUE_ITEM_TYPE_INSTALL_ONE_OF, pool) , _oneOfList (itemList) + , _soft (soft) { } @@ -69,8 +71,14 @@ SolverQueueItemInstallOneOf::~SolverQueueItemInstallOneOf() bool SolverQueueItemInstallOneOf::addRule (_Queue & q) { bool ret = true; - MIL << "Install one of: " << endl; - queue_push( &(q), SOLVER_INSTALL_SOLVABLE_ONE_OF ); + MIL << "Install one of " << (_soft ? "(soft):" : ":")<< endl; + + if (_soft) { + queue_push( &(q), SOLVER_INSTALL_SOLVABLE_ONE_OF | SOLVER_WEAK); + } else { + queue_push( &(q), SOLVER_INSTALL_SOLVABLE_ONE_OF ); + } + for (PoolItemList::const_iterator iter = _oneOfList.begin(); iter != _oneOfList.end(); iter++) { Id id = (*iter)->satSolvable().id(); if (id == ID_NULL) { @@ -91,6 +99,7 @@ SolverQueueItemInstallOneOf::copy (void) const { SolverQueueItemInstallOneOf_Ptr new_installOneOf = new SolverQueueItemInstallOneOf (pool(), _oneOfList); new_installOneOf->SolverQueueItem::copy(this); + new_installOneOf->_soft = _soft; return new_installOneOf; } diff --git a/zypp/solver/detail/SolverQueueItemInstallOneOf.h b/zypp/solver/detail/SolverQueueItemInstallOneOf.h index b94fcddcf..bd1f5025e 100644 --- a/zypp/solver/detail/SolverQueueItemInstallOneOf.h +++ b/zypp/solver/detail/SolverQueueItemInstallOneOf.h @@ -48,10 +48,11 @@ class SolverQueueItemInstallOneOf : public SolverQueueItem { private: PoolItemList _oneOfList; // List of candidates + bool _soft; // if triggered by a soft requirement (a recommends) public: - SolverQueueItemInstallOneOf (const ResPool & pool, const PoolItemList & itemList); + SolverQueueItemInstallOneOf (const ResPool & pool, const PoolItemList & itemList, bool soft = false); virtual ~SolverQueueItemInstallOneOf(); // ---------------------------------- I/O @@ -61,6 +62,10 @@ class SolverQueueItemInstallOneOf : public SolverQueueItem { friend std::ostream& operator<<(std::ostream & str, const SolverQueueItemInstallOneOf & obj) { return obj.dumpOn (str); } + // ---------------------------------- accessors + + bool isSoft (void) const { return _soft; } + // ---------------------------------- methods virtual bool addRule (_Queue & q);