diff options
author | Dirk Mueller <dmueller@suse.de> | 2011-12-29 15:09:32 +0100 |
---|---|---|
committer | Dirk Mueller <dmueller@suse.de> | 2011-12-29 15:09:32 +0100 |
commit | 2fcde9f3dae2a8780a6842e26e1cb3e74af16836 (patch) | |
tree | 32182f984ce66bb70a19f7b4212b08d53b6fecab | |
parent | 8973230757515727f9eee305c8da4bdf2eaaa7ae (diff) | |
download | libsolv-2fcde9f3dae2a8780a6842e26e1cb3e74af16836.tar.gz libsolv-2fcde9f3dae2a8780a6842e26e1cb3e74af16836.tar.bz2 libsolv-2fcde9f3dae2a8780a6842e26e1cb3e74af16836.zip |
Add --withobsoletes which checks for obsoleted packages
-rw-r--r-- | tools/installcheck.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tools/installcheck.c b/tools/installcheck.c index 82d6c61..558267f 100644 --- a/tools/installcheck.c +++ b/tools/installcheck.c @@ -36,6 +36,8 @@ usage(char** argv) printf("Usage:\n%s: <arch> [options..] repo [--nocheck repo]...\n" "\t--exclude <pattern>\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) { |