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

index 0ccc861..4850edb 100644 (file)
@@ -64,6 +64,11 @@ namespace zypp
         return _resolvable->isRelevant();
       }
 
+      bool validate() const
+      {
+        return _resolvable->validate();
+      }      
+
     private:
       mutable ResStatus     _status;
       ResObject::constPtr   _resolvable;
index 7abb2af..acfc1e7 100644 (file)
@@ -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;
index 55d8f0f..1be9cb1 100644 (file)
@@ -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; }
 
index 80d488b..62ca705 100644 (file)
@@ -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;    
     }
       
 
index 6011c05..b91ebbc 100644 (file)
@@ -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. */
         //@{