From 13bcb5ed4eb9410946191e7e47ad8d560dee4300 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sun, 13 Jan 2013 23:30:43 +0100 Subject: [PATCH] reports.c: fix selection between duplicated providers in deps files Example case: $ rpm -q perl --provides|grep "perl(DynaLoader)" perl(DynaLoader) perl(DynaLoader) = 1.14 --- src/headerlist.c | 8 +------- src/reports.c | 2 ++ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/headerlist.c b/src/headerlist.c index 75702fa..e61b994 100644 --- a/src/headerlist.c +++ b/src/headerlist.c @@ -979,11 +979,6 @@ addToHeaderList(struct configTag *ct, provided->version=malloc(sizeof(char *)); provided->version[0]=strdup(provideversion[i]); } else if (provided->numproviders > 0) { - /* check if the package is already providing it... */ - for (j = 0; j < provided->numproviders; j++) { - if (!strcmp(provided->provider[j]->name,newheaderlist->name)) break; - } - /* if not add to the list of providers */ provided->numproviders++; newprovider=malloc(sizeof(struct headerList*)*provided->numproviders); for (j = 0; j < provided->numproviders-1; j++) { @@ -1008,9 +1003,8 @@ addToHeaderList(struct configTag *ct, free(provided->version); provided->version=newversion; } - } else { - fprintf(stderr,"%s has %d providers but is ignored\n",provided->name,provided->numproviders); + fprintf(stderr,"%s has %d providers but is ignored\n",provided->name,provided->numproviders); } } diff --git a/src/reports.c b/src/reports.c index 5417705..f3edd27 100644 --- a/src/reports.c +++ b/src/reports.c @@ -1886,6 +1886,8 @@ print_datatables(struct configTag *ct, int arch) { while (provided) { nonobsoletednumproviders=0; for (i = 0; i < provided->numproviders; i++) { + // skip duplicated provides + if ((i > 0) && (provided->provider[i] == provided->provider[i-1])) continue; if (!provided->provider[i]->obsoleted) nonobsoletednumproviders++; } if (nonobsoletednumproviders > 1) {