Mailinglist Archive: zypp-commit (301 mails)

< Previous Next >
[zypp-commit] r7538 - in /trunk/sat-solver/src: solver.c solver.h
  • From: mlschroe@xxxxxxxxxxxxxxxx
  • Date: Mon, 15 Oct 2007 13:25:31 -0000
  • Message-id: <20071015132531.497E4456BC@xxxxxxxxxxxxxxxx>
Author: mlschroe
Date: Mon Oct 15 15:25:30 2007
New Revision: 7538

URL: http://svn.opensuse.org/viewcvs/zypp?rev=7538&view=rev
Log:
also prune to suggests/enhances, fixes tpctl testcases

Modified:
    trunk/sat-solver/src/solver.c
    trunk/sat-solver/src/solver.h

Modified: trunk/sat-solver/src/solver.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/solver.c?rev=7538&r1=7537&r2=7538&view=diff
==============================================================================
--- trunk/sat-solver/src/solver.c (original)
+++ trunk/sat-solver/src/solver.c Mon Oct 15 15:25:30 2007
@@ -117,11 +117,12 @@
   Pool *pool = solv->pool;
   int i, j;
   Solvable *s;
-  Id p, *pp, sup, *supp, rec, *recp;
+  Id p, *pp, sup, *supp, rec, *recp, sug, *sugp, enh, *enhp;
 
   if (solv->recommends_index < 0)
     {
       MAPZERO(&solv->recommends);
+      MAPZERO(&solv->suggests);
       solv->recommends_index = 0;
     }
   while (solv->recommends_index < solv->decisionq.count)
@@ -130,12 +131,16 @@
       if (p < 0)
        continue;
       s = pool->solvables + p;
-      if (!(recp = s->recommends))
-       continue;
-      while ((rec = *recp++) != 0)
-       FOR_PROVIDES(p, pp, rec)
-         MAPSET(&solv->recommends, p);
+      if ((recp = s->recommends) != 0)
+        while ((rec = *recp++) != 0)
+         FOR_PROVIDES(p, pp, rec)
+           MAPSET(&solv->recommends, p);
+      if ((sugp = s->suggests) != 0)
+        while ((sug = *sugp++) != 0)
+         FOR_PROVIDES(p, pp, sug)
+           MAPSET(&solv->suggests, p);
     }
+  /* prune to recommended/supplemented */
   for (i = j = 0; i < plist->count; i++)
     {
       p = plist->elements[i];
@@ -167,6 +172,30 @@
     }
   if (j)
     plist->count = j;
+
+  /* prune to suggested/enhanced*/
+  if (plist->count < 2)
+    return;
+  for (i = j = 0; i < plist->count; i++)
+    {
+      p = plist->elements[i];
+      if (MAPTST(&solv->suggests, p))
+       {
+         plist->elements[j++] = p;
+         continue;
+       }
+      s = pool->solvables + p;
+      if (!(enhp = s->enhances))
+       continue;
+      while ((enh = *enhp++) != 0)
+       if (dep_fulfilled(solv, enh))
+         break;
+      if (!enh)
+       continue;
+      plist->elements[j++] = s - pool->solvables;
+    }
+  if (j)
+    plist->count = j;
 }
 
 /*
@@ -1693,6 +1722,7 @@
   queueinit(&solv->learnt_pool);
 
   mapinit(&solv->recommends, pool->nsolvables);
+  mapinit(&solv->suggests, pool->nsolvables);
   solv->recommends_index = 0;
 
   solv->decisionmap = (Id *)xcalloc(pool->nsolvables, sizeof(Id));
@@ -1716,6 +1746,7 @@
   queuefree(&solv->learnt_why);
   queuefree(&solv->learnt_pool);
   mapfree(&solv->recommends);
+  mapfree(&solv->suggests);
   xfree(solv->decisionmap);
   xfree(solv->rules);
   xfree(solv->watches);

Modified: trunk/sat-solver/src/solver.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/solver.h?rev=7538&r1=7537&r2=7538&view=diff
==============================================================================
--- trunk/sat-solver/src/solver.h (original)
+++ trunk/sat-solver/src/solver.h Mon Oct 15 15:25:30 2007
@@ -77,6 +77,7 @@
   Queue problems;
 
   Map recommends;                      /* recommended packages from decisionmap */
+  Map suggests;                                /* suggested packages from decisionmap */
   int recommends_index;                        /* recommended level */
 
   int rc_output;                       /* output result compatible to redcarpet/zypp testsuite, set == 2 for pure rc (will suppress architecture) */

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages