reports.c: generateHTML_SRPMSFiles: fix a segfault when writing multiple providers
This commit is contained in:
parent
374df0a529
commit
160acba232
@ -1165,49 +1165,50 @@ generateHTML_SRPMSFiles(struct configTag *configtag)
|
||||
/* list build requirements */
|
||||
fprintf(fout, "<tr><td nowrap>Build requirements:</td><td><font size=\"-1\">");
|
||||
|
||||
for (i = 0; i < currheadersourcelist->requirecount; i++) {
|
||||
if (currheadersourcelist->require[i]->resolved) {
|
||||
if (currheadersourcelist->require[i]->resolved->numbuildproviders == 0) {
|
||||
// missing provider
|
||||
fprintf(fout,"<b>%s(unresolved)</b>",currheadersourcelist->require[i]->resolved->name);
|
||||
} else if (currheadersourcelist->require[i]->resolved->numbuildproviders == 1) {
|
||||
// single provider
|
||||
if ((i == 0 ||
|
||||
strcmp(currheadersourcelist->require[i-1]->name,
|
||||
currheadersourcelist->require[i]->name)) &&
|
||||
strcmp(currheadersourcelist->name,
|
||||
currheadersourcelist->require[i]->name)) {
|
||||
fprintf(fout,"<a href=\"%stag=%s&pkg=%s.%s\">%s</a>",
|
||||
configtag->configdefaults->url_prefix,
|
||||
configtag->repository[currheadersourcelist->require[i]->resolved->buildprovider[0]->altrepository]->tag,
|
||||
currheadersourcelist->require[i]->resolved->name,
|
||||
configtag->arch[0],
|
||||
currheadersourcelist->require[i]->resolved->name);
|
||||
if ((configtag->repository_level > 0) &&
|
||||
currheadersourcelist->require[i]->resolved->buildprovider[0]->sourceheader &&
|
||||
(currheadersourcelist->require[i]->resolved->buildprovider[0]->altrepository == configtag->repository_level)) {
|
||||
snprintf(buffer, PATH_MAX, "has build requirement %s which is only provided in this repository",
|
||||
currheadersourcelist->require[i]->resolved->name);
|
||||
addWarning(currheadersourcelist, buffer);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// multiple providers
|
||||
if (i == 0 ||
|
||||
strcmp(currheadersourcelist->require[i-1]->resolved->name,
|
||||
currheadersourcelist->require[i]->resolved->name))
|
||||
fprintf(fout,"<i>%s</i>(",currheadersourcelist->require[i]->resolved->name);
|
||||
for (j = 0; j < currheadersourcelist->require[i]->resolved->numbuildproviders; j++) {
|
||||
fprintf(fout,"<a href=\"%stag=%s&pkg=%s.%s\">%s</a>",
|
||||
configtag->configdefaults->url_prefix,
|
||||
configtag->repository[currheadersourcelist->require[i]->resolved->buildprovider[j]->altrepository]->tag,
|
||||
currheadersourcelist->require[i]->resolved->buildprovider[j]->name,
|
||||
configtag->arch[0],
|
||||
currheadersourcelist->require[i]->resolved->buildprovider[j]->name);
|
||||
if (j+1 < currheadersourcelist->require[i]->resolved->numbuildproviders) fprintf(fout,"|");
|
||||
}
|
||||
fprintf(fout,")");
|
||||
} // if numproviders
|
||||
for (i = 0; i < currheadersourcelist->requirecount; i++) {
|
||||
if (currheadersourcelist->require[i]->resolved) {
|
||||
if (currheadersourcelist->require[i]->resolved->numbuildproviders == 0) {
|
||||
// missing provider
|
||||
fprintf(fout,"<b>%s(unresolved)</b>",currheadersourcelist->require[i]->resolved->name);
|
||||
} else if (currheadersourcelist->require[i]->resolved->numbuildproviders == 1) {
|
||||
// single provider
|
||||
if ((i == 0 ||
|
||||
strcmp(currheadersourcelist->require[i-1]->name,
|
||||
currheadersourcelist->require[i]->name)) &&
|
||||
strcmp(currheadersourcelist->name,
|
||||
currheadersourcelist->require[i]->name)) {
|
||||
fprintf(fout,"<a href=\"%stag=%s&pkg=%s.%s\">%s</a>",
|
||||
configtag->configdefaults->url_prefix,
|
||||
configtag->repository[currheadersourcelist->require[i]->resolved->buildprovider[0]->altrepository]->tag,
|
||||
currheadersourcelist->require[i]->resolved->name,
|
||||
configtag->arch[0],
|
||||
currheadersourcelist->require[i]->resolved->name);
|
||||
if ((configtag->repository_level > 0) &&
|
||||
currheadersourcelist->require[i]->resolved->buildprovider[0]->sourceheader &&
|
||||
(currheadersourcelist->require[i]->resolved->buildprovider[0]->altrepository == configtag->repository_level)) {
|
||||
snprintf(buffer, PATH_MAX, "has build requirement %s which is only provided in this repository",
|
||||
currheadersourcelist->require[i]->resolved->name);
|
||||
addWarning(currheadersourcelist, buffer);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// multiple providers
|
||||
if (i == 0 ||
|
||||
!currheadersourcelist->require[i-1]->resolved ||
|
||||
strcmp(currheadersourcelist->require[i-1]->resolved->name,
|
||||
currheadersourcelist->require[i]->resolved->name))
|
||||
fprintf(fout,"<i>%s</i>(",currheadersourcelist->require[i]->resolved->name);
|
||||
for (j = 0; j < currheadersourcelist->require[i]->resolved->numbuildproviders; j++) {
|
||||
fprintf(fout,"<a href=\"%stag=%s&pkg=%s.%s\">%s</a>",
|
||||
configtag->configdefaults->url_prefix,
|
||||
configtag->repository[currheadersourcelist->require[i]->resolved->buildprovider[j]->altrepository]->tag,
|
||||
currheadersourcelist->require[i]->resolved->buildprovider[j]->name,
|
||||
configtag->arch[0],
|
||||
currheadersourcelist->require[i]->resolved->buildprovider[j]->name);
|
||||
if (j+1 < currheadersourcelist->require[i]->resolved->numbuildproviders) fprintf(fout,"|");
|
||||
}
|
||||
fprintf(fout,")");
|
||||
} // if numproviders
|
||||
if (currheadersourcelist->require[i]->flags & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL)) {
|
||||
fprintf(fout,"[");
|
||||
if (currheadersourcelist->require[i]->flags & RPMSENSE_LESS) fprintf(fout, "<");
|
||||
|
Loading…
Reference in New Issue
Block a user