]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Reduce the number if identical conflict rules
authorMichael Schroeder <mls@suse.de>
Mon, 18 May 2015 12:40:18 +0000 (14:40 +0200)
committerMichael Schroeder <mls@suse.de>
Mon, 18 May 2015 12:40:18 +0000 (14:40 +0200)
reduces memory usage and speeds up rule creation a bit.

src/rules.c

index 8a877d996486e731d587319dbb491944d434b3a3..1b2562729dc3a74b384975bc851dee9fa5407bcc 100644 (file)
@@ -931,7 +931,16 @@ solver_addpkgrulesforsolvable(Solver *solv, Solvable *s, Map *m)
                  if (p == SYSTEMSOLVABLE)
                    p = 0;
                  if (s->name == ps->name)
-                   addpkgrule(solv, -n, -p, 0, SOLVER_RULE_PKG_SAME_NAME, 0);
+                   {
+                     /* optimization: do not add the same-name conflict rule if it was
+                      * already added when we looket at the other package.
+                      * (this assumes pool_colormatch is symmetric) */
+                     if (p && m && ps->repo != installed && MAPTST(m, p) &&
+                         (ps->arch != ARCH_SRC && ps->arch != ARCH_NOSRC) &&
+                         !(solv->multiversion.size && MAPTST(&solv->multiversion, p)))
+                       continue;
+                     addpkgrule(solv, -n, -p, 0, SOLVER_RULE_PKG_SAME_NAME, 0);
+                   }
                  else
                    addpkgrule(solv, -n, -p, 0, SOLVER_RULE_PKG_IMPLICIT_OBSOLETES, s->name);
                }