From: Stefan Schubert Date: Thu, 10 Apr 2008 08:20:17 +0000 (+0000) Subject: added isRelevant X-Git-Tag: 6.6.0~1119 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bd77232fa21ed123c84ce48a9cdee7375c34dc87;p=platform%2Fupstream%2Flibzypp.git added isRelevant --- diff --git a/zypp/PoolItem.cc b/zypp/PoolItem.cc index 958b451a2..0ccc861a9 100644 --- a/zypp/PoolItem.cc +++ b/zypp/PoolItem.cc @@ -59,6 +59,11 @@ namespace zypp return _resolvable->isSatisfied(); } + bool isRelevant() const + { + return _resolvable->isRelevant(); + } + private: mutable ResStatus _status; ResObject::constPtr _resolvable; diff --git a/zypp/PoolItem.h b/zypp/PoolItem.h index ef21e2ecb..7abb2afd3 100644 --- a/zypp/PoolItem.h +++ b/zypp/PoolItem.h @@ -82,6 +82,11 @@ namespace zypp bool isBroken() const { return ! isSatisfied(); } + /** Returns true if the solvable is relevant which means e.G. for patches + * that at least one package of the patch is installed. + */ + bool isRelevant() const; + public: /** Return the \ref ResPool the item belongs to. */ ResPool pool() const; diff --git a/zypp/Resolvable.h b/zypp/Resolvable.h index dbe498ac2..55d8f0f7f 100644 --- a/zypp/Resolvable.h +++ b/zypp/Resolvable.h @@ -84,8 +84,14 @@ namespace zypp public: /** Returns true if the solvable is satisfied */ using sat::Solvable::isSatisfied; + /** Returns true if the solvable is satisfied */ - using sat::Solvable::isBroken; + using sat::Solvable::isBroken; + + /** Returns true if the solvable is relevant which means e.G. for patches + * that at least one package of the patch is installed. + */ + using sat::Solvable::isRelevant; public: const sat::Solvable & satSolvable() const { return *this; } diff --git a/zypp/sat/Solvable.cc b/zypp/sat/Solvable.cc index 01e12b730..80d488b0c 100644 --- a/zypp/sat/Solvable.cc +++ b/zypp/sat/Solvable.cc @@ -393,6 +393,18 @@ namespace zypp return false; } + bool Solvable::isRelevant() const + { + 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; + } + + /////////////////////////////////////////////////////////////////// namespace { ///////////////////////////////////////////////////////////////// diff --git a/zypp/sat/Solvable.h b/zypp/sat/Solvable.h index d7ce9c4fb..6011c0555 100644 --- a/zypp/sat/Solvable.h +++ b/zypp/sat/Solvable.h @@ -182,6 +182,10 @@ namespace zypp bool isSatisfied() const; /** Returns true if the solvable is satisfied */ bool isBroken() const { return !isSatisfied(); } + /** Returns true if the solvable is relevant which means e.G. for patches + * that at least one package of the patch is installed. + */ + bool isRelevant() const; public: /** \name Locale support. */