diff options
author | Kristian Høgsberg <krh@redhat.com> | 2007-09-12 06:51:15 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@redhat.com> | 2007-09-12 06:52:26 -0400 |
commit | 3633b8d81b0043d5601942f19bafdcfcb0fd30b7 (patch) | |
tree | 12147560858829a3962bb28f9c67a0ec9b9c4ee6 /razor.c | |
parent | b8920dc522ef7f5b3a56f0c811444f173612f112 (diff) |
Make what-requires/provides support versioned queries.
Diffstat (limited to 'razor.c')
-rw-r--r-- | razor.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -1017,7 +1017,8 @@ razor_set_list_provides(struct razor_set *set, const char *name) void razor_set_list_property_packages(struct razor_set *set, struct array *properties, - const char *name) + const char *name, + const char *version) { struct razor_property *property, *end; struct razor_package *p, *packages; @@ -1032,6 +1033,8 @@ razor_set_list_property_packages(struct razor_set *set, pool = set->string_pool.data; end = properties->data + properties->size; while (property < end && strcmp(name, &pool[property->name]) == 0) { + if (version && strcmp(version, &pool[property->version]) != 0) + goto next; r = (unsigned long *) set->property_pool.data + property->packages; while (~*r) { @@ -1039,6 +1042,7 @@ razor_set_list_property_packages(struct razor_set *set, printf("%s %s\n", &pool[p->name], &pool[p->version]); } + next: property++; } } @@ -1149,11 +1153,13 @@ main(int argc, char *argv[]) razor_set_destroy(set); } else if (strcmp(argv[1], "what-requires") == 0) { set = razor_set_open(repo_filename); - razor_set_list_property_packages(set, &set->requires, argv[2]); + razor_set_list_property_packages(set, &set->requires, + argv[2], argv[3]); razor_set_destroy(set); } else if (strcmp(argv[1], "what-provides") == 0) { set = razor_set_open(repo_filename); - razor_set_list_property_packages(set, &set->provides, argv[2]); + razor_set_list_property_packages(set, &set->provides, + argv[2], argv[3]); razor_set_destroy(set); } else if (strcmp(argv[1], "info") == 0) { set = razor_set_open(repo_filename); |