Mailinglist Archive: zypp-commit (301 mails)

< Previous Next >
[zypp-commit] r7472 - in /trunk/sat-solver: src/pool.c src/pool.h src/solver.c testsuite/Makefile.am
  • From: mlschroe@xxxxxxxxxxxxxxxx
  • Date: Tue, 09 Oct 2007 10:51:19 -0000
  • Message-id: <20071009105119.7FBE317427@xxxxxxxxxxxxxxxx>
Author: mlschroe
Date: Tue Oct  9 12:51:18 2007
New Revision: 7472

URL: http://svn.opensuse.org/viewcvs/zypp?rev=7472&view=rev
Log:
- fix arch handling
- fix makefile
- add modalias and installed namespaces
- fix red carpet upgrade detection

Modified:
    trunk/sat-solver/src/pool.c
    trunk/sat-solver/src/pool.h
    trunk/sat-solver/src/solver.c
    trunk/sat-solver/testsuite/Makefile.am

Modified: trunk/sat-solver/src/pool.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/pool.c?rev=7472&r1=7471&r2=7472&view=diff
==============================================================================
--- trunk/sat-solver/src/pool.c (original)
+++ trunk/sat-solver/src/pool.c Tue Oct  9 12:51:18 2007
@@ -51,6 +51,8 @@
   "rpm:dbid",                               /* direct key into rpmdb */
   "solvable:prereqmarker",
   "solvable:filemarker",
+  "namespace:installed",
+  "namespace:modalias",
   "src",
   "nosrc",
   "noarch"

Modified: trunk/sat-solver/src/pool.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/pool.h?rev=7472&r1=7471&r2=7472&view=diff
==============================================================================
--- trunk/sat-solver/src/pool.h (original)
+++ trunk/sat-solver/src/pool.h Tue Oct  9 12:51:18 2007
@@ -20,24 +20,26 @@
 /* well known ids */
 #define ID_NULL                        0
 #define ID_EMPTY               1
-#define SOLVABLE_NAME           2
-#define SOLVABLE_ARCH           3
-#define SOLVABLE_EVR            4
-#define SOLVABLE_PROVIDES       5
-#define SOLVABLE_OBSOLETES      6
-#define SOLVABLE_CONFLICTS      7
-#define SOLVABLE_REQUIRES       8
-#define SOLVABLE_RECOMMENDS     9
-#define SOLVABLE_SUGGESTS       10
-#define SOLVABLE_SUPPLEMENTS    11
-#define SOLVABLE_ENHANCES       12
-#define SOLVABLE_FRESHENS       13
-#define RPM_RPMDBID             14
-#define SOLVABLE_PREREQMARKER   15             // normal requires before this, prereqs after this
-#define SOLVABLE_FILEMARKER     16             // normal provides before this, generated file provides after this
-#define ARCH_SRC                17
-#define ARCH_NOSRC              18
-#define ARCH_NOARCH             19
+#define SOLVABLE_NAME          2
+#define SOLVABLE_ARCH          3
+#define SOLVABLE_EVR           4
+#define SOLVABLE_PROVIDES      5
+#define SOLVABLE_OBSOLETES     6
+#define SOLVABLE_CONFLICTS     7
+#define SOLVABLE_REQUIRES      8
+#define SOLVABLE_RECOMMENDS    9
+#define SOLVABLE_SUGGESTS      10
+#define SOLVABLE_SUPPLEMENTS   11
+#define SOLVABLE_ENHANCES      12
+#define SOLVABLE_FRESHENS      13
+#define RPM_RPMDBID            14
+#define SOLVABLE_PREREQMARKER  15              // normal requires before this, prereqs after this
+#define SOLVABLE_FILEMARKER    16              // normal provides before this, generated file provides after this
+#define NAMESPACE_INSTALLED    17
+#define NAMESPACE_MODALIAS     18
+#define ARCH_SRC               19
+#define ARCH_NOSRC             20
+#define ARCH_NOARCH            21
 
 //-----------------------------------------------
 

Modified: trunk/sat-solver/src/solver.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/solver.c?rev=7472&r1=7471&r2=7472&view=diff
==============================================================================
--- trunk/sat-solver/src/solver.c (original)
+++ trunk/sat-solver/src/solver.c Tue Oct  9 12:51:18 2007
@@ -55,8 +55,34 @@
 }
 #endif
 
