added isRelevant
authorStefan Schubert <schubi@suse.de>
Thu, 10 Apr 2008 08:20:17 +0000 (08:20 +0000)
committerStefan Schubert <schubi@suse.de>
Thu, 10 Apr 2008 08:20:17 +0000 (08:20 +0000)
zypp/PoolItem.cc
zypp/PoolItem.h
zypp/Resolvable.h
zypp/sat/Solvable.cc
zypp/sat/Solvable.h

index 958b451..0ccc861 100644 (file)
@@ -59,6 +59,11 @@ namespace zypp
         return _resolvable->isSatisfied();
       }
 
+      bool isRelevant() const
+      {
+        return _resolvable->isRelevant();
+      }
+
     private:
       mutable ResStatus     _status;
       ResObject::constPtr   _resolvable;
index ef21e2e..7abb2af 100644 (file)
@@ -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;
index dbe498a..55d8f0f 100644 (file)
@@ -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; }
index 01e12b7..80d488b 100644 (file)
@@ -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
     { /////////////////////////////////////////////////////////////////
index d7ce9c4..6011c05 100644 (file)
@@ -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. */