From: Dirk Mueller Date: Thu, 29 Dec 2011 14:09:32 +0000 (+0100) Subject: Add --withobsoletes which checks for obsoleted packages X-Git-Tag: BASE-SuSE-Code-12_2-Branch~217 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2fcde9f3dae2a8780a6842e26e1cb3e74af16836;p=thirdparty%2Flibsolv.git Add --withobsoletes which checks for obsoleted packages --- diff --git a/tools/installcheck.c b/tools/installcheck.c index 82d6c611..558267f7 100644 --- a/tools/installcheck.c +++ b/tools/installcheck.c @@ -36,6 +36,8 @@ usage(char** argv) printf("Usage:\n%s: [options..] repo [--nocheck repo]...\n" "\t--exclude \twhitespace-separated list of (sub-)" "packagenames to ignore\n" + "\t--withobsoletes\t\tCheck for obsoletes on packages contained in repos\n" + "\t--nocheck\t\tDo not warn about all following repos (only use them to fulfill dependencies)\n" "\t--withsrc\t\tAlso check dependencies of src.rpm\n\n" , argv[0]); exit(1); @@ -58,6 +60,7 @@ main(int argc, char **argv) int status = 0; int nocheck = 0; int withsrc = 0; + int obsoletepkgcheck = 0; exclude_pat = 0; archlock = 0; @@ -77,6 +80,11 @@ main(int argc, char **argv) withsrc++; continue; } + if (!strcmp(argv[i], "--withobsoletes")) + { + obsoletepkgcheck++; + continue; + } if (!strcmp(argv[i], "--nocheck")) { if (!nocheck) @@ -192,6 +200,38 @@ main(int argc, char **argv) { archlock = pool_queuetowhatprovides(pool, &archlocks); } + + + if (obsoletepkgcheck) + for (i = 0; i < cand.count; i++) + { + Solvable *s; + s = pool->solvables + cand.elements[i]; + + if (s->obsoletes) + { + Id op, opp; + Id obs, *obsp = s->repo->idarraydata + s->obsoletes; + + while ((obs = *obsp++) != 0) + { + FOR_PROVIDES(op, opp, obs) + { + if (nocheck && op >= nocheck) + continue; + + if (!solvable_identical(s, pool_id2solvable(pool, op)) + && pool_match_nevr(pool, pool_id2solvable(pool, op), obs)) + { + status = 2; + printf("can't install %s:\n", pool_solvid2str(pool, op)); + printf(" package is obsoleted by %s\n", pool_solvable2str(pool, s)); + } + } + } + } + } + /* prune cand by doing weak installs */ while (cand.count) {