- remove obsolete interface, add decisioncnt_{weak,orphan}
authorMichael Schroeder <mls@suse.de>
Fri, 3 Jun 2011 14:40:52 +0000 (16:40 +0200)
committerMichael Schroeder <mls@suse.de>
Fri, 3 Jun 2011 14:40:52 +0000 (16:40 +0200)
src/evr.h
src/libsolv.ver
src/pool.h
src/poolid.h
src/problems.c
src/solver.c
src/solver.h
src/solver_private.h

index a856eb1..e1f5457 100644 (file)
--- a/src/evr.h
+++ b/src/evr.h
@@ -30,26 +30,6 @@ extern int pool_evrcmp_str(const Pool *pool, const char *evr1, const char *evr2,
 extern int pool_evrcmp(const Pool *pool, Id evr1id, Id evr2id, int mode);
 extern int pool_evrmatch(const Pool *pool, Id evrid, const char *epoch, const char *version, const char *release);
 
-/* obsolete, do not use in new code */
-#ifdef OBSOLETE_INTERFACE
-static inline int vercmp(const char *s1, const char *q1, const char *s2, const char *q2)
-{
-  return sat_vercmp(s1, q1, s2, q2);
-}
-static inline int evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode)
-{
-  return pool_evrcmp_str(pool, evr1, evr2, mode);
-}
-static inline int evrcmp(const Pool *pool, Id evr1id, Id evr2id, int mode)
-{
-  return pool_evrcmp(pool, evr1id, evr2id, mode);
-}
-static inline int evrmatch(const Pool *pool, Id evrid, const char *epoch, const char *version, const char *release)
-{
-  return pool_evrmatch(pool, evrid, epoch, version, release);
-}
-#endif
-
 #ifdef __cplusplus
 }
 #endif
index 2de5dce..d027fa2 100644 (file)
@@ -37,8 +37,6 @@ SOLV_1.0 {
                policy_illegal_vendorchange;
                policy_is_illegal;
                pool_add_fileconflicts_deps;
-               pool_add_solvable;
-               pool_add_solvable_block;
                pool_addfileprovides;
                pool_addfileprovides_ids;
                pool_addrelproviders;
@@ -57,7 +55,6 @@ SOLV_1.0 {
                pool_evrcmp_str;
                pool_evrmatch;
                pool_free;
-               pool_free_solvable_block;
                pool_freeidhashes;
                pool_freetmpspace;
                pool_freewhatprovides;
@@ -271,7 +268,6 @@ SOLV_1.0 {
                solver_printtrivial;
                solver_printwatches;
                solver_problem_count;
-               solver_problemruleinfo;
                solver_problemruleinfo2str;
                solver_ruleinfo;
                solver_samerule;
index 8887f43..fa701bf 100644 (file)
@@ -228,18 +228,6 @@ static inline const char *pool_solvid2str(Pool *pool, Id p)
   return pool_solvable2str(pool, pool->solvables + p);
 }
 
-/* obsolete, do not use anymore */
-#ifdef OBSOLETE_INTERFACE
-static inline const char *solvable2str(Pool *pool, Solvable *s)
-{
-  return pool_solvable2str(pool, s);
-}
-static inline const char *solvid2str(Pool *pool, Id p)
-{
-  return pool_solvable2str(pool, pool->solvables + p);
-}
-#endif
-
 void pool_set_languages(Pool *pool, const char **languages, int nlanguages);
 Id pool_id2langid(Pool *pool, Id id, const char *lang, int create);
 
index f7c6511..d8cd658 100644 (file)
@@ -38,37 +38,4 @@ extern void pool_shrink_strings(Pool *pool);
 extern void pool_shrink_rels(Pool *pool);
 extern void pool_freeidhashes(Pool *pool);
 
-
-/* deprecated names, do not use in new code */
-#ifdef OBSOLETE_INTERFACE
-static inline Id str2id(Pool *pool, const char *str, int create)
-{
-  return pool_str2id(pool, str, create);
-}
-static inline Id strn2id(Pool *pool, const char *str, unsigned int len, int create)
-{
-  return pool_strn2id(pool, str, len, create);
-}
-static inline Id rel2id(Pool *pool, Id name, Id evr, int flags, int create)
-{
-  return pool_rel2id(pool, name, evr, flags, create);
-}
-static inline const char *id2str(const Pool *pool, Id id)
-{
-  return pool_id2str(pool, id);
-}
-static inline const char *id2rel(const Pool *pool, Id id)
-{
-  return pool_id2rel(pool, id);
-}
-static inline const char *id2evr(const Pool *pool, Id id)
-{
-  return pool_id2evr(pool, id);
-}
-static inline const char *dep2str(Pool *pool, Id id)
-{
-  return pool_dep2str(pool, id);
-}
-#endif
-
 #endif /* LIBSOLV_POOLID_H */
index 6073e01..565ed9a 100644 (file)
@@ -896,11 +896,4 @@ solver_findallproblemrules(Solver *solv, Id problem, Queue *rules)
   findallproblemrules_internal(solv, solv->problems.elements[2 * problem - 2], rules);
 }
 
-/* obsolete function */
-SolverRuleinfo
-solver_problemruleinfo(Solver *solv, Queue *job, Id rid, Id *depp, Id *sourcep, Id *targetp)
-{
-  return solver_ruleinfo(solv, rid, sourcep, targetp, depp);
-}
-
 /* EOF */
index e8b35f3..4e15466 100644 (file)
@@ -1407,9 +1407,8 @@ solver_run_sat(Solver *solv, int disablerules, int doweak)
            {
              if (analyze_unsolvable(solv, r, disablerules))
                continue;
-             queue_free(&dq);
-             queue_free(&dqs);
-             return;
+             level = 0;
+             break;    /* unsolvable */
            }
        }
 
