]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Also compare buildflavor in version comparison code
authorMichael Schroeder <mls@suse.de>
Mon, 15 Apr 2019 11:21:05 +0000 (13:21 +0200)
committerMichael Schroeder <mls@suse.de>
Mon, 15 Apr 2019 11:21:05 +0000 (13:21 +0200)
This makes the solver result more deterministic.

src/policy.c

index 9e42a876b102f010726ac7f7622b3d065c0bb7b6..d6c9921be36f3aab3e0e833f2676bb723fb7b7bb 100644 (file)
@@ -844,6 +844,16 @@ pool_buildversioncmp(Pool *pool, Solvable *s1, Solvable *s2)
   return 0;
 }
 
+static int
+pool_buildflavorcmp(Pool *pool, Solvable *s1, Solvable *s2)
+{
+  const char *f1 = solvable_lookup_str(s1, SOLVABLE_BUILDFLAVOR);
+  const char *f2 = solvable_lookup_str(s2, SOLVABLE_BUILDFLAVOR);
+  if (!f1 && !f2)
+    return 0;
+  return pool_evrcmp_str(pool, f1 ? f1 : "" , f2 ? f2 : "", EVRCMP_COMPARE);
+}
+
 /*
  * prune_to_best_version
  *
@@ -893,6 +903,8 @@ prune_to_best_version(Pool *pool, Queue *plist)
 #endif
       if (r == 0 && pool->disttype == DISTTYPE_CONDA)
        r = pool_buildversioncmp(pool, best, s);
+      if (r == 0 && pool->disttype == DISTTYPE_CONDA)
+       r = pool_buildflavorcmp(pool, best, s);
       if (r < 0)
        best = s;
     }