aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2015-11-09 10:03:31 +0200
committerTimo Teräs <timo.teras@iki.fi>2015-11-09 10:06:57 +0200
commit7501f6012fc06ebfa8c6d8f928f38318267abe72 (patch)
tree8bbf351ff170230fbdcc0ed16088b2b0b2c7aa6e
parent707b51e0c615c0cb488468e4461c778c4d113e5e (diff)
downloadaports-7501f6012fc06ebfa8c6d8f928f38318267abe72.tar.bz2
aports-7501f6012fc06ebfa8c6d8f928f38318267abe72.tar.xz
search: match packages only once
fixes #4770 apk_name_foreach_matching() can matches each package via it's main name and all it's provides. Print matched packages only once.
-rw-r--r--src/search.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/search.c b/src/search.c
index 2e470704f8..62ca816b11 100644
--- a/src/search.c
+++ b/src/search.c
@@ -29,8 +29,16 @@ struct search_ctx {
struct apk_string_array *filter;
};
+static int unique_match(struct apk_package *pkg)
+{
+ if (pkg->state_int) return 0;
+ pkg->state_int = 1;
+ return 1;
+}
+
static void print_package_name(struct search_ctx *ctx, struct apk_package *pkg)
{
+ if (!unique_match(pkg)) return;
printf("%s", pkg->name->name);
if (apk_verbosity > 0)
printf("-" BLOB_FMT, BLOB_PRINTF(*pkg->version));
@@ -41,6 +49,7 @@ static void print_package_name(struct search_ctx *ctx, struct apk_package *pkg)
static void print_origin_name(struct search_ctx *ctx, struct apk_package *pkg)
{
+ if (!unique_match(pkg)) return;
if (pkg->origin != NULL)
printf(BLOB_FMT, BLOB_PRINTF(*pkg->origin));
else