@@ -1465,14 +1464,12 @@ solver_run_sat(Solver *solv, int disablerules, int doweak)
              olevel = level;
              level = selectandinstall(solv, level, &dq, disablerules, i);
              if (level == 0)
-               {
-                 queue_free(&dq);
-                 queue_free(&dqs);
-                 return;
-               }
+               break;
              if (level <= olevel)
                break;
            }
+          if (level == 0)
+           break;      /* unsolvable */
          systemlevel = level + 1;
          if (i < solv->jobrules_end)
            continue;
@@ -1597,11 +1594,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak)
                          level = setpropagatelearn(solv, level, i, disablerules, r - solv->rules);
                        }
                      if (level == 0)
-                       {
-                         queue_free(&dq);
-                         queue_free(&dqs);
-                         return;
-                       }
+                       break;
                      if (level <= olevel)
                        {
                          if (level == 1 || level < passlevel)
@@ -1610,7 +1603,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak)
                            n = installed->start;       /* redo all */
                          i--;
                          n--;
-                         continue; /* retry with learnt rule */
+                         continue;     /* retry with learnt rule */
                        }
                    }
                }
@@ -1621,6 +1614,8 @@ solver_run_sat(Solver *solv, int disablerules, int doweak)
                }
              installedpos = installed->start;  /* reset installedpos */
            }
+          if (level == 0)
+           break;              /* unsolvable */
          systemlevel = level + 1;
          if (pass < 2)
            continue;           /* had trouble, retry */
@@ -1703,22 +1698,23 @@ solver_run_sat(Solver *solv, int disablerules, int doweak)
          olevel = level;
          level = selectandinstall(solv, level, &dq, disablerules, r - solv->rules);
          if (level == 0)
-           {
-             queue_free(&dq);
-             queue_free(&dqs);
-             return;
-           }
+           break;              /* unsolvable */
          if (level < systemlevel || level == 1)
            break;              /* trouble */
          /* something changed, so look at all rules again */
          n = 0;
        }
 
-      if (n != solv->nrules)   /* ran into trouble, restart */
-       continue;
+      if (n != solv->nrules)   /* ran into trouble? */
+       {
+         if (level == 0)
+           break;              /* unsolvable */
+         continue;             /* start over */
+       }
 
       /* at this point we have a consistent system. now do the extras... */
 
