resolveFirstLevelDependencies(): add file providers when a file provide is specified as Provides: /file/provide/example

This commit is contained in:
Silvan Calarco 2011-10-20 15:26:21 +02:00
parent 5fa39e3b16
commit 0950ec1ae4

View File

@ -361,7 +361,7 @@ static int
resolveFirstLevelDependencies(struct configTag *ct, int archidx) resolveFirstLevelDependencies(struct configTag *ct, int archidx)
{ {
struct requireList *currrequire; struct requireList *currrequire;
struct headerList *currheader, *scanheader; struct headerList *currheader, *scanheader, **newprovider;
struct providedList *provided; struct providedList *provided;
struct fileTree *file; struct fileTree *file;
int i,j,k,found; int i,j,k,found;
@ -434,8 +434,31 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx)
fprintf(stderr,"Warning: %s\n",warning); fprintf(stderr,"Warning: %s\n",warning);
addWarning(currheader->sourceheader,warning); addWarning(currheader->sourceheader,warning);
} }
} else if (provided->numproviders > 1) { } else { /* provided->numproviders > 0 */
/*printf("Multiple providers for %s in package %s\n",currheader->require[i]->name,currheader->name);*/ if ((currheader->require[i]->name)[0] == '/') {
/* when there is a Requires: /file/requirement add provide from file tree as well */
file=findOrCreateFileTreeEntry(&ct->filetree[archidx],currheader->require[i]->name);
for (k = 0; k < file->numproviders; k++) {
for (j = 0, found = 0; j < provided->numproviders; j++) {
/* avoid duplicates */
if (file->provider[k] == provided->provider[j]) {
found = 1;
break;
}
}
if (! found) {
//printf("%s also provided by %s\n", currheader->require[i]->name, file->provider[k]->name);
provided->numproviders++;
newprovider=malloc(sizeof(struct headerList*)*provided->numproviders);
for (j = 0; j < provided->numproviders-1; j++) {
newprovider[j]=provided->provider[j];
}
newprovider[provided->numproviders-1] = file->provider[k];
free(provided->provider);
provided->provider=newprovider;
}
}
}
} }
if (provided->numversions > 0) { if (provided->numversions > 0) {
if (strcmp(currheader->require[i]->version,"") && if (strcmp(currheader->require[i]->version,"") &&