From: Michael Schroeder Date: Mon, 15 Apr 2019 11:21:05 +0000 (+0200) Subject: Also compare buildflavor in version comparison code X-Git-Tag: 0.7.5~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66b6d67aee66aa0ecef4b487e31ba31d2fc1f8c9;p=thirdparty%2Flibsolv.git Also compare buildflavor in version comparison code This makes the solver result more deterministic. --- diff --git a/src/policy.c b/src/policy.c index 9e42a876..d6c9921b 100644 --- a/src/policy.c +++ b/src/policy.c @@ -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; }