+static int
+dep_installed(Solver *solv, Id dep)
+{
+  Pool *pool = solv->pool;
+  Id p, *pp;
+
+  if (ISRELDEP(dep))
+    {
+      Reldep *rd = GETRELDEP(pool, dep);
+      if (rd->flags == REL_AND)
+       {
+         if (!dep_installed(solv, rd->name))
+           return 0;
+         return dep_installed(solv, rd->evr);
+       }
+      if (rd->flags == REL_NAMESPACE && rd->name == NAMESPACE_INSTALLED)
+       return dep_installed(solv, rd->evr);
+    }
+  FOR_PROVIDES(p, pp, dep)
+    {
+      if (p >= solv->system->start && p < solv->system->start + solv->system->nsolvables)
+       return 1;
+    }
+  return 0;
+}
+
 static inline int
-dep_is_installed(Solver *solv, Id dep)
+dep_fulfilled(Solver *solv, Id dep)
 {
   Pool *pool = solv->pool;
   Id p, *pp;
@@ -66,10 +92,12 @@
       Reldep *rd = GETRELDEP(pool, dep);
       if (rd->flags == REL_AND)
        {
-         if (!dep_is_installed(solv, rd->name))
+         if (!dep_fulfilled(solv, rd->name))
            return 0;
-         return dep_is_installed(solv, rd->evr);
+         return dep_fulfilled(solv, rd->evr);
        }
+      if (rd->flags == REL_NAMESPACE && rd->name == NAMESPACE_INSTALLED)
+       return dep_installed(solv, rd->evr);
     }
   FOR_PROVIDES(p, pp, dep)
     {
@@ -99,7 +127,7 @@
       if ((supp = s->supplements) != 0)
        {
          while ((sup = *supp++) != 0)
-           if (dep_is_installed(solv, sup))
+           if (dep_fulfilled(solv, sup))
              break;
          if (!sup)
            continue;
@@ -107,7 +135,7 @@
       if ((supp = s->freshens) != 0)
        {
          while ((sup = *supp++) != 0)
-           if (dep_is_installed(solv, sup))
+           if (dep_fulfilled(solv, sup))
              break;
          if (!sup)
            continue;
@@ -151,7 +179,7 @@
          if (a > pool->lastarch)
            continue;
          a = pool->id2arch[a];
-         if ((a & 0xffff0000) > bestscore)
+         if (!bestscore || (a & 0xffff0000) < bestscore)
            bestscore = a & 0xffff0000;
        }
       for (i = j = 0; i < plist->count; i++)
@@ -648,7 +676,7 @@
   Id n;
 
   queueinit(&q);
-  queuepush(&q, s - pool->solvables);/* push solvable Id */
+  queuepush(&q, s - pool->solvables);   /* push solvable Id */
 
   while (q.count)
     {
@@ -1982,7 +2010,7 @@
                  if ((supp = s->supplements) != 0)
                    {
                      while ((sup = *supp++) != 0)
-                       if (dep_is_installed(solv, sup))
+                       if (dep_fulfilled(solv, sup))
                          break;
                      if (!sup)
                        continue;
@@ -1990,7 +2018,7 @@
                  if ((supp = s->freshens) != 0)
                    {
                      while ((sup = *supp++) != 0)
-                       if (dep_is_installed(solv, sup))
+                       if (dep_fulfilled(solv, sup))
                          break;
                      if (!sup)
                        continue;
@@ -2199,24 +2227,12 @@
       if (obsoletesmap[i])
        continue;
       s = pool->solvables + i;
-      if (solv->rc_output)
-       {
-         printf(">!> ");
-         if (solv->rc_output == 2)
-           {
-             printf("remove ");
-             printf(" %s-%s%s", id2str(pool, s->name), id2rc(solv, s->evr), id2str(pool, s->evr));
-           }
-         else
-           {
-             printf("remove  %s-%s.%s", id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch));
-           }
-       }
+      if (solv->rc_output == 2)
+       printf(">!> remove  %s-%s%s\n", id2str(pool, s->name), id2rc(solv, s->evr), id2str(pool, s->evr));
+      else if (solv->rc_output)
+       printf(">!> remove  %s-%s.%s\n", id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch));
       else
-        {
-          printf("erase   %s-%s.%s", id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch));
-        }
-      printf("\n");
+       printf("erase   %s-%s.%s\n", id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch));
       uninstalls++;
     }
 