+      solv->decisioncnt_weak = solv->decisionq.count;
       if (doweak)
        {
          int qcount;
@@ -1891,6 +1887,8 @@ solver_run_sat(Solver *solv, int disablerules, int doweak)
                    POOL_DEBUG(SAT_DEBUG_POLICY, "installing recommended %s\n", pool_solvid2str(pool, p));
                  queue_push(&solv->recommendations, p);
                  level = setpropagatelearn(solv, level, p, 0, 0);
+                 if (level == 0)
+                   break;
                  continue;     /* back to main loop */
                }
 
@@ -1918,6 +1916,8 @@ solver_run_sat(Solver *solv, int disablerules, int doweak)
              if (i < dqs.count || solv->decisionq.count < decisioncount)
                {
                  map_free(&dqmap);
+                 if (level == 0)
+                   break;
                  continue;
                }
 
@@ -1970,12 +1970,14 @@ solver_run_sat(Solver *solv, int disablerules, int doweak)
                    break;      /* had a problem above, quit loop */
                }
              map_free(&dqmap);
-
+             if (level == 0)
+               break;
              continue;         /* back to main loop so that all deps are checked */
            }
        }
 
-     if (solv->dupmap_all && solv->installed)
+      solv->decisioncnt_orphan = solv->decisionq.count;
+      if (solv->dupmap_all && solv->installed)
        {
          int installedone = 0;
 
@@ -1997,8 +1999,14 @@ solver_run_sat(Solver *solv, int disablerules, int doweak)
              if (level < olevel)
                break;
            }
+         if (level == 0)
+           break;
          if (installedone || i < solv->orphaned.count)
-           continue;           /* back to main loop */
+           {
+             if (level == 0)
+               break;
+             continue;         /* back to main loop */
+           }
          for (i = 0; i < solv->orphaned.count; i++)
            {
              p = solv->orphaned.elements[i];
@@ -2011,7 +2019,11 @@ solver_run_sat(Solver *solv, int disablerules, int doweak)
                break;
            }
          if (i < solv->orphaned.count)
-           continue;           /* back to main loop */
+           {
+             if (level == 0)
+               break;
+             continue;         /* back to main loop */
+           }
        }
 
      if (solv->solution_callback)
@@ -2042,18 +2054,14 @@ solver_run_sat(Solver *solv, int disablerules, int doweak)
              assert(why >= 0);
              level = setpropagatelearn(solv, level, p, disablerules, why);
              if (level == 0)
-               {
-                 queue_free(&dq);
-                 queue_free(&dqs);
-                 return;
-               }
+               break;
              continue;
            }
          /* all branches done, we're finally finished */
          break;
        }
 
-      /* minimization step */
+      /* auto-minimization step */
      if (solv->branches.count)
        {
          int l = 0, lasti = -1, lastl = -1;
@@ -2086,11 +2094,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak)
              olevel = level;
              level = setpropagatelearn(solv, level, p, disablerules, why);
              if (level == 0)
-               {
-                 queue_free(&dq);
-                 queue_free(&dqs);
-                 return;
-               }
+               break;
              continue;         /* back to main loop */
            }
        }
@@ -2103,6 +2107,12 @@ solver_run_sat(Solver *solv, int disablerules, int doweak)
   POOL_DEBUG(SAT_DEBUG_STATS, "done solving.\n\n");
   queue_free(&dq);
   queue_free(&dqs);
+  if (level == 0)
+    {
+      /* unsolvable */
+      solv->decisioncnt_weak = solv->decisionq.count;
+      solv->decisioncnt_orphan = solv->decisionq.count;
+    }
 #if 0
   solver_printdecisionq(solv, SAT_DEBUG_RESULT);
 #endif
