From 59e25e737ffb40dfc08381f76bf9059fb6540c11 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sat, 13 Jul 2013 11:53:05 +0200 Subject: [PATCH] Fix support for multiple build providers --- src/distromatic.c | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/src/distromatic.c b/src/distromatic.c index 0bc8a87..3347a07 100644 --- a/src/distromatic.c +++ b/src/distromatic.c @@ -666,7 +666,6 @@ resolveFirstLevelSourceDependencies(struct configTag *ct, int archidx) currsourceheader->require[i]->name,1,archidx); if (provided->numbuildproviders == 0) { // check if require[i]->name requirement is met - scanheader = ct->headerlist[archidx]; if ((currsourceheader->require[i]->name)[0] == '/') { /* requirement is a file, find who provides it */ @@ -677,25 +676,31 @@ resolveFirstLevelSourceDependencies(struct configTag *ct, int archidx) provided->buildprovider=file->provider; provided->flags=0; logmsg(LOG_DEBUG,"file %s is a build provider for %s",currsourceheader->require[i]->name,currsourceheader->name); - } else { - scanheader=NULL; } } else { /* requirement is not a file, cross-check with provides */ - - while (scanheader && - !checkRequireWithProvides( + scanheader = ct->headerlist[archidx]; + while (scanheader) { + if (checkRequireWithProvides( currsourceheader->require[i]->name, - scanheader)) scanheader = scanheader->next; - if (scanheader) { - provided->numbuildproviders=1; - provided->buildprovider=malloc(sizeof(struct headerList*)); - provided->buildprovider[0]=scanheader; - provided->flags=0; + scanheader)) provided->numbuildproviders+=1; + scanheader = scanheader->next; + } + if (provided->numbuildproviders > 0) { + provided->buildprovider = malloc(sizeof(struct headerList*) * provided->numbuildproviders); + provided->flags = 0; + scanheader = ct->headerlist[archidx]; + j = 0; + while (scanheader) { + if (checkRequireWithProvides( + currsourceheader->require[i]->name, + scanheader)) provided->buildprovider[j++] = scanheader; + scanheader = scanheader->next; + } + logmsg(LOG_DEBUG,"%s is a build provider for %s",provided->name,currsourceheader->name); } - logmsg(LOG_DEBUG,"%s is a build provider for %s",provided->name,currsourceheader->name); } - if (!scanheader) { + if (provided->numbuildproviders == 0) { snprintf(warning,PATH_MAX,"missing build provider for %s",currsourceheader->require[i]->name); fprintf(stderr,"Warning: %s(source,%s): %s\n", currsourceheader->name, @@ -703,17 +708,7 @@ resolveFirstLevelSourceDependencies(struct configTag *ct, int archidx) warning); addWarning(currsourceheader,warning); } -/* if (scanheader) { - provided->numbuildproviders=1; - provided->buildprovider=malloc(sizeof(struct headerList*)); - provided->buildprovider[0]=scanheader; - provided->flags=0; - } else { - snprintf(warning, PATH_MAX, "missing build provider for %s", currsourceheader->require[i]->name); - fprintf(stderr,"Warning: %s: %s\n",currsourceheader->name, warning); - addWarning(currsourceheader, warning); - }*/ - } else if (provided->numbuildproviders > 1) { + //} else if (provided->numbuildproviders > 1) { /*printf("Multiple providers for %s in package %s\n",currsourceheader->require[i]->name,currsourceheader->name);*/ }