@@ -2224,6 +2240,7 @@
 
   for (i = 0; i < solv->decisionq.count; i++)
     {
+      int j;
       p = solv->decisionq.elements[i];
       if (p < 0)
        continue;
@@ -2231,46 +2248,62 @@
        continue;
       s = pool->solvables + p;
 
-      if (solv->rc_output)
-       printf(">!> ");
-
       if (!obsoletesmap[p])
         {
+         if (solv->rc_output)
+           printf(">!> ");
           printf("install %s-%s%s", id2str(pool, s->name), id2rc(solv, s->evr), id2str(pool, s->evr));
          if (solv->rc_output != 2)
             printf(".%s", id2str(pool, s->arch));
          installs++;
         }
-      else
+      else if (!solv->rc_output)
        {
-         int j;
-         Solvable *from = NULL, *to = NULL;
-         if (solv->rc_output)
-           to = s;
-         else
-           printf("update  %s-%s.%s  (obsoletes", id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch));
+         printf("update  %s-%s.%s  (obsoletes", id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch));
+         for (j = solv->system->start; j < solv->system->start + solv->system->nsolvables; j++)
+           {
+             if (obsoletesmap[j] != p)
+               continue;
+             s = pool->solvables + j;
+             printf(" %s-%s.%s", id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch));
+           }
+         printf(")");
          upgrades++;
+       }
+      else
+       {
+         Solvable *f, *fn = 0;
          for (j = solv->system->start; j < solv->system->start + solv->system->nsolvables; j++)
            {
-             if (obsoletesmap[j] == p)
+             if (obsoletesmap[j] != p)
+               continue;
+             f = pool->solvables + j;
+             if (fn || f->name != s->name)
                {
-                 s = pool->solvables + j;
-                 if (solv->rc_output)
-                   from = s;
-                 else
-                   printf(" %s-%s.%s", id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch));
+                 if (solv->rc_output == 2)
+                   printf(">!> remove  %s-%s%s\n", id2str(pool, s->name), id2rc(solv, s->evr), id2str(pool, s->evr));
+                 else if (solv->rc_output)
+                   printf(">!> remove  %s-%s.%s\n", id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch));
+                 uninstalls++;
                }
+             else
+               fn = f;
            }
-         if (solv->rc_output)
+         if (!fn)
+           {
+             printf(">!> install %s-%s%s", id2str(pool, s->name), id2rc(solv, s->evr), id2str(pool, s->evr));
+             if (solv->rc_output != 2)
+               printf(".%s", id2str(pool, s->arch));
+             installs++;
+           }
+         else
            {
              if (solv->rc_output == 2)
-               printf("upgrade %s-%s => %s-%s%s", id2str(pool, from->name), id2str(pool, from->evr), id2str(pool, to->name), id2rc(solv, to->evr), id2str(pool, to->evr));
+               printf(">!> upgrade %s-%s => %s-%s%s", id2str(pool, fn->name), id2str(pool, fn->evr), id2str(pool, s->name), id2rc(solv, s->evr), id2str(pool, s->evr));
              else
-               printf("upgrade %s-%s.%s => %s-%s.%s", id2str(pool, from->name), id2str(pool, from->evr), id2str(pool, from->arch), id2str(pool, to->name), id2str(pool, to->evr), id2str(pool, to->arch));
-             s = to;                  /* for final source name */
+               printf(">!> upgrade %s-%s.%s => %s-%s.%s", id2str(pool, fn->name), id2str(pool, fn->evr), id2str(pool, fn->arch), id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch));
+             upgrades++;
            }
-         else
-           printf(")");
        }
       if (solv->rc_output)
        {

Modified: trunk/sat-solver/testsuite/Makefile.am
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/testsuite/Makefile.am?rev=7472&r1=7471&r2=7472&view=diff
==============================================================================
--- trunk/sat-solver/testsuite/Makefile.am (original)
+++ trunk/sat-solver/testsuite/Makefile.am Tue Oct  9 12:51:18 2007
@@ -3,7 +3,7 @@
 INCLUDES =  \
        -I$(top_srcdir)/src
 
-LIBS = \
+LIBADD = \
        $(top_builddir)/src/libsatsolver0.la
 
 yps_SOURCES = \

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

< Previous Next >
This Thread
  • No further messages