diff options
author | Michael Schroeder <mls@suse.de> | 2013-09-04 18:54:57 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2013-09-04 18:54:57 +0200 |
commit | 813ed1da5594e3fcde37f9f23120f70791e7a596 (patch) | |
tree | 5f2cbf1d0190a3a1f71c88489b0ef85ed968bde7 /examples | |
parent | 9baad7fefcf3152882fe5d31bb386e64839d5929 (diff) | |
download | libsolv-813ed1da5594e3fcde37f9f23120f70791e7a596.tar.gz libsolv-813ed1da5594e3fcde37f9f23120f70791e7a596.tar.bz2 libsolv-813ed1da5594e3fcde37f9f23120f70791e7a596.zip |
add pool_whatmatchesdep and selection_make_deps to query for packages intersecting a dependency
Diffstat (limited to 'examples')
-rw-r--r-- | examples/solv.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/examples/solv.c b/examples/solv.c index 7d6de97..d4a6b6c 100644 --- a/examples/solv.c +++ b/examples/solv.c @@ -2598,6 +2598,7 @@ main(int argc, char **argv) int cleandeps = 0; int forcebest = 0; char *rootdir = 0; + char *keyname = 0; argc--; argv++; @@ -2669,7 +2670,6 @@ main(int argc, char **argv) argc -= 2; argv += 2; } - else if (argc > 1 && !strcmp(argv[1], "--clean")) { cleandeps = 1; @@ -2682,6 +2682,12 @@ main(int argc, char **argv) argc--; argv++; } + if (argc > 2 && !strcmp(argv[1], "--keyname")) + { + keyname = argv[2]; + argc -= 2; + argv += 2; + } else break; } @@ -2851,6 +2857,8 @@ main(int argc, char **argv) #endif pool_createwhatprovides(pool); + if (keyname) + keyname = solv_dupjoin("solvable:", keyname, 0); queue_init(&job); for (i = 1; i < argc; i++) { @@ -2869,13 +2877,19 @@ main(int argc, char **argv) flags |= SELECTION_WITH_SOURCE; if (argv[i][0] == '/') flags |= SELECTION_FILELIST | (mode == MODE_ERASE ? SELECTION_INSTALLED_ONLY : 0); - rflags = selection_make(pool, &job2, argv[i], flags); + if (!keyname) + rflags = selection_make(pool, &job2, argv[i], flags); + else + rflags = selection_make_deps(pool, &job2, argv[i], flags, pool_str2id(pool, keyname, 1)); if (repofilter.count) selection_filter(pool, &job2, &repofilter); if (!job2.count) { flags |= SELECTION_NOCASE; - rflags = selection_make(pool, &job2, argv[i], flags); + if (!keyname) + rflags = selection_make(pool, &job2, argv[i], flags); + else + rflags = selection_make_deps(pool, &job2, argv[i], flags, pool_str2id(pool, keyname, 1)); if (repofilter.count) selection_filter(pool, &job2, &repofilter); if (job2.count) @@ -2894,6 +2908,7 @@ main(int argc, char **argv) queue_push(&job, job2.elements[j]); queue_free(&job2); } + keyname = solv_free(keyname); if (!job.count && (mainmode == MODE_UPDATE || mainmode == MODE_DISTUPGRADE || mainmode == MODE_VERIFY || repofilter.count)) { |