Mailinglist Archive: zypp-commit (301 mails)

< Previous Next >
[zypp-commit] r7547 - in /trunk/sat-solver: src/pool.c src/pool.h src/solver.c testsuite/deptestomatic.c testsuite/yps.c
  • From: mlschroe@xxxxxxxxxxxxxxxx
  • Date: Wed, 17 Oct 2007 15:59:55 -0000
  • Message-id: <20071017155955.BCFF923E53@xxxxxxxxxxxxxxxx>
Author: mlschroe
Date: Wed Oct 17 17:59:55 2007
New Revision: 7547

URL: http://svn.opensuse.org/viewcvs/zypp?rev=7547&view=rev
Log:
- added pool_installable() inline function
- renamed addrelproviders() to pool_addrelproviders()
- also use dep_possible() in enhances
- print statistics about solvable reduction
- check is suggested packages are really installable

Modified:
    trunk/sat-solver/src/pool.c
    trunk/sat-solver/src/pool.h
    trunk/sat-solver/src/solver.c
    trunk/sat-solver/testsuite/deptestomatic.c
    trunk/sat-solver/testsuite/yps.c

Modified: trunk/sat-solver/src/pool.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/pool.c?rev=7547&r1=7546&r2=7547&view=diff
==============================================================================
--- trunk/sat-solver/src/pool.c (original)
+++ trunk/sat-solver/src/pool.c Wed Oct 17 17:59:55 2007
@@ -135,7 +135,7 @@
   oa = pool->whatprovides[*(Id *)ap];
   ob = pool->whatprovides[*(Id *)bp];
   if (oa == ob)
-    return 0;
+    return *(Id *)ap - *(Id *)bp;
   if (!oa)
     return -1;
   if (!ob)
@@ -147,7 +147,7 @@
       return r;
   if (*da)
     return *da;
-  return oa - ob;
+  return *(Id *)ap - *(Id *)bp;
 }
 
 static void
@@ -265,13 +265,11 @@
     {
       Id *pp;
       s = pool->solvables + i;
-      if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC)
-       continue;               /* sources do not provide anything */
-      if (pool->id2arch && (s->arch > pool->lastarch || !pool->id2arch[s->arch]))
-       continue;               /* architecture not installable */
       pp = s->provides;
       if (!pp)                 /* solvable does not provide anything */
        continue;
+      if (!pool_installable(pool, s))
+       continue;
       while ((id = *pp++) != ID_NULL)
        {
          if (ISRELDEP(id))
@@ -314,13 +312,11 @@
     {
       Id *pp;
       s = pool->solvables + i;
-      if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC)
-       continue;               /* sources do not provide anything */
-      if (pool->id2arch && (s->arch > pool->lastarch || !pool->id2arch[s->arch]))
-       continue;               /* architecture not installable */
       pp = s->provides;
       if (!pp)                        /* solvable does not provide anything */
        continue;
+      if (!pool_installable(pool, s))
+       continue;
 
       /* for all provides of this solvable */
       while ((id = *pp++) != 0)
@@ -405,7 +401,7 @@
  */
 
 Id *
-addrelproviders(Pool *pool, Id d)
+pool_addrelproviders(Pool *pool, Id d)
 {
   Reldep *rd = GETRELDEP(pool, d);
   Reldep *prd;

Modified: trunk/sat-solver/src/pool.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/pool.h?rev=7547&r1=7546&r2=7547&view=diff
==============================================================================
--- trunk/sat-solver/src/pool.h (original)
+++ trunk/sat-solver/src/pool.h Wed Oct 17 17:59:55 2007
@@ -102,7 +102,7 @@
 #define GET_PROVIDESP(d, v) (ISRELDEP(d) ?                             \
              (v = GETRELID(pool, d), pool->whatprovides[v] ?                \
                pool->whatprovidesdata + pool->whatprovides[v] :          \
-              addrelproviders(pool, d)                                 \
+              pool_addrelproviders(pool, d)                            \
              ) :                                                       \
              (pool->whatprovidesdata + pool->whatprovides[d]))
 
@@ -133,10 +133,19 @@
 extern void pool_freewhatprovides(Pool *pool);
 extern Id pool_queuetowhatprovides(Pool *pool, Queue *q);
 
-extern Id *addrelproviders(Pool *pool, Id d);
+extern Id *pool_addrelproviders(Pool *pool, Id d);
 
 extern Source *pool_source(Pool *pool, Solvable *s);
 
+static inline int pool_installable(Pool *pool, Solvable *s)
+{
+  if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC)
+    return 0;
+  if (pool->id2arch && (s->arch > pool->lastarch || !pool->id2arch[s->arch]))
+    return 0;
+  return 1;
+}
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/sat-solver/src/solver.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/solver.c?rev=7547&r1=7546&r2=7547&view=diff
==============================================================================
--- trunk/sat-solver/src/solver.c (original)
+++ trunk/sat-solver/src/solver.c Wed Oct 17 17:59:55 2007
@@ -287,8 +287,6 @@
   for (i = j = 0; i < plist->count; i++)
     {
       s = pool->solvables + plist->elements[i];
-      if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC)
-       continue;
 
       if (pool->verbose) printf("- %s-%s.%s\n", id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch));
 
