- add "showinstalledrecommended" option to make the solver
authorMichael Schroeder <mls@suse.de>
Wed, 23 Apr 2008 09:13:14 +0000 (09:13 +0000)
committerMichael Schroeder <mls@suse.de>
Wed, 23 Apr 2008 09:13:14 +0000 (09:13 +0000)
  put installed packages on the suggestions/recommendations
  queues

src/solver.c
src/solver.h
src/solverdebug.c

index ccb1ee2..17a6d2d 100644 (file)
@@ -3592,11 +3592,11 @@ solver_solve(Solver *solv, Queue *job)
   /* find recommended packages */
   /* if redoq.count == 0 we already found all recommended in the
    * solver run */
-  if (redoq.count || solv->dontinstallrecommended)
+  if (redoq.count || solv->dontinstallrecommended || solv->showinstalledrecommended)
     {
       Id rec, *recp, p, *pp;
 
-      /* create map of all suggests that are still open */
+      /* create map of all recommened packages */
       solv->recommends_index = -1;
       MAPZERO(&solv->recommendsmap);
       for (i = 0; i < solv->decisionq.count; i++)
@@ -3614,7 +3614,15 @@ solver_solve(Solver *solv, Queue *job)
                    if (solv->decisionmap[p] > 0)
                      break;
                  if (p)
-                   continue;   /* p != 0: already fulfilled */
+                   {
+                     if (solv->showinstalledrecommended)
+                       {
+                         FOR_PROVIDES(p, pp, rec)
+                           if (solv->decisionmap[p] > 0)
+                             MAPSET(&solv->recommendsmap, p);
+                       }
+                     continue; /* p != 0: already fulfilled */
+                   }
                  FOR_PROVIDES(p, pp, rec)
                    MAPSET(&solv->recommendsmap, p);
                }
@@ -3622,7 +3630,9 @@ solver_solve(Solver *solv, Queue *job)
        }
       for (i = 1; i < pool->nsolvables; i++)
        {
-         if (solv->decisionmap[i] != 0)
+         if (solv->decisionmap[i] < 0)
+           continue;
+         if (solv->decisionmap[i] > 0 && !solv->showinstalledrecommended)
            continue;
          s = pool->solvables + i;
          if (!MAPTST(&solv->recommendsmap, i))
@@ -3666,7 +3676,15 @@ solver_solve(Solver *solv, Queue *job)
                    if (solv->decisionmap[p] > 0)
                      break;
                  if (p)
-                   continue;   /* already fulfilled */
+                   {
+                     if (solv->showinstalledrecommended)
+                       {
+                         FOR_PROVIDES(p, pp, sug)
+                           if (solv->decisionmap[p] > 0)
+                             MAPSET(&solv->suggestsmap, p);
+                       }
+                     continue; /* already fulfilled */
+                   }
                  FOR_PROVIDES(p, pp, sug)
                    MAPSET(&solv->suggestsmap, p);
                }
@@ -3674,7 +3692,9 @@ solver_solve(Solver *solv, Queue *job)
        }
       for (i = 1; i < pool->nsolvables; i++)
        {
-         if (solv->decisionmap[i] != 0)
+         if (solv->decisionmap[i] < 0)
+           continue;
+         if (solv->decisionmap[i] > 0 && !solv->showinstalledrecommended)
            continue;
          s = pool->solvables + i;
          if (!MAPTST(&solv->suggestsmap, i))
index c1c2ea2..df5f35b 100644 (file)
@@ -113,8 +113,6 @@ typedef struct solver {
   Id *obsoletes;                       /* obsoletes for each installed solvable */
   Id *obsoletes_data;                  /* data area for obsoletes */
 
-  Queue covenantq;                      /* Covenants honored by this solver (generic locks) */
-
   /*-------------------------------------------------------------------------------------------------------------
    * Solver configuration
    *-------------------------------------------------------------------------------------------------------------*/
@@ -130,6 +128,7 @@ typedef struct solver {
   int noupdateprovide;                 /* true: update packages needs not to provide old package */
   int dosplitprovides;                 /* true: consider legacy split provides */
   int dontinstallrecommended;          /* true: do not install recommended packages */
+  int showinstalledrecommended;                /* true: add recommened packages that are already installed to the lists */
   
   /* Callbacks for defining the bahaviour of the SAT solver */
 
@@ -170,6 +169,11 @@ typedef struct solver {
    */
    UpdateCandidateCb   updateCandidateCb;
     
+
+  /* some strange queue that doesn't belong here */
+
+  Queue covenantq;                      /* Covenants honored by this solver (generic locks) */
+
   
 } Solver;
 
index 5676457..9ff2023 100644 (file)
@@ -314,7 +314,15 @@ solver_printdecisions(Solver *solv)
       for (i = 0; i < solv->recommendations.count; i++)
        {
          s = pool->solvables + solv->recommendations.elements[i];
-         POOL_DEBUG(SAT_DEBUG_RESULT, "- %s%s\n", solvable2str(pool, s), solv->decisionmap[solv->recommendations.elements[i]] > 0 ? " (selected)" : "");
+          if (solv->decisionmap[solv->recommendations.elements[i]] > 0)
+           {
+             if (installed && s->repo == installed)
+               POOL_DEBUG(SAT_DEBUG_RESULT, "- %s (installed)\n", solvable2str(pool, s));
+             else
+               POOL_DEBUG(SAT_DEBUG_RESULT, "- %s (selected)\n", solvable2str(pool, s));
+           }
+          else
+           POOL_DEBUG(SAT_DEBUG_RESULT, "- %s\n", solvable2str(pool, s));
        }
     }
 
@@ -324,7 +332,15 @@ solver_printdecisions(Solver *solv)
       for (i = 0; i < solv->suggestions.count; i++)
        {
          s = pool->solvables + solv->suggestions.elements[i];
-         POOL_DEBUG(SAT_DEBUG_RESULT, "- %s\n", solvable2str(pool, s));
+          if (solv->decisionmap[solv->suggestions.elements[i]] > 0)
+           {
+             if (installed && s->repo == installed)
+               POOL_DEBUG(SAT_DEBUG_RESULT, "- %s (installed)\n", solvable2str(pool, s));
+             else
+               POOL_DEBUG(SAT_DEBUG_RESULT, "- %s (selected)\n", solvable2str(pool, s));
+           }
+         else
+           POOL_DEBUG(SAT_DEBUG_RESULT, "- %s\n", solvable2str(pool, s));
        }
     }
 }