From: Michael Schroeder Date: Wed, 17 Apr 2019 11:30:36 +0000 (+0200) Subject: Also compare build version if only one of the solvables has it X-Git-Tag: 0.7.5~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44e40f135e94ed2fd2a271726da243980015f9a6;p=thirdparty%2Flibsolv.git Also compare build version if only one of the solvables has it Spotted by Wolf Vollprecht --- diff --git a/src/policy.c b/src/policy.c index d6c9921b..ccaea5a2 100644 --- a/src/policy.c +++ b/src/policy.c @@ -834,14 +834,11 @@ move_installed_to_front(Pool *pool, Queue *plist) static int pool_buildversioncmp(Pool *pool, Solvable *s1, Solvable *s2) { - const char *bv2, *bv1 = solvable_lookup_str(s1, SOLVABLE_BUILDVERSION); - if (bv1) - { - bv2 = solvable_lookup_str(s2, SOLVABLE_BUILDVERSION); - if (bv1 != bv2) - return pool_evrcmp_str(pool, bv1, bv2, EVRCMP_COMPARE); - } - return 0; + const char *bv1 = solvable_lookup_str(s1, SOLVABLE_BUILDVERSION); + const char *bv2 = solvable_lookup_str(s2, SOLVABLE_BUILDVERSION); + if (!bv1 && !bv2) + return 0; + return pool_evrcmp_str(pool, bv1 ? bv1 : "" , bv2 ? bv2 : "", EVRCMP_COMPARE); } static int