From: Dirk Mueller Date: Thu, 28 May 2009 19:42:54 +0000 (+0200) Subject: Check version / release numbers for consistency X-Git-Tag: BASE-SuSE-Code-12_1-Branch~275 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=80668d4a0495b440b6650935665831b5a91ce762;p=thirdparty%2Flibsolv.git Check version / release numbers for consistency --- diff --git a/tools/patchcheck.c b/tools/patchcheck.c index b900d065..74aef3a3 100644 --- a/tools/patchcheck.c +++ b/tools/patchcheck.c @@ -1,6 +1,13 @@ /* vim: sw=2 et */ +/* + * Copyright (c) 2009, Novell Inc. + * + * This program is licensed under the BSD license, read LICENSE.BSD + * for further information + */ + #define _GNU_SOURCE #include @@ -308,6 +315,8 @@ main(int argc, char **argv) for (pid = 1; pid < pool->nsolvables; pid++) { + int shown = 0; +#define SHOW_PATCH() if (!shown++) printf("%s:\n", solvable2str(pool, s)); Solvable *s = pool->solvables + pid; if (!s->repo) continue; @@ -358,23 +367,21 @@ main(int argc, char **argv) { Solvable *s2 = pool->solvables + p; Id con2, *conp2; - int shown = 0; - if (evrcmp(pool, s->evr, s2->evr, EVRCMP_COMPARE) <= 0) - continue; if (!s2->conflicts) continue; + if (evrcmp(pool, s->evr, s2->evr, EVRCMP_COMPARE) <= 0) + continue; conp2 = s2->repo->idarraydata + s2->conflicts; while ((con2 = *conp2++) != 0) { - Reldep *rd2; + Reldep *rd2, *rd; if (!ISRELDEP(con2)) continue; rd2 = GETRELDEP(pool, con2); conp = s->repo->idarraydata + s->conflicts; while ((con = *conp++) != 0) { - Reldep *rd; if (!ISRELDEP(con)) continue; rd = GETRELDEP(pool, con); @@ -383,16 +390,25 @@ main(int argc, char **argv) } if (!con) { - if (!shown++) - printf("%s:\n", solvable2str(pool, s)); + SHOW_PATCH(); printf(" %s contained %s\n", solvable2str(pool, s2), dep2str(pool, rd2->name)); } + else + { + if (evrcmp(pool, rd->evr, rd2->evr, EVRCMP_COMPARE) < 0) + { + SHOW_PATCH(); + printf(" %s required newer version %s-%s of %s-%s\n", + solvable2str(pool, s2), dep2str(pool, rd2->name), dep2str(pool, rd2->evr), + dep2str(pool, rd->name), dep2str(pool, rd->evr)); + } + } + } } } if (1) { - /* Test 2: are the packages installable */ conp = s->repo->idarraydata + s->conflicts; while ((con = *conp++) != 0) @@ -538,6 +554,35 @@ main(int argc, char **argv) cand.count = j; } } + + if (1) + { + /* Test 4: no GA package fulfills patch dependency */ + conp = s->repo->idarraydata + s->conflicts; + while ((con = *conp++) != 0) + { + Reldep *rd; + Id rp, rpp; + + if (!ISRELDEP(con)) + continue; + rd = GETRELDEP(pool, con); + FOR_PROVIDES(rp, rpp, rd->name) + { + Solvable *s2 = pool_id2solvable(pool, rp); + if (rp < updatestart + && evrcmp(pool, rd->evr, s2->evr, EVRCMP_COMPARE) < 0 + && pool_match_nevr_rel(pool, s2, rd->name) + ) + { + SHOW_PATCH(); + printf(" conflict %s < %s satisfied by non-updated package %s\n", + dep2str(pool, rd->name), dep2str(pool, rd->evr), solvable2str(pool, s2)); + break; + } + } + } + } } exit(status);