- add pool_addvendorclass and solver_solutionelement_internalid
authorMichael Schroeder <mls@suse.de>
Tue, 14 Feb 2012 17:18:18 +0000 (18:18 +0100)
committerMichael Schroeder <mls@suse.de>
Tue, 14 Feb 2012 17:18:18 +0000 (18:18 +0100)
src/libsolv.ver
src/pool.c
src/pool.h
src/poolvendor.c
src/poolvendor.h
src/problems.c
src/problems.h

index 4da45b2..e0194ee 100644 (file)
@@ -40,6 +40,7 @@ SOLV_1.0 {
                pool_addfileprovides;
                pool_addfileprovides_queue;
                pool_addrelproviders;
+               pool_addvendorclass;
                pool_alloctmpspace;
                pool_arch2color_slow;
                pool_bin2hex;
@@ -306,6 +307,7 @@ SOLV_1.0 {
                solver_solution_count;
                solver_solutionelement2str;
                solver_solutionelement_count;
+               solver_solutionelement_internalid;
                solver_solve;
                solver_take_solution;
                solver_take_solutionelement;
index 01b3dd4..0d84f34 100644 (file)
@@ -68,9 +68,7 @@ pool_create(void)
 #endif
 #ifdef DEBIAN 
   pool->allowselfconflicts = 1;
-# ifdef MULTI_SEMANTICS
   pool->disttype = DISTTYPE_DEB;
-# endif
 #endif
 #ifdef RPM5
   pool->obsoleteusesprovides = 1;
@@ -727,17 +725,9 @@ pool_addrelproviders(Pool *pool, Id d)
            {
              if (pid == name)
                {
-#if defined(MULTI_SEMANTICS)
                  if (pool->disttype == DISTTYPE_DEB)
-                   continue;
-                 else
-                   break;
-#elif defined(DEBIAN_SEMANTICS)
-                 continue;             /* unversioned provides can
-                                        * never match versioned deps */
-#else
-                 break;                /* yes, provides all versions */
-#endif
+                   continue;           /* unversioned provides can never match versioned deps */
+                 break;
                }
              if (!ISRELDEP(pid))
                continue;               /* wrong provides name */
index 2b51167..ee9f256 100644 (file)
@@ -82,7 +82,10 @@ struct _Pool {
   Id *languagecache;
   int languagecacheother;
 
-  /* flags to tell the library how the installed rpm works */
+  /* package manager type, deb/rpm */
+  int disttype;
+
+  /* flags to tell the library how the installed package manager works */
   int promoteepoch;            /* true: missing epoch is replaced by epoch of dependency   */
   int obsoleteusesprovides;    /* true: obsoletes are matched against provides, not names */
   int implicitobsoleteusesprovides;    /* true: implicit obsoletes due to same name are matched against provides, not names */
@@ -90,10 +93,6 @@ struct _Pool {
   int noinstalledobsoletes;    /* true: ignore obsoletes of installed packages */
   int allowselfconflicts;      /* true: packages which conflict with itself are installable */
 
-#ifdef MULTI_SEMANTICS
-  int disttype;
-#endif
-
   Id *id2arch;                 /* map arch ids to scores */
   unsigned char *id2color;     /* map arch ids to colors */
   Id lastarch;                 /* last valid entry in id2arch/id2color */
@@ -116,6 +115,7 @@ struct _Pool {
      bitmap for solving.  If zero, consider all solvables.  */
   Map *considered;
 
+  /* callback for REL_NAMESPACE dependencies handled by the application  */
   Id (*nscallback)(struct _Pool *, void *data, Id name, Id evr);
   void *nscallbackdata;
 
@@ -135,10 +135,8 @@ struct _Pool {
   Datapos pos;
 };
 
-#ifdef MULTI_SEMANTICS
-# define DISTTYPE_RPM  0
-# define DISTTYPE_DEB  1
-#endif
+#define DISTTYPE_RPM   0
+#define DISTTYPE_DEB   1
 
 #define SOLV_FATAL                     (1<<0)
 #define SOLV_ERROR                     (1<<1)
index 2bf00f8..a52a94b 100644 (file)
@@ -103,3 +103,27 @@ pool_setvendorclasses(Pool *pool, const char **vendorclasses)
   queue_empty(&pool->vendormap);
 }
 
+void
+pool_addvendorclass(Pool *pool, const char **vendorclass)
+{
+  int i, j;
+
+  if (!vendorclass || !vendorclass[0])
+    return;
+  for (j = 1; vendorclass[j]; j++)
+    ;
+  i = 0;
+  if (pool->vendorclasses)
+    {
+      for (i = 0; pool->vendorclasses[i] || pool->vendorclasses[i + 1]; i++)
+       ;
+      if (i)
+        i++;
+    }
+  pool->vendorclasses = solv_realloc2(pool->vendorclasses, i + j + 2, sizeof(const char *));
+  for (j = 0; vendorclass[j]; j++)
+    pool->vendorclasses[i++] = solv_strdup(vendorclass[j]);
+  pool->vendorclasses[i++] = 0;
+  pool->vendorclasses[i] = 0;
+  queue_empty(&pool->vendormap);
+}
index 7f34fd5..2e14450 100644 (file)
@@ -12,5 +12,6 @@
 
 Id pool_vendor2mask(Pool *pool, Id vendor);
 void pool_setvendorclasses(Pool *pool, const char **vendorclasses);
+void pool_addvendorclass(Pool *pool, const char **vendorclass);
 
 #endif /* LIBSOLV_POOLVENDOR_H */
index 976d99a..3a1409d 100644 (file)
@@ -608,6 +608,7 @@ create_solutions(Solver *solv, int probnr, int solidx)
       solv->solutions.elements[solstart] = (solv->solutions.count - (solstart + 1)) / 2;
       queue_push(&solv->solutions, 0); /* add end marker */
       queue_push(&solv->solutions, 0); /* add end marker */
+      queue_push(&solv->solutions, problem.elements[i]);       /* just for bookkeeping */
       solv->solutions.elements[solidx + 1 + nsol++] = solstart;
     }
   solv->solutions.elements[solidx + 1 + nsol] = 0;     /* end marker */
@@ -688,6 +689,14 @@ solver_solutionelement_count(Solver *solv, Id problem, Id solution)
   return solv->solutions.elements[solidx];
 }
 
+Id
+solver_solutionelement_internalid(Solver *solv, Id problem, Id solution)
+{
+  Id solidx = solv->problems.elements[problem * 2 - 1];
+  solidx = solv->solutions.elements[solidx + solution];
+  return solv->solutions.elements[solidx + 2 * solv->solutions.elements[solidx] + 3];
+}
+
 
 /*
  *  return the next item of the proposed solution
index 1da7cd0..cd56aa2 100644 (file)
@@ -33,6 +33,7 @@ Id solver_next_problem(struct _Solver *solv, Id problem);
 unsigned int solver_solution_count(struct _Solver *solv, Id problem);
 Id solver_next_solution(struct _Solver *solv, Id problem, Id solution);
 unsigned int solver_solutionelement_count(struct _Solver *solv, Id problem, Id solution);
+Id solver_solutionelement_internalid(struct _Solver *solv, Id problem, Id solution);
 Id solver_next_solutionelement(struct _Solver *solv, Id problem, Id solution, Id element, Id *p, Id *rp);
 
 void solver_take_solutionelement(struct _Solver *solv, Id p, Id rp, Queue *job);