regarding recommend/suggest settings from the SAT-solver
authorStefan Schubert <schubi@suse.de>
Thu, 27 Mar 2008 17:25:25 +0000 (17:25 +0000)
committerStefan Schubert <schubi@suse.de>
Thu, 27 Mar 2008 17:25:25 +0000 (17:25 +0000)
zypp/ResStatus.cc
zypp/ResStatus.h
zypp/sat/SATResolver.cc

index a0fa4b0fb22ad0dbe3e1b7dfba1e8bc7f762b9f4..5ae71b082a2ba9efb682f760b84316ab8d64c77b 100644 (file)
@@ -33,6 +33,8 @@ namespace zypp
   const ResStatus ResStatus::satisfied                  (UNINSTALLED, SATISFIED);
   const ResStatus ResStatus::unneeded                   (UNINSTALLED, UNNEEDED);
   const ResStatus ResStatus::needed                     (UNINSTALLED, INCOMPLETE);
+  const ResStatus ResStatus::recommended                (RECOMMENDED);
+  const ResStatus ResStatus::suggested                  (SUGGESTED);        
 
   ///////////////////////////////////////////////////////////////////
   //
index 58040b93e0a3c0031392f8abaa72056ed38b3fe1..2dfb11dd453b17afe8a4feae1dde991700c4fd53 100644 (file)
@@ -639,6 +639,8 @@ namespace zypp
     static const ResStatus unneeded;   // uninstalled, unneeded
     static const ResStatus needed;     // uninstalled, incomplete
     static const ResStatus incomplete; // installed, incomplete
+    static const ResStatus recommended;        // recommended
+    static const ResStatus suggested;  // suggested      
     //@}
 
   private:
index 70d0011db449678db764d8c5304341820be77fe4..4a10bc346791546891a29e60be8a6ff6cb63ba4e 100644 (file)
@@ -249,6 +249,14 @@ SATSolutionToPool (PoolItem item, const ResStatus & status, const ResStatus::Tra
     else if (status.isSatisfied()) {
        r = item.status().setSatisfied();
        _XDEBUG("SATSolutionToPool(" << item << ", " << status << ") satisfied !" << r);
+    }
+    else if (status.isRecommended()) {
+       item.status().setRecommended(true);
+       _XDEBUG("SATSolutionToPool(" << item << ", " << status << ") recommended !" << r);
+    }
+    else if (status.isSuggested()) {
+       item.status().setSuggested(true);
+       _XDEBUG("SATSolutionToPool(" << item << ", " << status << ") suggested !" << r);        
     } else {
        _XDEBUG("SATSolutionToPool(" << item << ", " << status << ") unchanged !");
     }
@@ -505,6 +513,38 @@ SATResolver::resolvePool(const CapabilitySet & requires_caps,
       }
     }
 
+    /*  solvables which are recommended */
+    for (int i = 0; i < _solv->recommendations.count; i++)
+    {
+      Id p;
+      p = _solv->recommendations.elements[i];
+      if (p < 0 || !sat::Solvable(p))
+       continue;
+
+      PoolItem poolItem = _pool.find (sat::Solvable(p));
+      if (poolItem) {
+         SATSolutionToPool (poolItem, ResStatus::recommended, ResStatus::SOLVER);
+      } else {
+         ERR << "id " << p << " not found in ZYPP pool." << endl;
+      }
+    }
+
+    /*  solvables which are suggested */
+    for (int i = 0; i < _solv->suggestions.count; i++)
+    {
+      Id p;
+      p = _solv->suggestions.elements[i];
+      if (p < 0 || !sat::Solvable(p))
+       continue;
+
+      PoolItem poolItem = _pool.find (sat::Solvable(p));
+      if (poolItem) {
+         SATSolutionToPool (poolItem, ResStatus::suggested, ResStatus::SOLVER);
+      } else {
+         ERR << "id " << p << " not found in ZYPP pool." << endl;
+      }
+    }
+
     // cleanup
     solver_free(_solv);
     _solv = NULL;