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
This commit is contained in:
Silvan Calarco 2013-01-13 23:30:43 +01:00
parent 72a7609832
commit 13bcb5ed4e
2 changed files with 3 additions and 7 deletions

View File

@ -979,11 +979,6 @@ addToHeaderList(struct configTag *ct,
provided->version=malloc(sizeof(char *)); provided->version=malloc(sizeof(char *));
provided->version[0]=strdup(provideversion[i]); provided->version[0]=strdup(provideversion[i]);
} else if (provided->numproviders > 0) { } 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++; provided->numproviders++;
newprovider=malloc(sizeof(struct headerList*)*provided->numproviders); newprovider=malloc(sizeof(struct headerList*)*provided->numproviders);
for (j = 0; j < provided->numproviders-1; j++) { for (j = 0; j < provided->numproviders-1; j++) {
@ -1008,9 +1003,8 @@ addToHeaderList(struct configTag *ct,
free(provided->version); free(provided->version);
provided->version=newversion; provided->version=newversion;
} }
} else { } 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);
} }
} }

View File

@ -1886,6 +1886,8 @@ print_datatables(struct configTag *ct, int arch) {
while (provided) { while (provided) {
nonobsoletednumproviders=0; nonobsoletednumproviders=0;
for (i = 0; i < provided->numproviders; i++) { 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 (!provided->provider[i]->obsoleted) nonobsoletednumproviders++;
} }
if (nonobsoletednumproviders > 1) { if (nonobsoletednumproviders > 1) {