- catch self conflicts (configurable)
authorMichael Schroeder <mls@suse.de>
Tue, 15 Apr 2008 17:11:26 +0000 (17:11 +0000)
committerMichael Schroeder <mls@suse.de>
Tue, 15 Apr 2008 17:11:26 +0000 (17:11 +0000)
src/solver.c
src/solver.h

index af66605..033fc13 100644 (file)
@@ -1190,6 +1190,8 @@ addrpmrulesforsolvable(Solver *solv, Solvable *s, Map *m)
                   /* dontfix: dont care about conflicts with already installed packs */
                  if (dontfix && pool->solvables[p].repo == installed)
                    continue;
+                if (p == n && !solv->allowselfconflicts)
+                  p = 0;       /* make it a negative assertion */
                  /* rule: -n|-p: either solvable _or_ provider of conflict */
                  addrule(solv, -n, -p);
                }
@@ -3029,9 +3031,22 @@ solver_problemruleinfo(Solver *solv, Queue *job, Id rid, Id *depp, Id *sourcep,
          if (*dp == 0)
            break;
        }
-      assert(req);
-      *depp = req;
-      return SOLVER_PROBLEM_NOTHING_PROVIDES_DEP;
+      if (req)
+       {
+         *depp = req;
+         return SOLVER_PROBLEM_NOTHING_PROVIDES_DEP;
+       }
+      assert(!solv->allowselfconflicts);
+      assert(s->conflicts);
+      conp = s->repo->idarraydata + s->conflicts;
+      while ((con = *conp++) != 0)
+       FOR_PROVIDES(p, pp, con)
+         if (p == -r->p)
+           {
+             *depp = con;
+             return SOLVER_PROBLEM_SELF_CONFLICT;
+           }
+      assert(0);
     }
   s = pool->solvables - r->p;
   if (installed && !solv->fixsystem && s->repo == installed)
@@ -3284,6 +3299,10 @@ printprobleminfo(Solver *solv, Queue *job, Id problem)
       s = pool_id2solvable(pool, source);
       POOL_DEBUG(SAT_DEBUG_RESULT, "package %s requires %s, but none of the providers can be installed\n", solvable2str(pool, s), dep2str(pool, dep));
       return;
+    case SOLVER_PROBLEM_SELF_CONFLICT:
+      s = pool_id2solvable(pool, source);
+      POOL_DEBUG(SAT_DEBUG_RESULT, "package %s conflicts with %s provided by itself\n", solvable2str(pool, s), dep2str(pool, dep));
+      return;
     }
 }
 
index 5e9faba..57a599a 100644 (file)
@@ -122,6 +122,7 @@ typedef struct solver {
   int allowuninstall;                  /* allow removal of installed solvables */
   int updatesystem;                    /* distupgrade */
   int allowvirtualconflicts;           /* false: conflicts on package name, true: conflicts on package provides */
+  int allowselfconflicts;              /* true: packages wich conflict with itself are installable */
   int noupdateprovide;                 /* true: update packages needs not to provide old package */
   int dosplitprovides;                 /* true: consider legacy split provides */
   int dontinstallrecommended;          /* true: do not install recommended packages */
@@ -195,7 +196,8 @@ typedef enum {
   SOLVER_PROBLEM_SAME_NAME,
   SOLVER_PROBLEM_PACKAGE_CONFLICT,
   SOLVER_PROBLEM_PACKAGE_OBSOLETES,
-  SOLVER_PROBLEM_DEP_PROVIDERS_NOT_INSTALLABLE
+  SOLVER_PROBLEM_DEP_PROVIDERS_NOT_INSTALLABLE,
+  SOLVER_PROBLEM_SELF_CONFLICT
 } SolverProbleminfo;