make FOR_RULELITERALS safe against whatprovides realloc
[platform/upstream/libsolv.git] / src / solver.h
index 1f04c1d..5e3a162 100644 (file)
@@ -113,6 +113,10 @@ struct _Solver {
   Id duprules;                         /* dist upgrade rules */
   Id duprules_end;
     
+  Id bestrules;                                /* rules from SOLVER_FORCEBEST */
+  Id bestrules_end;
+  Id *bestrules_pkg;
+
   Id choicerules;                      /* choice rules (always weak) */
   Id choicerules_end;
   Id *choicerules_ref;
@@ -126,6 +130,9 @@ struct _Solver {
   Map updatemap;                       /* bring these installed packages to the newest version */
   int updatemap_all;                   /* bring all packages to the newest version */
 
+  Map bestupdatemap;                   /* create best rule for those packages */
+  int bestupdatemap_all;               /* bring all packages to the newest version */
+
   Map fixmap;                          /* fix these packages */
   int fixmap_all;                      /* fix all packages */
 
@@ -195,6 +202,7 @@ struct _Solver {
   
   int noinfarchcheck;                  /* true: do not forbid inferior architectures */
   int keepexplicitobsoletes;           /* true: honor obsoletes during multiinstall */
+  int bestobeypolicy;                  /* true: stay in policy with the best rules */
 
     
   Map dupmap;                          /* dup these packages*/
@@ -214,6 +222,8 @@ struct _Solver {
 
   Queue *cleandeps_updatepkgs;         /* packages we update in cleandeps mode */
   Queue *cleandeps_mistakes;           /* mistakes we made */
+
+  Queue *update_targets;               /* update to specific packages */
 #endif /* LIBSOLV_INTERNAL */
 };
 
@@ -256,7 +266,6 @@ typedef struct _Solver Solver;
  * you will get problem reported if the best package is
  * not installable. This can be used with INSTALL, UPDATE
  * and DISTUPGRADE */
-/* Also, it's not implemented yet ;) */
 #define SOLVER_FORCEBEST               0x100000
 
 #define SOLVER_SETEV                   0x01000000
@@ -294,6 +303,7 @@ typedef struct _Solver Solver;
 #define SOLVER_FLAG_NO_INFARCHCHECK            9
 #define SOLVER_FLAG_ALLOW_NAMECHANGE           10
 #define SOLVER_FLAG_KEEP_EXPLICIT_OBSOLETES    11
+#define SOLVER_FLAG_BEST_OBEY_POLICY           12
 
 extern Solver *solver_create(Pool *pool);
 extern void solver_free(Solver *solv);
@@ -326,14 +336,16 @@ int solver_calc_installsizechange(Solver *solv);
 void solver_trivial_installable(Solver *solv, Queue *pkgs, Queue *res);
 
 void pool_job2solvables(Pool *pool, Queue *pkgs, Id how, Id what);
+int  pool_isemptyupdatejob(Pool *pool, Id how, Id what);
 
 /* iterate over all literals of a rule */
-/* WARNING: loop body must not relocate whatprovidesdata, e.g. by
- * looking up the providers of a dependency */
-#define FOR_RULELITERALS(l, dp, r)                             \
-    for (l = r->d < 0 ? -r->d - 1 : r->d,                      \
-         dp = !l ? &r->w2 : pool->whatprovidesdata + l,                \
-         l = r->p; l; l = (dp != &r->w2 + 1 ? *dp++ : 0))
+#define FOR_RULELITERALS(l, pp, r)                             \
+    for (pp = r->d < 0 ? -r->d - 1 : r->d,                     \
+         l = r->p; l; l = (pp <= 0 ? (pp-- ? 0 : r->w2) :      \
+         pool->whatprovidesdata[pp++]))
+
+
+
 
 /* XXX: this currently doesn't work correctly for SOLVER_SOLVABLE_REPO and
    SOLVER_SOLVABLE_ALL */