Author: schubi2 Date: Thu Apr 10 12:01:13 2008 New Revision: 9501 URL: http://svn.opensuse.org/viewcvs/zypp?rev=9501&view=rev Log: added validate Modified: trunk/libzypp/zypp/PoolItem.cc trunk/libzypp/zypp/PoolItem.h trunk/libzypp/zypp/Resolvable.h trunk/libzypp/zypp/sat/Solvable.cc trunk/libzypp/zypp/sat/Solvable.h Modified: trunk/libzypp/zypp/PoolItem.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/PoolItem.cc?rev=9501... ============================================================================== --- trunk/libzypp/zypp/PoolItem.cc (original) +++ trunk/libzypp/zypp/PoolItem.cc Thu Apr 10 12:01:13 2008 @@ -64,6 +64,11 @@ return _resolvable->isRelevant(); } + bool validate() const + { + return _resolvable->validate(); + } + private: mutable ResStatus _status; ResObject::constPtr _resolvable; Modified: trunk/libzypp/zypp/PoolItem.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/PoolItem.h?rev=9501&... ============================================================================== --- trunk/libzypp/zypp/PoolItem.h (original) +++ trunk/libzypp/zypp/PoolItem.h Thu Apr 10 12:01:13 2008 @@ -87,6 +87,12 @@ */ bool isRelevant() const; + /** Check if the solvable is satisfied,broken or not relevant + * (not important, so it can be ignored) + * \return BROKEN, SATISFIED, NOTRELEVANT + */ + ValidValue validate() const; + public: /** Return the \ref ResPool the item belongs to. */ ResPool pool() const; Modified: trunk/libzypp/zypp/Resolvable.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Resolvable.h?rev=950... ============================================================================== --- trunk/libzypp/zypp/Resolvable.h (original) +++ trunk/libzypp/zypp/Resolvable.h Thu Apr 10 12:01:13 2008 @@ -93,6 +93,12 @@ */ using sat::Solvable::isRelevant; + /** Check if the solvable is satisfied,broken or not relevant + * (not important, so it can be ignored) + * \return BROKEN, SATISFIED, NOTRELEVANT + */ + using sat::Solvable::validate; + public: const sat::Solvable & satSolvable() const { return *this; } Modified: trunk/libzypp/zypp/sat/Solvable.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/Solvable.cc?rev=... ============================================================================== --- trunk/libzypp/zypp/sat/Solvable.cc (original) +++ trunk/libzypp/zypp/sat/Solvable.cc Thu Apr 10 12:01:13 2008 @@ -384,13 +384,21 @@ /////////////////////////////////////////////////////////////////// - bool Solvable::isSatisfied() const + ValidValue Solvable::validate() const { - NO_SOLVABLE_RETURN( false ); - if (solvable_trivial_installable (_solvable, Pool::instance().systemRepo().get()) == 1) - return true; + NO_SOLVABLE_RETURN( NOTRELEVANT ); + int ret = solvable_trivial_installable (_solvable, Pool::instance().systemRepo().get()); + if (ret == 0) + return BROKEN; + else if (ret > 0) + return SATISFIED; else - return false; + return NOTRELEVANT; + } + + bool Solvable::isSatisfied() const + { + return validate() == SATISFIED; } bool Solvable::isRelevant() const @@ -398,10 +406,8 @@ NO_SOLVABLE_RETURN( false ); if (isKind (ResKind::package)) return true; // packages are always relevant - if (solvable_trivial_installable (_solvable, Pool::instance().systemRepo().get()) == -1) - return false; - else - return true; + + return validate() == BROKEN; } Modified: trunk/libzypp/zypp/sat/Solvable.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/Solvable.h?rev=9... ============================================================================== --- trunk/libzypp/zypp/sat/Solvable.h (original) +++ trunk/libzypp/zypp/sat/Solvable.h Thu Apr 10 12:01:13 2008 @@ -34,6 +34,8 @@ class CheckSum; class OnMediaLocation; + enum ValidValue { BROKEN, SATISFIED, NOTRELEVANT }; + /////////////////////////////////////////////////////////////////// namespace sat { ///////////////////////////////////////////////////////////////// @@ -187,6 +189,13 @@ */ bool isRelevant() const; + /** Check if the solvable is satisfied,broken or not relevant + * (not important, so it can be ignored) + * \return BROKEN, SATISFIED, NOTRELEVANT + */ + + ValidValue validate() const; + public: /** \name Locale support. */ //@{ -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org