index cc930e9..64d47be 100644 (file)
@@ -109,6 +109,9 @@ struct _Solver {
                                         * > 0: level of decision when installed,
                                         * < 0: level of decision when conflict */
 
+  int decisioncnt_weak;
+  int decisioncnt_orphan;
+
   /* learnt rule history */
   Queue learnt_why;
   Queue learnt_pool;
@@ -254,40 +257,6 @@ typedef struct _Solver Solver;
 
 #define SOLVER_SETMASK                 0x2f000000
 
-/* old API compatibility, do not use in new code */
-#ifdef OBSOLETE_INTERFACE
-
-#define SOLVER_INSTALL_SOLVABLE (SOLVER_INSTALL|SOLVER_SOLVABLE)
-#define SOLVER_ERASE_SOLVABLE (SOLVER_ERASE|SOLVER_SOLVABLE)
-#define SOLVER_INSTALL_SOLVABLE_NAME (SOLVER_INSTALL|SOLVER_SOLVABLE_NAME)
-#define SOLVER_ERASE_SOLVABLE_NAME (SOLVER_ERASE|SOLVER_SOLVABLE_NAME)
-#define SOLVER_INSTALL_SOLVABLE_PROVIDES (SOLVER_INSTALL|SOLVER_SOLVABLE_PROVIDES)
-#define SOLVER_ERASE_SOLVABLE_PROVIDES (SOLVER_ERASE|SOLVER_SOLVABLE_PROVIDES)
-#define SOLVER_INSTALL_SOLVABLE_UPDATE (SOLVER_UPDATE|SOLVER_SOLVABLE)
-#define SOLVER_INSTALL_SOLVABLE_ONE_OF (SOLVER_INSTALL|SOLVER_SOLVABLE_ONE_OF)
-#define SOLVER_WEAKEN_SOLVABLE_DEPS (SOLVER_WEAKENDEPS|SOLVER_SOLVABLE)
-#define SOLVER_NOOBSOLETES_SOLVABLE (SOLVER_NOOBSOLETES|SOLVER_SOLVABLE)
-#define SOLVER_NOOBSOLETES_SOLVABLE_NAME (SOLVER_NOOBSOLETES|SOLVER_SOLVABLE_NAME)
-#define SOLVER_NOOBSOLETES_SOLVABLE_PROVIDES (SOLVER_NOOBSOLETES|SOLVER_SOLVABLE_PROVIDES)
-
-/* backward compatibility */
-#define SOLVER_PROBLEM_UPDATE_RULE             SOLVER_RULE_UPDATE
-#define SOLVER_PROBLEM_JOB_RULE                        SOLVER_RULE_JOB
-#define SOLVER_PROBLEM_JOB_NOTHING_PROVIDES_DEP        SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP
-#define SOLVER_PROBLEM_NOT_INSTALLABLE         SOLVER_RULE_RPM_NOT_INSTALLABLE
-#define SOLVER_PROBLEM_NOTHING_PROVIDES_DEP    SOLVER_RULE_RPM_NOTHING_PROVIDES_DEP
-#define SOLVER_PROBLEM_SAME_NAME               SOLVER_RULE_RPM_SAME_NAME
-#define SOLVER_PROBLEM_PACKAGE_CONFLICT                SOLVER_RULE_RPM_PACKAGE_CONFLICT
-#define SOLVER_PROBLEM_PACKAGE_OBSOLETES       SOLVER_RULE_RPM_PACKAGE_OBSOLETES
-#define SOLVER_PROBLEM_DEP_PROVIDERS_NOT_INSTALLABLE SOLVER_RULE_RPM_PACKAGE_REQUIRES
-#define SOLVER_PROBLEM_SELF_CONFLICT           SOLVER_RULE_RPM_SELF_CONFLICT
-#define SOLVER_PROBLEM_RPM_RULE                        SOLVER_RULE_RPM
-#define SOLVER_PROBLEM_DISTUPGRADE_RULE                SOLVER_RULE_DISTUPGRADE
-#define SOLVER_PROBLEM_INFARCH_RULE            SOLVER_RULE_INFARCH
-
-#endif
-
-
 extern Solver *solver_create(Pool *pool);
 extern void solver_free(Solver *solv);
 extern int  solver_solve(Solver *solv, Queue *job);
index a563fa8..47f3f9e 100644 (file)
@@ -86,6 +86,9 @@ struct _Solver {
                                         * > 0: level of decision when installed,
                                         * < 0: level of decision when conflict */
 
+  int decisioncnt_weak;
+  int decisioncnt_orphan;
+
   /* learnt rule history */
   Queue learnt_why;
   Queue learnt_pool;