diff --git a/src/distromatic.c b/src/distromatic.c index d0207ad..e30614a 100644 --- a/src/distromatic.c +++ b/src/distromatic.c @@ -704,116 +704,110 @@ resolveFirstLevelSourceDependencies(struct configTag *ct, int archidx) logmsg(LOG_DEBUG,"resolveFirstLevelSourceDependencies - sources"); while (currsourceheader) { - if (!currsourceheader->firstchild[archidx]) { // ignore SRPMs with no builds - currsourceheader = currsourceheader->next; - continue; - } - scanheader = ct->headerlist[archidx]; - currsourceheader->requirelist = NULL; -// currsourceheader->require.resolved = malloc(sizeof(struct providedList*)*currsourceheader->requirecount); - for (i = 0; i < currsourceheader->requirecount; i++) { -/* if (strncmp("a2ps",currsourceheader->name,4) == 0) { - fprintf(stderr,"a2ps:%s\n",currheader->require[i]->name); - }*/ - if (strncmp("rpmlib(",currsourceheader->require[i]->name,7) && - strncmp("debuginfo(build-id)",currsourceheader->require[i]->name,20)) { - provided=findOrCreateProvidedListEntry((struct providedList**) &ct->providedlist_idx[archidx], - currsourceheader->require[i]->name,1,archidx); - if (provided->numbuildproviders == 0) { - // check if require[i]->name requirement is met - - if ((currsourceheader->require[i]->name)[0] == '/') { - /* requirement is a file, find who provides it */ - file=findOrCreateFileTreeEntry(&ct->filetree[archidx],currsourceheader->require[i]->name, archidx); - if (file->numproviders > 0) { - provided->numbuildproviders=file->numproviders; - 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 { - /* requirement is not a file, cross-check with provides */ - scanheader = ct->headerlist[archidx]; - while (scanheader) { - if (checkRequireWithProvides( - currsourceheader->require[i]->name, - 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); - } - } - if (provided->numbuildproviders == 0 && incremental_mode) { - snprintf(warning,PATH_MAX,"missing build provider for %s",currsourceheader->require[i]->name); - fprintf(stderr,"Warning: %s(source,%s): %s\n", - currsourceheader->name, - ct->repository[currsourceheader->altrepository]->tag, - warning); - addWarning(currsourceheader,warning); - } + if (!currsourceheader->firstchild[archidx]) { // ignore SRPMs with no builds + currsourceheader = currsourceheader->next; + continue; + } + scanheader = ct->headerlist[archidx]; + currsourceheader->requirelist = NULL; +// currsourceheader->require.resolved = malloc(sizeof(struct providedList*)*currsourceheader->requirecount); + for (i = 0; i < currsourceheader->requirecount; i++) { + if (strncmp("rpmlib(",currsourceheader->require[i]->name,7) && + strncmp("debuginfo(build-id)",currsourceheader->require[i]->name,20)) { + provided=findOrCreateProvidedListEntry((struct providedList**) &ct->providedlist_idx[archidx], + currsourceheader->require[i]->name,1,archidx); + if (provided->numbuildproviders == 0) { + // check if require[i]->name requirement is met + if ((currsourceheader->require[i]->name)[0] == '/') { + /* requirement is a file, find who provides it */ + file=findOrCreateFileTreeEntry(&ct->filetree[archidx],currsourceheader->require[i]->name, archidx); + if (file->numproviders > 0) { + provided->numbuildproviders=file->numproviders; + 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 { + /* requirement is not a file, cross-check with provides */ + scanheader = ct->headerlist[archidx]; + while (scanheader) { + if (checkRequireWithProvides( + currsourceheader->require[i]->name, + 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); + } + } + if (provided->numbuildproviders == 0 && incremental_mode) { + snprintf(warning,PATH_MAX,"missing build provider for %s",currsourceheader->require[i]->name); + fprintf(stderr,"Warning: %s(source,%s): %s\n", + currsourceheader->name, + ct->repository[currsourceheader->altrepository]->tag, + warning); + addWarning(currsourceheader,warning); + } //} else if (provided->numbuildproviders > 1) { /*printf("Multiple providers for %s in package %s\n",currsourceheader->require[i]->name,currsourceheader->name);*/ - } + } - if (provided->numbuildproviders > 0) { - if (strcmp(currsourceheader->require[i]->version,"") && - (currsourceheader->require[i]->flags & (RPMSENSE_LESS+RPMSENSE_GREATER+RPMSENSE_EQUAL))) { - found = 0; - for (j = 0; j < provided->numproviders; j++) { - if (!strcmp(provided->version[j],"")) { - /* provider with no version; assume ok */ - found = 1; - } else { - if (checkVersionWithFlags( - currsourceheader->require[i]->version, - currsourceheader->require[i]->flags, - provided->version[j])) found = 1; - } - } /* for */ - if (!found) { - if (currsourceheader->altrepository == ct->repository_level) { - fprintf(stderr,"Warning: %s(source): build requires %s ",currsourceheader->name,currsourceheader->require[i]->name); - if (currsourceheader->require[i]->flags & RPMSENSE_LESS) fprintf(stderr,"<"); - if (currsourceheader->require[i]->flags & RPMSENSE_GREATER) fprintf(stderr,">"); - if (currsourceheader->require[i]->flags & RPMSENSE_EQUAL) fprintf(stderr,"="); - fprintf(stderr," %s (failing build provider(s):", currsourceheader->require[i]->version); - for (j = 0; j < provided->numbuildproviders; j++) { - fprintf(stderr," %s#%s", - provided->provider[j]->name, provided->buildprovider[j]->version); + if (provided->numbuildproviders > 0) { + if (strcmp(currsourceheader->require[i]->version,"") && + (currsourceheader->require[i]->flags & (RPMSENSE_LESS+RPMSENSE_GREATER+RPMSENSE_EQUAL))) { + found = 0; + for (j = 0; j < provided->numproviders; j++) { + if (!strcmp(provided->version[j],"")) { + /* provider with no version; assume ok */ + found = 1; + } else { + if (checkVersionWithFlags( + currsourceheader->require[i]->version, + currsourceheader->require[i]->flags, + provided->version[j])) found = 1; + } + } /* for */ + if (!found) { + if (currsourceheader->altrepository == ct->repository_level) { + fprintf(stderr,"Warning: %s(source): build requires %s ",currsourceheader->name,currsourceheader->require[i]->name); + if (currsourceheader->require[i]->flags & RPMSENSE_LESS) fprintf(stderr,"<"); + if (currsourceheader->require[i]->flags & RPMSENSE_GREATER) fprintf(stderr,">"); + if (currsourceheader->require[i]->flags & RPMSENSE_EQUAL) fprintf(stderr,"="); + fprintf(stderr," %s (failing build provider(s):", currsourceheader->require[i]->version); + for (j = 0; j < provided->numbuildproviders; j++) { + fprintf(stderr," %s#%s", + provided->provider[j]->name, provided->buildprovider[j]->version); /* printrpmversion(buffer,PATH_MAX, provided->provider[j]->epoch, provided->provider[j]->version, provided->provider[j]->release));*/ - } - fprintf(stderr,")\n"); - } - } - - } - } - currsourceheader->require[i]->resolved=provided; - } else { - currsourceheader->require[i]->resolved=NULL; - } - } - - // sort required list by first provider's name - qsort((void *) &currsourceheader->require[0], - currsourceheader->requirecount, - sizeof(struct Require *), - compareRequiredList); - currsourceheader = currsourceheader->next; + } + fprintf(stderr,")\n"); + } + } + } + } + currsourceheader->require[i]->resolved=provided; + } else { + currsourceheader->require[i]->resolved=NULL; + } + } + // sort required list by first provider's name + qsort((void *) &currsourceheader->require[0], + currsourceheader->requirecount, + sizeof(struct Require *), + compareRequiredList); + currsourceheader = currsourceheader->next; } logmsg(LOG_DEBUG,"resolveFirstLevelSourceDependencies - done"); return 0;