Mailinglist Archive: zypp-commit (301 mails)

< Previous Next >
[zypp-commit] r7487 - in /trunk/sat-solver: src/solver.c testsuite/deptestomatic.c
  • From: coolo@xxxxxxxxxxxxxxxx
  • Date: Fri, 12 Oct 2007 11:45:43 -0000
  • Message-id: <20071012114543.9B5BC451DE@xxxxxxxxxxxxxxxx>
Author: coolo
Date: Fri Oct 12 13:45:43 2007
New Revision: 7487

URL: http://svn.opensuse.org/viewcvs/zypp?rev=7487&view=rev
Log:
fixing some bugs:
  - remove the original package on upgrade, not the new 
    one
  - always set i686 when no arch is set (as required)
  - handle "install" as capability not as name
  - handle different kind of solvables in install
  - install locale solvables into an extra channel

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

Modified: trunk/sat-solver/src/solver.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/solver.c?rev=7487&r1=7486&r2=7487&view=diff
==============================================================================
--- trunk/sat-solver/src/solver.c (original)
+++ trunk/sat-solver/src/solver.c Fri Oct 12 13:45:43 2007
@@ -2281,9 +2281,9 @@
              if (fn || f->name != s->name)
                {
                  if (solv->rc_output == 2)
-                   printf(">!> remove  %s-%s%s\n", id2str(pool, s->name), id2rc(solv, s->evr), id2str(pool, s->evr));
+                   printf(">!> remove  %s-%s%s\n", id2str(pool, f->name), id2rc(solv, f->evr), id2str(pool, f->evr));
                  else if (solv->rc_output)
-                   printf(">!> remove  %s-%s.%s\n", id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch));
+                   printf(">!> remove  %s-%s.%s\n", id2str(pool, f->name), id2str(pool, f->evr), id2str(pool, f->arch));
                  uninstalls++;
                }
              else
@@ -2308,7 +2308,7 @@
       if (solv->rc_output)
        {
          Source *source = pool_source(pool, s);
-         if (source)
+         if (source && strcmp(source_name(source), "locales"))
            printf("[%s]", source_name(source));
         }
       printf("\n");

Modified: trunk/sat-solver/testsuite/deptestomatic.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/testsuite/deptestomatic.c?rev=7487&r1=7486&r2=7487&view=diff
==============================================================================
--- trunk/sat-solver/testsuite/deptestomatic.c (original)
+++ trunk/sat-solver/testsuite/deptestomatic.c Fri Oct 12 13:45:43 2007
@@ -20,7 +20,7 @@
 #include "solver.h"
 #include "source_solv.h"
 #include "poolarch.h"
-
+#include "../tools/source_write.h"
 
 static int verbose = 0;
 static int redcarpet = 0;
@@ -145,6 +145,7 @@
   struct _channelmap *channels;
 
   Source *system;      // system source
+  Source *locales;      // where we store locales
 
   Id arch;              // set architecture
 
@@ -627,9 +628,55 @@
     break;
 
     case STATE_LOCALE: {              /* system locales */
+
       const char *name = attrval( atts, "name" );
-      err( "ignoring locale %s", name );
-      /* FIXME */
+      char locale[100];
+      strcpy(locale, "language:");
+      strncat(locale, name, 100);
+
+      Solvable s;
+      memset(&s, 0, sizeof(Solvable));
+      s.name = str2id(pd->pool, locale, 1);
+      s.arch = str2id(pd->pool, "noarch", 1);
+      s.evr = str2id(pd->pool, "", 1);
+      if (!pd->locales) {
+         pd->locales = pool_addsource_empty(pd->pool);
+         pool_freeidhashes(pd->pool);
+         pd->locales->name = strdup( "locales" );
+         pd->locales->start = pd->pool->nsolvables;
+      }
+
+      source_reserve_ids(pd->locales, 0, 3);
+
+      strcpy(locale, "locale:");
+      strncat(locale, name, 100);
+      Id pr = source_addid_dep(pd->locales, 0, str2id(pd->pool, locale, 1), 0);
+
+      strcpy(locale, "Locale(");
+      strncat(locale, name, 100);
+      strncat(locale, ")", 100);
+      pr = source_addid_dep(pd->locales, pr, str2id(pd->pool, locale, 1), 0);
+
+      strcpy(locale, "language:");
+      strncat(locale, name, 100);
+      pr = source_addid_dep(pd->locales, pr, str2id(pd->pool, locale, 1), 0);
+
+      s.provides = pd->locales->idarraydata + pr;
+
+      pd->pool->solvables = realloc(pd->pool->solvables, (pd->pool->nsolvables + 1) * sizeof(Solvable));
+      memcpy(pd->pool->solvables + pd->pool->nsolvables, &s, sizeof(Solvable));
+      pd->locales->nsolvables++;
+      pd->pool->nsolvables++;
+
+      pd->nchannels++;
+      pd->channels = (struct _channelmap *)realloc( pd->channels, pd->nchannels * sizeof( struct _channelmap ) );
+
+      struct _channelmap *cmap = pd->channels + (pd->nchannels-1);
+      cmap->name = str2id( pool, "locales", 1 );
+      cmap->source = pd->locales;
+
+      queuepush( &(pd->trials), SOLVER_INSTALL_SOLVABLE_PROVIDES );
+      queuepush( &(pd->trials), s.name );
     }
     break;
 
@@ -708,7 +755,7 @@
        * <install channel="1" kind="package" name="foofoo" arch="i586" version="2.60" release="21"/>
        */
 
-      const char *channel = attrval( atts, "channel" );
+       const char *channel = attrval( atts, "channel" );
        char package[100];
        getPackageName( atts, package );
 
@@ -746,7 +793,7 @@
       }
       else {                          /* no channel given, from any channel */
        Id id = str2id( pool, package, 1 );
-       queuepush( &(pd->trials), SOLVER_INSTALL_SOLVABLE_NAME );
+       queuepush( &(pd->trials), SOLVER_INSTALL_SOLVABLE_PROVIDES );
         queuepush( &(pd->trials), id );
       }
     }
@@ -874,6 +921,9 @@
 
       if (pd->arch)
         pool_setarch( pd->pool, id2str(pd->pool, pd->arch) );
+      else
+       pool_setarch( pd->pool, "i686" );
+
       pool_prepare( pd->pool );
       pool->promoteepoch = 1;
 

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

< Previous Next >
This Thread
  • No further messages