@@ -439,9 +437,10 @@
   /* compare whatprovidesdata */
   ad = pool->whatprovidesdata + a->d;
   bd = pool->whatprovidesdata + b->d;
-  for (; *ad && *ad == *bd; ad++, bd++)
-    ;
-  return *ad - *bd;
+  while (*bd)
+    if ((x = *ad++ - *bd++) != 0)
+      return x;
+  return *ad;
 }
 
 
@@ -912,9 +911,7 @@
       if (MAPTST(m, i))
        continue;
       s = pool->solvables + i;
-      if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC)
-       continue;
-      if (pool->id2arch && (s->arch > pool->lastarch || !pool->id2arch[s->arch]))
+      if (!pool_installable(pool, s))
        continue;
       sup = 0;
       if ((supp = s->supplements) != 0)
@@ -949,18 +946,11 @@
       s = pool->solvables + i;
       if ((enhp = s->enhances) == 0)
        continue;
-      if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC)
-       continue;
-      if (pool->id2arch && (s->arch > pool->lastarch || !pool->id2arch[s->arch]))
+      if (!pool_installable(pool, s))
        continue;
       while ((enh = *enhp++) != ID_NULL)
-       {
-         FOR_PROVIDES(p, pp, enh)
-           if (MAPTST(m, p))
-             break;
-         if (p)
-           break;
-       }
+       if (dep_possible(solv, enh, m))
+         break;
       if (!enh)
        continue;
       if ((conp = s->conflicts) != 0)
@@ -2135,9 +2125,7 @@
                  s = pool->solvables + i;
                  if (!s->supplements && !s->freshens)
                    continue;
