From: Michael Schroeder Date: Tue, 9 Apr 2019 14:32:01 +0000 (+0200) Subject: Use buildversion for comparison if two versions are identical X-Git-Tag: 0.7.5~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=178f68f9ad0d3dc829246ee3e01b1f6383d246db;p=thirdparty%2Flibsolv.git Use buildversion for comparison if two versions are identical --- diff --git a/ext/repo_testcase.c b/ext/repo_testcase.c index 11a46728..48d8a0ed 100644 --- a/ext/repo_testcase.c +++ b/ext/repo_testcase.c @@ -469,6 +469,9 @@ testcase_write_testtags(Repo *repo, FILE *fp) for (i = 0; i < q.count; i++) fprintf(fp, "=Flv: %s\n", pool_id2str(pool, q.elements[i])); } + tmp = solvable_lookup_str(s, SOLVABLE_BUILDVERSION); + if (tmp) + fprintf(fp, "=Bvr: %s\n", tmp); ti = solvable_lookup_num(s, SOLVABLE_BUILDTIME, 0); if (ti) fprintf(fp, "=Tim: %u\n", ti); @@ -690,6 +693,9 @@ testcase_add_testtags(Repo *repo, FILE *fp, int flags) case 'F' << 16 | 'l' << 8 | 'v': repodata_add_poolstr_array(data, s - pool->solvables, SOLVABLE_BUILDFLAVOR, line + 6); break; + case 'B' << 16 | 'v' << 8 | 'r': + repodata_set_str(data, s - pool->solvables, SOLVABLE_BUILDVERSION, line + 6); + break; default: break; } diff --git a/src/policy.c b/src/policy.c index 5f611152..9e42a876 100644 --- a/src/policy.c +++ b/src/policy.c @@ -831,6 +831,19 @@ 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; +} + /* * prune_to_best_version * @@ -878,6 +891,8 @@ prune_to_best_version(Pool *pool, Queue *plist) if (r == 0 && has_package_link(pool, s)) r = pool_link_evrcmp(pool, best, s); #endif + if (r == 0 && pool->disttype == DISTTYPE_CONDA) + r = pool_buildversioncmp(pool, best, s); if (r < 0) best = s; }