From: Stefan Schubert Date: Thu, 10 Apr 2008 10:01:13 +0000 (+0000) Subject: added validate X-Git-Tag: 6.6.0~1118 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9e902594c0548a7b0dc34a1d82eb8fdf7718d85e;p=platform%2Fupstream%2Flibzypp.git added validate --- diff --git a/zypp/PoolItem.cc b/zypp/PoolItem.cc index 0ccc861a9..4850edb9c 100644 --- a/zypp/PoolItem.cc +++ b/zypp/PoolItem.cc @@ -64,6 +64,11 @@ namespace zypp return _resolvable->isRelevant(); } + bool validate() const + { + return _resolvable->validate(); + } + private: mutable ResStatus _status; ResObject::constPtr _resolvable; diff --git a/zypp/PoolItem.h b/zypp/PoolItem.h index 7abb2afd3..acfc1e730 100644 --- a/zypp/PoolItem.h +++ b/zypp/PoolItem.h @@ -87,6 +87,12 @@ namespace zypp */ 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; diff --git a/zypp/Resolvable.h b/zypp/Resolvable.h index 55d8f0f7f..1be9cb1ae 100644 --- a/zypp/Resolvable.h +++ b/zypp/Resolvable.h @@ -93,6 +93,12 @@ namespace zypp */ 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; } diff --git a/zypp/sat/Solvable.cc b/zypp/sat/Solvable.cc index 80d488b0c..62ca70505 100644 --- a/zypp/sat/Solvable.cc +++ b/zypp/sat/Solvable.cc @@ -384,13 +384,21 @@ namespace zypp /////////////////////////////////////////////////////////////////// + ValidValue Solvable::validate() const + { + 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 NOTRELEVANT; + } + bool Solvable::isSatisfied() const { - NO_SOLVABLE_RETURN( false ); - if (solvable_trivial_installable (_solvable, Pool::instance().systemRepo().get()) == 1) - return true; - else - return false; + return validate() == SATISFIED; } bool Solvable::isRelevant() const @@ -398,10 +406,8 @@ namespace zypp 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; } diff --git a/zypp/sat/Solvable.h b/zypp/sat/Solvable.h index 6011c0555..b91ebbc66 100644 --- a/zypp/sat/Solvable.h +++ b/zypp/sat/Solvable.h @@ -34,6 +34,8 @@ namespace zypp class CheckSum; class OnMediaLocation; + enum ValidValue { BROKEN, SATISFIED, NOTRELEVANT }; + /////////////////////////////////////////////////////////////////// namespace sat { ///////////////////////////////////////////////////////////////// @@ -187,6 +189,13 @@ namespace zypp */ 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. */ //@{