-                 if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC)
-                   continue;
-                 if (pool->id2arch && (s->arch > pool->lastarch || !pool->id2arch[s->arch]))
+                 if (!pool_installable(pool, s))
                    continue;
                  if ((supp = s->supplements) != 0)
                    {
@@ -2467,10 +2455,8 @@
       s = pool->solvables + i;
       if ((obsp = s->obsoletes) == 0)
        continue;
-      if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC)
-        continue;
-      if (pool->id2arch && (s->arch > pool->lastarch || !pool->id2arch[s->arch]))
-       continue;            
+      if (!pool_installable(pool, s))
+       continue;
       while ((obs = *obsp++) != 0)
         FOR_PROVIDES(p, pp, obs)
          {
@@ -2495,10 +2481,8 @@
       s = pool->solvables + i;
       if ((obsp = s->obsoletes) == 0)
        continue;
-      if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC)
-        continue;
-      if (pool->id2arch && (s->arch > pool->lastarch || !pool->id2arch[s->arch]))
-       continue;            
+      if (!pool_installable(pool, s))
+       continue;
       while ((obs = *obsp++) != 0)
         FOR_PROVIDES(p, pp, obs)
          {
@@ -2618,6 +2602,20 @@
 
   addrulesforsupplements(solv, &addedmap);
   addrulesforenhances(solv, &addedmap);            /* do this last */
+#if 1
+  if (pool->verbose)
+    {
+      int possible = 0, installable = 0;
+      for (i = 1; i < pool->nsolvables; i++)
+       {
+         if (pool_installable(pool, pool->solvables + i))
+           installable++;
+         if (MAPTST(&addedmap, i))
+           possible++;
+       }
+      printf("%d of %d installable solvables used for solving\n", possible, installable);
+    }
+#endif
 
   /*
    * first pass done
@@ -2758,7 +2756,7 @@
   /* find suggested packages */
   if (!solv->problems.count)
     {
-      Id sug, *sugp, enh, *enhp;
+      Id sug, *sugp, enh, *enhp, req, *reqp, p, *pp;
 
       /* create map of all suggests that are still open */
       solv->recommends_index = -1;
@@ -2785,21 +2783,37 @@
        {
          if (solv->decisionmap[i] != 0)
            continue;
+         s = pool->solvables + i;
          if (!MAPTST(&solv->suggestsmap, i))
            {
-             s = pool->solvables + i;
-             if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC)
-               continue;
-             if (pool->id2arch && (s->arch > pool->lastarch || !pool->id2arch[s->arch]))
-               continue;
              if ((enhp = s->enhances) == 0)
                continue;
+             if (!pool_installable(pool, s))
+               continue;
              while ((enh = *enhp++) != 0)
                if (dep_fulfilled(solv, enh))
                  break;
              if (!enh)
                continue;
            }
+         /* check if installation is possible at all */
+          if ((reqp = s->requires) != 0)
+           {
+             while ((req = *reqp++) != 0)
+               {
+                 if (req == SOLVABLE_PREREQMARKER)   /* skip the marker */
+                   continue;
+                 FOR_PROVIDES(p, pp, req)
+                   if (solv->decisionmap[p] >= 0)
+                     break;
+                 if (!p && !strncmp(id2str(pool, req), "rpmlib(", 7))
+                   continue;
+                 if (!p)
+                   break;              /* no provider installable! */
+               }
+             if (req)
+               continue;
+           }
          queuepush(&solv->suggestions, i);
        }
       prune_best_version_arch(pool, &solv->suggestions);

Modified: trunk/sat-solver/testsuite/deptestomatic.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/testsuite/deptestomatic.c?rev=7547&r1=7546&r2=7547&view=diff
==============================================================================
--- trunk/sat-solver/testsuite/deptestomatic.c (original)
+++ trunk/sat-solver/testsuite/deptestomatic.c Wed Oct 17 17:59:55 2007
@@ -1012,6 +1012,7 @@
       solv->updatesystem = pd->updatesystem;
       solv->allowdowngrade = pd->allowdowngrade;
       solv->allowuninstall = pd->allowuninstall;
+      solv->noupdateprovide = 0;
       solv->rc_output = redcarpet ? 2 : 1;
       solv->noupdateprovide = 1;
       //solv->ignorerecommends = 1;

Modified: trunk/sat-solver/testsuite/yps.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/testsuite/yps.c?rev=7547&r1=7546&r2=7547&view=diff
==============================================================================
--- trunk/sat-solver/testsuite/yps.c (original)
+++ trunk/sat-solver/testsuite/yps.c Wed Oct 17 17:59:55 2007
@@ -41,7 +41,7 @@
   for (; i < end; i++)
     {
       s = pool->solvables + i;
-      if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC)
+      if (!pool_installable(pool, s))
        continue;
       if (s->name == id)
        queuepush(&plist, i);
@@ -156,6 +156,7 @@
   solv->updatesystem = 0;
   solv->allowdowngrade = 0;
   solv->allowuninstall = 0;
+  solv->noupdateprovide = 0;
 
   // Solve !
 

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

< Previous Next >
This Thread
  • No further messages