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)
{
struct requireList *currrequire;
struct headerList *currheader, *scanheader;
struct headerList *currheader, *scanheader, **newprovider;
struct providedList *provided;
struct fileTree *file;
int i,j,k,found;
@ -402,11 +402,11 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx)
file=findOrCreateFileTreeEntry(&ct->filetree[archidx],currheader->require[i]->name);
if (file->numproviders > 0) {
scanheader=file->provider[0];
provided->numproviders=file->numproviders;
provided->numbuildproviders=0;
provided->buildpriority=0;
provided->provider=file->provider;
provided->flags=0;
provided->numproviders=file->numproviders;
provided->numbuildproviders=0;
provided->buildpriority=0;
provided->provider=file->provider;
provided->flags=0;
} else {
scanheader=NULL;
}
@ -434,8 +434,31 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx)
fprintf(stderr,"Warning: %s\n",warning);
addWarning(currheader->sourceheader,warning);
}
} else if (provided->numproviders > 1) {
/*printf("Multiple providers for %s in package %s\n",currheader->require[i]->name,currheader->name);*/
} else { /* provided->numproviders > 0 */
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 (strcmp(currheader->require[i]->version,"") &&