From b70cb5cf7159fbf753ad1162086c6a09d5063059 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 19 Mar 2021 01:14:42 +0100 Subject: [PATCH] reports.c: indentation fixes --- src/reports.c | 1386 ++++++++++++++++++++++++------------------------- 1 file changed, 676 insertions(+), 710 deletions(-) diff --git a/src/reports.c b/src/reports.c index c4a5eea..f6fdfe9 100644 --- a/src/reports.c +++ b/src/reports.c @@ -751,441 +751,418 @@ generateHTMLMainIndex(struct configTag *configtag) int generateHTML_SRPMSFiles(struct configTag *configtag) { + humanDate strdate; + char indexfile[PATH_MAX]; + char htmlfile[PATH_MAX]; + char warningsdir[PATH_MAX]; + char buffer[PATH_MAX],buffer2[PATH_MAX]; + int c,i,j,arch,idx; + char *st; + char curr_letter,curr_anchor ='a'-1; + FILE *findexout[ARCHS_MAX+1], *fout; + struct changeLog *currchangelog; + struct headerSourceList *currheadersourcelist; + struct headerList *currchild; + struct stat buf; + sizeString strsize; - humanDate strdate; - char indexfile[PATH_MAX]; - char htmlfile[PATH_MAX]; - char warningsdir[PATH_MAX]; - char buffer[PATH_MAX],buffer2[PATH_MAX]; - int c,i,j,arch,idx; - char *st; - char curr_letter,curr_anchor ='a'-1; - FILE *findexout[ARCHS_MAX+1], *fout; - struct changeLog *currchangelog; - struct headerSourceList *currheadersourcelist; - struct headerList *currchild; - struct stat buf; - sizeString strsize; + // create packages directory + snprintf(buffer,PATH_MAX,"%spackages",configtag->html_dir); + if (stat(buffer,&buf)) { + if (mkdir(buffer,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { + logmsg(LOG_ERROR,"cannot create %s directory; aborting.",buffer); + exit(1); + } + } else { + if (!S_ISDIR(buf.st_mode)) { + logmsg(LOG_ERROR,"cannot create %s directory, a file with this name already exists; aborting.",buffer); + exit(1); + } + } - // create packages directory - snprintf(buffer,PATH_MAX,"%spackages",configtag->html_dir); - if (stat(buffer,&buf)) { - if (mkdir(buffer,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { - logmsg(LOG_ERROR,"cannot create %s directory; aborting.",buffer); - exit(1); - } - } else { - if (!S_ISDIR(buf.st_mode)) { - logmsg(LOG_ERROR,"cannot create %s directory, a file with this name already exists; aborting.",buffer); - exit(1); - } - } + // write an empty index.html file to avoid directory files browsing + snprintf(indexfile,PATH_MAX,"%sindex.html",configtag->html_dir); - // write an empty index.html file to avoid directory files browsing - snprintf(indexfile,PATH_MAX,"%sindex.html",configtag->html_dir); + if ((fout = fopen(indexfile, "w")) == NULL) { + perror(indexfile); + return 1; + } + fclose(fout); - if ((fout = fopen(indexfile, "w")) == NULL) { - perror(indexfile); - return 1; - } - fclose(fout); + // create warnings directory + snprintf(warningsdir,PATH_MAX,"%swarnings",configtag->html_dir); + if (stat(warningsdir,&buf)) { + if (mkdir(warningsdir,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { + logmsg(LOG_ERROR,"cannot create %s directory; aborting.",warningsdir); + exit(1); + } + } else { + if (!S_ISDIR(buf.st_mode)) { + logmsg(LOG_ERROR,"cannot create %s directory, a file with this name already exists; aborting.",warningsdir); + exit(1); + } + } - // create warnings directory - snprintf(warningsdir,PATH_MAX,"%swarnings",configtag->html_dir); - if (stat(warningsdir,&buf)) { - if (mkdir(warningsdir,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { - logmsg(LOG_ERROR,"cannot create %s directory; aborting.",warningsdir); - exit(1); - } - } else { - if (!S_ISDIR(buf.st_mode)) { - logmsg(LOG_ERROR,"cannot create %s directory, a file with this name already exists; aborting.",warningsdir); - exit(1); - } - } + /* open full SRPM index file */ + snprintf(indexfile,PATH_MAX,"%s_index.inc",configtag->html_dir); + if ((findexout[0] = fopen(indexfile, "w")) == NULL) { + perror(indexfile); + return 1; + } - /* open full SRPM index file */ - snprintf(indexfile,PATH_MAX,"%s_index.inc",configtag->html_dir); - if ((findexout[0] = fopen(indexfile, "w")) == NULL) { - perror(indexfile); - return 1; - } + /* open arch specific SRPM index files */ + for (arch = 0; arch < ARCHS_MAX; arch++) { + if (configtag->arch[arch]) { + snprintf(indexfile,PATH_MAX,"%s_index-%s.inc",configtag->html_dir,configtag->arch[arch]); + if ((findexout[arch+1] = fopen(indexfile, "w")) == NULL) { + perror(indexfile); + return 1; + } + } else { + findexout[arch+1] = NULL; + } + } - /* open arch specific SRPM index files */ - for (arch = 0; arch < ARCHS_MAX; arch++) { - if (configtag->arch[arch]) { - snprintf(indexfile,PATH_MAX,"%s_index-%s.inc",configtag->html_dir,configtag->arch[arch]); - if ((findexout[arch+1] = fopen(indexfile, "w")) == NULL) { - perror(indexfile); - return 1; - } - } else { - findexout[arch+1] = NULL; - } - } + for (arch = 0; arch < ARCHS_MAX + 1 && findexout[arch]; arch++) { + fprintf(findexout[arch], "

%s - %s

\n", + configtag->tag, configtag->description); + if (configtag->repository_level > 0) { + fprintf(findexout[arch],"

Depends on:

"); + for (c=0; c < configtag->repository_level; c++) { + fprintf(findexout[arch],"%s - %s
", + configtag->configdefaults->url_prefix, + configtag->repository[c]->tag, + configtag->repository[c]->tag, + configtag->repository[c]->description); + } + fprintf(findexout[arch],"\n"); + } + fprintf(findexout[arch], "

List of packages:

\n[ "); +// SourceReleaseBuilds\n"); - for (arch = 0; arch < ARCHS_MAX + 1 && findexout[arch]; arch++) { - fprintf(findexout[arch], - "

%s - %s

\n", - configtag->tag, - configtag->description); - if (configtag->repository_level > 0) { - fprintf(findexout[arch],"

Depends on:

"); - for (c=0; c < configtag->repository_level; c++) { - fprintf(findexout[arch],"%s - %s
", - configtag->configdefaults->url_prefix, - configtag->repository[c]->tag, - configtag->repository[c]->tag, - configtag->repository[c]->description); - } - fprintf(findexout[arch],"\n"); - } - fprintf(findexout[arch], - "

List of packages:

\n[ "); -// SourceReleaseBuilds\n"); + for (c='a'; c <= 'z'; c++) { + fprintf(findexout[arch],"%c  ",c,c); + } + fprintf(findexout[arch]," ]

\n"); + } - for (c='a'; c <= 'z'; c++) { - fprintf(findexout[arch],"%c  ",c,c); - } - fprintf(findexout[arch]," ]

\n"); - } + currheadersourcelist = configtag->headersourcelist; + while (currheadersourcelist) { + if ((configtag->repository_level == 0) || + (currheadersourcelist->altrepository == configtag->repository_level)) { + curr_letter=currheadersourcelist->name[0]; + if (curr_letter >= 'A' && curr_letter <= 'Z') curr_letter=curr_letter+'a'-'A'; + snprintf(htmlfile,PATH_MAX,"%spackages/%s.source.inc", + configtag->html_dir,currheadersourcelist->name); + if ((fout = fopen(htmlfile, "w")) == NULL) { + perror(htmlfile); + return 1; + } - currheadersourcelist = configtag->headersourcelist; + get_favicon_from_url(currheadersourcelist->url, buffer2, PATH_MAX); + fprintf(fout, "

" + " %s: %s (source)

\n", + buffer2, + currheadersourcelist->name, + htmlclean(currheadersourcelist->summary,buffer,PATH_MAX)); - while (currheadersourcelist) { - if ((configtag->repository_level == 0) || - (currheadersourcelist->altrepository == configtag->repository_level)) { + fprintf(fout,"

"); + printHTMLWarnings(fout,configtag,currheadersourcelist,1); - curr_letter=currheadersourcelist->name[0]; - if (curr_letter >= 'A' && curr_letter <= 'Z') curr_letter=curr_letter+'a'-'A'; + fprintf(fout, + "

\n", + currheadersourcelist->name); + if (currheadersourcelist->epoch > 0) { + fprintf(fout, + "\n", + currheadersourcelist->epoch, + currheadersourcelist->version, + currheadersourcelist->release); + } else { + fprintf(fout, + "\n", + currheadersourcelist->version, + currheadersourcelist->release); + } +/* fprintf(fout, + "\n", + htmlclean(currheadersourcelist->summary,buffer,PATH_MAX));*/ + fprintf(fout, + "\n", + configtag->configdefaults->url_prefix, + configtag->tag, + groupdirname(currheadersourcelist->group, buffer2), + htmlclean(currheadersourcelist->group,buffer,PATH_MAX)); - snprintf(htmlfile,PATH_MAX,"%spackages/%s.source.inc",configtag->html_dir,currheadersourcelist->name); + fprintf(fout, "\n", + configtag->configdefaults->url_prefix, + configtag->tag, + currheadersourcelist->packager->name, + currheadersourcelist->packager->name); +// currheadersourcelist->packager->packages_count++; + } else { + fprintf(fout, + "unmaintained\n", + configtag->configdefaults->url_prefix, + configtag->tag); + } + fprintf(fout, + "\n", + htmlclean(currheadersourcelist->description,buffer,PATH_MAX)); + fprintf(fout, + "\n", + currheadersourcelist->license); + fprintf(fout, + "\n", + humanSize(currheadersourcelist->size, &strsize)); + + if (configtag->download_prefix) { + fprintf(fout,"\n"); + } + + if (currheadersourcelist->url) { + fprintf(fout, + "\n", + currheadersourcelist->url, + currheadersourcelist->url); + } + + fprintf(fout, + "\n"); + } + + if (currheadersourcelist->patch) { + fprintf(fout,"\n"); + } + + fprintf(fout, + "\n", + *simpleTimeToHuman(currheadersourcelist->buildtime, + & strdate)); + + for (idx = 0; idx < ARCHS_MAX + 1; idx++) { + if ((idx > 0) && ((!configtag->arch[idx-1]) || (!currheadersourcelist->firstchild[idx-1]))) continue; + if (curr_anchor < curr_letter) { + fprintf(findexout[idx],""); + } + fprintf(findexout[idx],"
Name:%s
Release:%ld:%s-%s
Release:%s-%s
Summary:%s
Group:%s
Maintainer:"); - if ((fout = fopen(htmlfile, "w")) == NULL) { - perror(htmlfile); - return 1; + if (currheadersourcelist->packager && + (currheadersourcelist->packager->role & PACKAGER_ROLE_MAINTAINER)) { + fprintf(fout, + "%s
Description:%s
License:%s
Size:%s
Download:"); + fprintf(fout,"%s-%s-%s.src.rpm", + configtag->download_prefix, + configtag->download_dir, + currheadersourcelist->name, + currheadersourcelist->version, + currheadersourcelist->release, + currheadersourcelist->name, + currheadersourcelist->version, + currheadersourcelist->release); + fprintf(fout,"
URL:%s
Specfile:%s.spec", + configtag->showfile_prefix, + configtag->download_dir, + currheadersourcelist->name, + currheadersourcelist->name); + + if (currheadersourcelist->source) { + fprintf(fout,"
Sources:"); + i=0; + while (currheadersourcelist->source[i+1]) i++; + for (; i>=0; i--) fprintf(fout,"%s ",currheadersourcelist->source[i]); + fprintf(fout,"
Patches:"); + i=0; + while (currheadersourcelist->patch[i+1]) i++; + for (; i>=0; i--) { +// fprintf(fout,"%s ",currheadersourcelist->patch[i]); + fprintf(fout,"%s ", + configtag->showfile_prefix, + configtag->download_dir, + currheadersourcelist->patch[i], + currheadersourcelist->patch[i]); + } + fprintf(fout,"
Build time:%s
"); + while (curr_anchor < curr_letter) { + curr_anchor += 1; + fprintf(findexout[idx],"",curr_anchor); } + fprintf(findexout[idx],"
"); + printpkgicon(findexout[idx], configtag, currheadersourcelist); + fprintf(findexout[idx],"%s: %s",currheadersourcelist->name,htmlclean(currheadersourcelist->summary,buffer,PATH_MAX)); + st=strstr(currheadersourcelist->url,"://"); + if (st) { + strcpy(buffer,st+3); + st=strchr(buffer,'/'); + if (st) st[0]='\0'; + fprintf(findexout[idx], + " ", + currheadersourcelist->url, + configtag->configdefaults->url_dir, + buffer); + } + fprintf(findexout[idx],"
"); - get_favicon_from_url(currheadersourcelist->url, buffer2, PATH_MAX); - - fprintf(fout, - "

" - " %s: %s (source)

\n", - buffer2, - currheadersourcelist->name, - htmlclean(currheadersourcelist->summary,buffer,PATH_MAX)); - - fprintf(fout,"

"); - printHTMLWarnings(fout,configtag,currheadersourcelist,1); - - fprintf(fout, - "

\n", - currheadersourcelist->name); - if (currheadersourcelist->epoch > 0) { - fprintf(fout, - "\n", - currheadersourcelist->epoch, - currheadersourcelist->version, - currheadersourcelist->release); - } else { - fprintf(fout, - "\n", - currheadersourcelist->version, - currheadersourcelist->release); - } -/* fprintf(fout, - "\n", - htmlclean(currheadersourcelist->summary,buffer,PATH_MAX));*/ - fprintf(fout, - "\n", - configtag->configdefaults->url_prefix, - configtag->tag, - groupdirname(currheadersourcelist->group, buffer2), - htmlclean(currheadersourcelist->group,buffer,PATH_MAX)); - - fprintf(fout, - "\n", - configtag->configdefaults->url_prefix, - configtag->tag, - currheadersourcelist->packager->name, - currheadersourcelist->packager->name); -// currheadersourcelist->packager->packages_count++; - } else - fprintf(fout, - "unmaintained\n", - configtag->configdefaults->url_prefix, - configtag->tag); - - fprintf(fout, - "\n", - htmlclean(currheadersourcelist->description,buffer,PATH_MAX)); - fprintf(fout, - "\n", - currheadersourcelist->license); - fprintf(fout, - "\n", - humanSize(currheadersourcelist->size, &strsize)); - - if (configtag->download_prefix) { - - fprintf(fout,"\n"); - } - - if (currheadersourcelist->url) - fprintf(fout, - "\n", - currheadersourcelist->url, - currheadersourcelist->url); - - fprintf(fout, - "\n"); - } - - if (currheadersourcelist->patch) { - fprintf(fout,"\n"); - } - - fprintf(fout, - "\n", - *simpleTimeToHuman(currheadersourcelist->buildtime, - & strdate)); - - for (idx = 0; idx < ARCHS_MAX + 1; idx++) { - if ((idx > 0) && ((!configtag->arch[idx-1]) || (!currheadersourcelist->firstchild[idx-1]))) continue; - if (curr_anchor < curr_letter) { - fprintf(findexout[idx],""); - } - fprintf(findexout[idx],"\n"); + if (currheadersourcelist->epoch) { + fprintf(findexout[idx],"%ld:%s-%s", + currheadersourcelist->epoch, + currheadersourcelist->version, + currheadersourcelist->release); + } else { + fprintf(findexout[idx], + "%s-%s", + currheadersourcelist->version, + currheadersourcelist->release); + } + fprintf(findexout[idx]," - "); + } // for + fprintf(fout,"\n", - configtag->configdefaults->url_prefix, - configtag->tag, - currheadersourcelist->name, - currheadersourcelist->name); + "%s(%s) ", + configtag->configdefaults->url_prefix, + configtag->tag, currchild->name, configtag->arch[arch], + currchild->name, configtag->arch[arch], + currchild->name, + configtag->configdefaults->url_dir); } + fprintf(fout, "%s(%s) ", + configtag->configdefaults->url_prefix, + configtag->tag, currchild->name, configtag->arch[arch], + currchild->name, configtag->arch[arch]); - /* list build requirements */ - fprintf(fout, "\n"); - for (i = 0; i < currheadersourcelist->requirecount; i++) { - if (currheadersourcelist->require[i]->resolved) { - if (currheadersourcelist->require[i]->resolved->numbuildproviders == 0) { - // missing provider - fprintf(fout,"%s(unresolved)",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,"%s", - 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,"%s(",currheadersourcelist->require[i]->resolved->name); - for (j = 0; j < currheadersourcelist->require[i]->resolved->numbuildproviders; j++) { - fprintf(fout,"%s", - 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, "<"); - if (currheadersourcelist->require[i]->flags & RPMSENSE_GREATER) fprintf(fout, ">"); - if (currheadersourcelist->require[i]->flags & RPMSENSE_EQUAL) fprintf(fout, "="); - fprintf(fout, "%s", currheadersourcelist->require[i]->version); - fprintf(fout,"]"); - } - fprintf(fout," "); - } // if required - } // for - fprintf(fout, "\n"); + for (idx = 0; idx < ARCHS_MAX + 1 && findexout[idx]; idx++) { + if ((idx > 0) && ((!configtag->arch[idx-1]) || (!currheadersourcelist->firstchild[idx-1]))) continue; + fprintf(findexout[idx], + "%s(source)\n", + configtag->configdefaults->url_prefix, + configtag->tag, + currheadersourcelist->name, + currheadersourcelist->name); + } - /* print changelog to fout */ - fprintf(fout, - "\n"); - /* close fout */ - fprintf(fout, "
Name:%s
Release:%ld:%s-%s
Release:%s-%s
Summary:%s
Group:%s
Maintainer:"); - - if (currheadersourcelist->packager && - (currheadersourcelist->packager->role & PACKAGER_ROLE_MAINTAINER)) { - fprintf(fout, - "%s
Description:%s
License:%s
Size:%s
Download:"); - - fprintf(fout,"%s-%s-%s.src.rpm", - configtag->download_prefix, - configtag->download_dir, - currheadersourcelist->name, - currheadersourcelist->version, - currheadersourcelist->release, - currheadersourcelist->name, - currheadersourcelist->version, - currheadersourcelist->release); - fprintf(fout,"
URL:%s
Specfile:%s.spec", - configtag->showfile_prefix, - configtag->download_dir, - currheadersourcelist->name, - currheadersourcelist->name); - - if (currheadersourcelist->source) { - fprintf(fout,"
Sources:"); - - i=0; - while (currheadersourcelist->source[i+1]) i++; - - for (; i>=0; i--) - fprintf(fout,"%s ",currheadersourcelist->source[i]); - - fprintf(fout,"
Patches:"); - - i=0; - while (currheadersourcelist->patch[i+1]) i++; - - for (; i>=0; i--) -// fprintf(fout,"%s ",currheadersourcelist->patch[i]); - fprintf(fout,"%s ", - configtag->showfile_prefix, - configtag->download_dir, - currheadersourcelist->patch[i], - currheadersourcelist->patch[i]); - - fprintf(fout,"
Build time:%s
"); - while (curr_anchor < curr_letter) { - curr_anchor += 1; - fprintf(findexout[idx],"",curr_anchor); - } - fprintf(findexout[idx],"
"); - printpkgicon(findexout[idx], configtag, currheadersourcelist); - fprintf(findexout[idx],"%s: %s",currheadersourcelist->name,htmlclean(currheadersourcelist->summary,buffer,PATH_MAX)); - st=strstr(currheadersourcelist->url,"://"); - if (st) { - strcpy(buffer,st+3); - st=strchr(buffer,'/'); - if (st) st[0]='\0'; - fprintf(findexout[idx], - " ", - currheadersourcelist->url, - configtag->configdefaults->url_dir, - buffer); - } - fprintf(findexout[idx],"
"); - - if (currheadersourcelist->epoch) { - fprintf(findexout[idx],"%ld:%s-%s", - currheadersourcelist->epoch, - currheadersourcelist->version, - currheadersourcelist->release); - - } else { - fprintf(findexout[idx], - "%s-%s", - currheadersourcelist->version, - currheadersourcelist->release); - } - - fprintf(findexout[idx]," - "); - } - - fprintf(fout,"
Built RPMS:"); - for (arch = 0; arch < ARCHS_MAX && configtag->arch[arch]; arch++) { - /* write children to both fout and findexout */ - currchild = currheadersourcelist->firstchild[arch]; - - c = 0; - while (currchild) { - for (idx = 0; idx < ARCHS_MAX + 1 && findexout[idx]; idx++) { - if ((idx > 0) && ((!configtag->arch[idx-1]) || (arch != idx -1))) continue; - fprintf(findexout[idx], - "%s(%s) ", - configtag->configdefaults->url_prefix, - configtag->tag, currchild->name, configtag->arch[arch], - currchild->name, configtag->arch[arch], - currchild->name, - configtag->configdefaults->url_dir); - } - fprintf(fout, - "%s(%s) ", - configtag->configdefaults->url_prefix, - configtag->tag, currchild->name, configtag->arch[arch], - currchild->name, configtag->arch[arch]); - - currchild = currchild->nextbrother; - c++; - } - } - fprintf(fout, "
Built RPMS:"); + for (arch = 0; arch < ARCHS_MAX && configtag->arch[arch]; arch++) { + /* write children to both fout and findexout */ + currchild = currheadersourcelist->firstchild[arch]; + c = 0; + while (currchild) { for (idx = 0; idx < ARCHS_MAX + 1 && findexout[idx]; idx++) { - if ((idx > 0) && ((!configtag->arch[idx-1]) || (!currheadersourcelist->firstchild[idx-1]))) continue; + if ((idx > 0) && ((!configtag->arch[idx-1]) || (arch != idx -1))) continue; fprintf(findexout[idx], - "%s(source)

Build requirements:"); + currchild = currchild->nextbrother; + c++; + } + } + fprintf(fout, "

Changelog:"); + /* list build requirements */ + fprintf(fout, "
Build requirements:"); - currchangelog = currheadersourcelist->changelog; - - while (currchangelog) { -// changelog_total++; - simpleTimeToHuman(currchangelog->time, - (humanDate *) & strdate); - - if (currchangelog->pkg) { - if ((currchangelog->pkg->role & PACKAGER_ROLE_MAINTAINER) && - (currchangelog->pkg->packages_count)) { - fprintf(fout, "%s - %s (%s)
%s
", - &strdate[0], - configtag->configdefaults->url_prefix, - configtag->tag, - currchangelog->pkg->name, - currchangelog->pkg->name, - currchangelog->release, - htmlclean(currchangelog->text,buffer,PATH_MAX)); -// currchangelog->pkg->changes_count++; - } else { - fprintf(fout, "%s - %s (%s)
%s
", - &strdate[0], - currchangelog->pkg->name, - currchangelog->release, - htmlclean(currchangelog->text,buffer,PATH_MAX)); -// currchangelog->pkg->changes_count++; - } - } else - fprintf(fout, "%s - (noname) (%s)
%s
", - &strdate[0], - currchangelog->release, - htmlclean(currchangelog->text,buffer,PATH_MAX)); - - currchangelog = currchangelog->next; + for (i = 0; i < currheadersourcelist->requirecount; i++) { + if (currheadersourcelist->require[i]->resolved) { + if (currheadersourcelist->require[i]->resolved->numbuildproviders == 0) { + // missing provider + fprintf(fout,"%s(unresolved)",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,"%s", + 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,"%s(",currheadersourcelist->require[i]->resolved->name); + for (j = 0; j < currheadersourcelist->require[i]->resolved->numbuildproviders; j++) { + fprintf(fout,"%s", + 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, "<"); + if (currheadersourcelist->require[i]->flags & RPMSENSE_GREATER) fprintf(fout, ">"); + if (currheadersourcelist->require[i]->flags & RPMSENSE_EQUAL) fprintf(fout, "="); + fprintf(fout, "%s", currheadersourcelist->require[i]->version); + fprintf(fout,"]"); } + fprintf(fout," "); + } // if required + } // for + fprintf(fout, "
"); - fclose(fout); - } - currheadersourcelist = currheadersourcelist->next; - } - for (idx = 0; idx < ARCHS_MAX + 1 && findexout[idx]; idx++) { - fprintf(findexout[idx], "
\n"); - fclose(findexout[idx]); - } - return 0; + /* print changelog to fout */ + fprintf(fout, + "Changelog:"); + currchangelog = currheadersourcelist->changelog; + while (currchangelog) { +// changelog_total++; + simpleTimeToHuman(currchangelog->time, (humanDate *) & strdate); + if (currchangelog->pkg) { + if ((currchangelog->pkg->role & PACKAGER_ROLE_MAINTAINER) && + (currchangelog->pkg->packages_count)) { + fprintf(fout, "%s - %s (%s)
%s
", + &strdate[0], + configtag->configdefaults->url_prefix, + configtag->tag, + currchangelog->pkg->name, + currchangelog->pkg->name, + currchangelog->release, + htmlclean(currchangelog->text,buffer,PATH_MAX)); +// currchangelog->pkg->changes_count++; + } else { + fprintf(fout, "%s - %s (%s)
%s
", + &strdate[0], + currchangelog->pkg->name, + currchangelog->release, + htmlclean(currchangelog->text,buffer,PATH_MAX)); +// currchangelog->pkg->changes_count++; + } + } else { + fprintf(fout, "%s - (noname) (%s)
%s
", + &strdate[0], + currchangelog->release, + htmlclean(currchangelog->text,buffer,PATH_MAX)); + } + currchangelog = currchangelog->next; + } + + /* close fout */ + fprintf(fout, "
"); + fclose(fout); + } + currheadersourcelist = currheadersourcelist->next; + } // while currheadersourcelist + + for (idx = 0; idx < ARCHS_MAX + 1 && findexout[idx]; idx++) { + fprintf(findexout[idx], "\n"); + fclose(findexout[idx]); + } + return 0; } static int @@ -1300,327 +1277,316 @@ cleanHTMLFiles(struct configTag *ct) int generateHTMLFiles(struct configTag *ct, int arch) { + char buffer[PATH_MAX]; + char htmlfile[PATH_MAX]; + int i,j; + sizeString strsize; + FILE *fout; + struct headerList *currheaderlist, *auxheaderlist; + struct headerSourceList *auxheadersourcelist; + int found; + struct stat buf; - char buffer[PATH_MAX]; - char htmlfile[PATH_MAX]; - int i,j; - sizeString strsize; - FILE *fout; - struct headerList *currheaderlist, *auxheaderlist; - struct headerSourceList *auxheadersourcelist; - int found; - struct stat buf; + snprintf(buffer,PATH_MAX,"%spackages",ct->html_dir); + if (stat(buffer,&buf)) { + if (mkdir(buffer,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { + logmsg(LOG_ERROR,"cannot create %s directory; aborting.",buffer); + exit(1); + } + } else { + if (!S_ISDIR(buf.st_mode)) { + logmsg(LOG_ERROR,"cannot create %s directory, a file with this name already exists; aborting.",buffer); + exit(1); + } + } - snprintf(buffer,PATH_MAX,"%spackages",ct->html_dir); - if (stat(buffer,&buf)) { - if (mkdir(buffer,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { - logmsg(LOG_ERROR,"cannot create %s directory; aborting.",buffer); - exit(1); - } - } else { - if (!S_ISDIR(buf.st_mode)) { - logmsg(LOG_ERROR,"cannot create %s directory, a file with this name already exists; aborting.",buffer); - exit(1); + currheaderlist = ct->headerlist[arch]; + + while (currheaderlist) { + if ((ct->repository_level == 0) || + ((currheaderlist->sourceheader) && + (currheaderlist->altrepository == ct->repository_level))) { + + logmsg(LOG_DEBUG,"generating HTML pages for %s",currheaderlist->name); + snprintf(htmlfile,PATH_MAX,"%spackages/%s.%s.inc",ct->html_dir,currheaderlist->name,ct->arch[arch]); + + if ((fout = fopen(htmlfile, "w")) == NULL) { + perror(htmlfile); + return 1; } - } + get_favicon_from_url(currheaderlist->sourceheader->url, buffer, PATH_MAX); - currheaderlist = ct->headerlist[arch]; + fprintf(fout, + "

" + " %s: %s

", + buffer, + currheaderlist->name, + currheaderlist->summary); + fprintf(fout, + "\n", + currheaderlist->name); + fprintf(fout, + "\n", + currheaderlist->version, currheaderlist->release); + fprintf(fout, + "\n", + currheaderlist->arch); + //fprintf(fout, + // "\n", + // htmlclean(currheaderlist->summary,buffer,PATH_MAX)); + fprintf(fout, + "\n", + htmlclean(currheaderlist->group,buffer,PATH_MAX)); + fprintf(fout, "\n", + htmlclean(currheaderlist->description,buffer,PATH_MAX)); + fprintf(fout, + "\n", + humanSize(currheaderlist->size, &strsize)); + //fprintf(fout, + // "\n", + // currheaderlist->arch); - while (currheaderlist) { - if ((ct->repository_level == 0) || - ((currheaderlist->sourceheader) && - (currheaderlist->altrepository == ct->repository_level))) { + if (ct->download_prefix) { + fprintf(fout,"\n"); + } - if ((fout = fopen(htmlfile, "w")) == NULL) { - perror(htmlfile); - return 1; - } - get_favicon_from_url(currheaderlist->sourceheader->url, buffer, PATH_MAX); + if (currheaderlist->sourcename && currheaderlist->sourceheader) { + fprintf(fout, + "\n", + ct->configdefaults->url_prefix, + ct->tag, + currheaderlist->sourceheader->name, + currheaderlist->sourcename); + } - fprintf(fout, - "

" - " %s: %s

Name:%s
Release:%s-%s
Architecture:%s
Summary:%s
Group:%s
Description:%s
Size:%s
Arch:%s
Download:"); + fprintf(fout,"%s-%s-%s.%s.rpm", + ct->download_prefix, + ct->download_dir, + ct->arch[arch], + currheaderlist->name, + currheaderlist->version, + currheaderlist->release, + currheaderlist->arch, + currheaderlist->name, + currheaderlist->version, + currheaderlist->release, + currheaderlist->arch); - logmsg(LOG_DEBUG,"generating HTML pages for %s",currheaderlist->name); - snprintf(htmlfile,PATH_MAX,"%spackages/%s.%s.inc",ct->html_dir,currheaderlist->name,ct->arch[arch]); + fprintf(fout,"
Source RPM:%s
", - buffer, - currheaderlist->name, - currheaderlist->summary); - fprintf(fout, - "\n", - currheaderlist->name); - fprintf(fout, - "\n", - currheaderlist->version, currheaderlist->release); - fprintf(fout, - "\n", - currheaderlist->arch); -/* fprintf(fout, - "\n", - htmlclean(currheaderlist->summary,buffer,PATH_MAX));*/ - fprintf(fout, - "\n", - htmlclean(currheaderlist->group,buffer,PATH_MAX)); - fprintf(fout, "\n", - htmlclean(currheaderlist->description,buffer,PATH_MAX)); - fprintf(fout, - "\n", - humanSize(currheaderlist->size, &strsize)); + /* list obsoletes */ + if (currheaderlist->obsoletecount > 0) { + fprintf(fout, + "\n"); + } -/* fprintf(fout, - "\n", - currheaderlist->arch);*/ + /* list provides */ + fprintf(fout, + "\n"); - if (ct->download_prefix) { - - fprintf(fout,"\n"); - fprintf(fout,"\n"); - } + /* list RPM requirements */ + fprintf(fout, "\n", - ct->configdefaults->url_prefix, - ct->tag, - currheaderlist->sourceheader->name, - currheaderlist->sourcename); - } + for (i = 0; i < currheaderlist->requirecount; i++) { + if (currheaderlist->require[i]->resolved) { + if (currheaderlist->require[i]->resolved->numproviders == 0) { + // missing provider + fprintf(fout,"%s(unresolved) ",currheaderlist->require[i]->resolved->name); + } else if (currheaderlist->require[i]->resolved->numproviders == 1) { + // single provider + if ((i == 0 || + !currheaderlist->require[i-1]->resolved || + !currheaderlist->require[i-1]->resolved->numproviders || + strcmp(currheaderlist->require[i-1]->resolved->provider[0]->name, + currheaderlist->require[i]->resolved->provider[0]->name)) && + strcmp(currheaderlist->name, + currheaderlist->require[i]->resolved->provider[0]->name)) { + fprintf(fout,"%s ", + ct->configdefaults->url_prefix, + ct->repository[currheaderlist->require[i]->resolved->provider[0]->altrepository]->tag, + currheaderlist->require[i]->resolved->provider[0]->name, + ct->arch[arch], + currheaderlist->require[i]->resolved->provider[0]->name); + if ((ct->repository_level > 0) && + (currheaderlist->sourceheader != currheaderlist->require[i]->resolved->provider[0]->sourceheader) && + (currheaderlist->require[i]->resolved->provider[0]->altrepository == ct->repository_level)) { + snprintf(buffer, PATH_MAX, "%s(%s,%s) requires %s(%s,%s) which is only in this repository", + currheaderlist->name, + ct->arch[arch], + ct->repository[currheaderlist->altrepository]->tag, + currheaderlist->require[i]->resolved->provider[0]->name, + ct->arch[arch], + ct->repository[currheaderlist->require[i]->resolved->provider[0]->altrepository]->tag); + addWarning(currheaderlist->sourceheader, buffer); + } + } + } else { + // multiple providers + if (i == 0 || + !currheaderlist->require[i-1]->resolved || + !currheaderlist->require[i-1]->resolved->numproviders || + strcmp(currheaderlist->require[i-1]->resolved->name, + currheaderlist->require[i]->resolved->name)) { + fprintf(fout,"%s(",currheaderlist->require[i]->resolved->name); + for (j = 0; j < currheaderlist->require[i]->resolved->numproviders; j++) { + fprintf(fout,"%s", + ct->configdefaults->url_prefix, + ct->repository[currheaderlist->require[i]->resolved->provider[j]->altrepository]->tag, + currheaderlist->require[i]->resolved->provider[j]->name, + ct->arch[arch], + currheaderlist->require[i]->resolved->provider[j]->name); + if (j+1 < currheaderlist->require[i]->resolved->numproviders) fprintf(fout,"|"); + } + fprintf(fout,") "); + } + } // if numproviders + } // if required + } // for + fprintf(fout, "\n"); - /* list obsoletes */ - if (currheaderlist->obsoletecount > 0) { - fprintf(fout, - "\n"); - } - - /* list provides */ - fprintf(fout, - "\n"); - - /* list requires */ - fprintf(fout, - "\n"); - - /* list RPM requirements */ - fprintf(fout, "\n"); - - /* list required by */ - fprintf(fout, - "\n"); + } + if (found) break; + } + } + auxheaderlist = auxheaderlist->next; + } // while auxheaderlist + fprintf(fout, "\n"); - /* list build required by */ - fprintf(fout, - "\n"); + } + if (found) break; + } + } + auxheadersourcelist = auxheadersourcelist->next; + } + fprintf(fout, "\n"); - /* list filenames */ - fprintf(fout, - "
Name:%s
Release:%s-%s
Architecture:%s
Summary:%s
Group:%s
Description:%s
Size:%s
Obsoletes:"); + for (i = 0; i < currheaderlist->obsoletecount; i++) { + fprintf(fout, "%s", currheaderlist->obsoletename[i]); + if (currheaderlist->obsoleteflags[i] & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL)) { + fprintf(fout, "["); + if (currheaderlist->obsoleteflags[i] & RPMSENSE_LESS) fprintf(fout, "<"); + if (currheaderlist->obsoleteflags[i] & RPMSENSE_GREATER) fprintf(fout, ">"); + if (currheaderlist->obsoleteflags[i] & RPMSENSE_EQUAL) fprintf(fout, "="); + fprintf(fout, "%s]", currheaderlist->obsoleteversion[i]); + } + fprintf(fout," "); + } + fprintf(fout, "
Arch:%s
Provides:"); + for (i = 0; i < currheaderlist->providecount; i++) { + fprintf(fout, "%s", currheaderlist->providename[i]); + if (currheaderlist->provideflags[i] & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL)) { + fprintf(fout, "["); + if (currheaderlist->provideflags[i] & RPMSENSE_LESS) fprintf(fout, "<"); + if (currheaderlist->provideflags[i] & RPMSENSE_GREATER) fprintf(fout, ">"); + if (currheaderlist->provideflags[i] & RPMSENSE_EQUAL) fprintf(fout, "="); + fprintf(fout, "%s]", currheaderlist->provideversion[i]); + } + fprintf(fout," "); + } + fprintf(fout, "
Download:"); - - fprintf(fout,"%s-%s-%s.%s.rpm", - ct->download_prefix, - ct->download_dir, + /* list requires */ + fprintf(fout, "
Requires:"); + for (i = 0; i < currheaderlist->requirecount; i++) { + if (currheaderlist->require[i]->resolved) { + if (currheaderlist->require[i]->resolved->numproviders == 0) { + // no provider + fprintf(fout,"%s",currheaderlist->require[i]->resolved->name); + } else if (currheaderlist->require[i]->resolved->numproviders == 1) { + // single provider + if (currheaderlist->require[i]->resolved->provider[0]->sourceheader) { + fprintf(fout,"%s", + ct->configdefaults->url_prefix, + ct->repository[currheaderlist->require[i]->resolved->provider[0]->altrepository]->tag, + currheaderlist->require[i]->resolved->provider[0]->name, ct->arch[arch], - currheaderlist->name, - currheaderlist->version, - currheaderlist->release, - currheaderlist->arch, - currheaderlist->name, - currheaderlist->version, - currheaderlist->release, - currheaderlist->arch); + currheaderlist->require[i]->resolved->name); + } else { + fprintf(fout,"%s",currheaderlist->require[i]->resolved->name); + } + } else { + // multiple providers + logmsg(LOG_DEBUG,"Requirement %s has multiple providers",currheaderlist->require[i]->resolved->name); + fprintf(fout,"%s(",currheaderlist->require[i]->resolved->name); + for (j = 0; j < currheaderlist->require[i]->resolved->numproviders; j++) { + if (currheaderlist->require[i]->resolved->provider[j]->sourceheader) + fprintf(fout,"%s", + ct->configdefaults->url_prefix, + ct->repository[currheaderlist->require[i]->resolved->provider[j]->altrepository]->tag, + currheaderlist->require[i]->resolved->provider[j]->name, + ct->arch[arch], + currheaderlist->require[i]->resolved->provider[j]->name); + else + fprintf(fout,"%s",currheaderlist->require[i]->resolved->provider[j]->name); + if (j+1 < currheaderlist->require[i]->resolved->numproviders) fprintf(fout,"|"); + } + fprintf(fout,")"); + } // if numproviders + if (currheaderlist->require[i]->flags & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL)) { + fprintf(fout,"["); + if (currheaderlist->require[i]->flags & RPMSENSE_LESS) fprintf(fout, "<"); + if (currheaderlist->require[i]->flags & RPMSENSE_GREATER) fprintf(fout, ">"); + if (currheaderlist->require[i]->flags & RPMSENSE_EQUAL) fprintf(fout, "="); + fprintf(fout, "%s", currheaderlist->require[i]->version); + fprintf(fout,"]"); + } + fprintf(fout," "); + } // if required + } // for + fprintf(fout, "
RPM requirements:"); - if (currheaderlist->sourcename - && currheaderlist->sourceheader) { - fprintf(fout, - "
Source RPM:%s
Obsoletes:"); - for (i = 0; i < currheaderlist->obsoletecount; i++) { - fprintf(fout, "%s", currheaderlist->obsoletename[i]); - if (currheaderlist->obsoleteflags[i] & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL)) { - fprintf(fout, "["); - if (currheaderlist->obsoleteflags[i] & RPMSENSE_LESS) fprintf(fout, "<"); - if (currheaderlist->obsoleteflags[i] & RPMSENSE_GREATER) fprintf(fout, ">"); - if (currheaderlist->obsoleteflags[i] & RPMSENSE_EQUAL) fprintf(fout, "="); - fprintf(fout, "%s]", currheaderlist->obsoleteversion[i]); - } - fprintf(fout," "); - } - fprintf(fout, "
Provides:"); - for (i = 0; i < currheaderlist->providecount; i++) { - fprintf(fout, "%s", currheaderlist->providename[i]); - if (currheaderlist->provideflags[i] & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL)) { - fprintf(fout, "["); - if (currheaderlist->provideflags[i] & RPMSENSE_LESS) fprintf(fout, "<"); - if (currheaderlist->provideflags[i] & RPMSENSE_GREATER) fprintf(fout, ">"); - if (currheaderlist->provideflags[i] & RPMSENSE_EQUAL) fprintf(fout, "="); - fprintf(fout, "%s]", currheaderlist->provideversion[i]); - } - fprintf(fout," "); - } - fprintf(fout, "
Requires:"); - for (i = 0; i < currheaderlist->requirecount; i++) { - if (currheaderlist->require[i]->resolved) { - if (currheaderlist->require[i]->resolved->numproviders == 0) { - // no provider - fprintf(fout,"%s",currheaderlist->require[i]->resolved->name); - } else if (currheaderlist->require[i]->resolved->numproviders == 1) { - // single provider - if (currheaderlist->require[i]->resolved->provider[0]->sourceheader) { - fprintf(fout,"%s", - ct->configdefaults->url_prefix, - ct->repository[currheaderlist->require[i]->resolved->provider[0]->altrepository]->tag, - currheaderlist->require[i]->resolved->provider[0]->name, - ct->arch[arch], - currheaderlist->require[i]->resolved->name); - } else { - fprintf(fout,"%s",currheaderlist->require[i]->resolved->name); - } - } else { - // multiple providers - logmsg(LOG_DEBUG,"Requirement %s has multiple providers",currheaderlist->require[i]->resolved->name); - fprintf(fout,"%s(",currheaderlist->require[i]->resolved->name); - for (j = 0; j < currheaderlist->require[i]->resolved->numproviders; j++) { - if (currheaderlist->require[i]->resolved->provider[j]->sourceheader) - fprintf(fout,"%s", - ct->configdefaults->url_prefix, - ct->repository[currheaderlist->require[i]->resolved->provider[j]->altrepository]->tag, - currheaderlist->require[i]->resolved->provider[j]->name, - ct->arch[arch], - currheaderlist->require[i]->resolved->provider[j]->name); - else - fprintf(fout,"%s",currheaderlist->require[i]->resolved->provider[j]->name); - if (j+1 < currheaderlist->require[i]->resolved->numproviders) fprintf(fout,"|"); - } - fprintf(fout,")"); - } // if numproviders - if (currheaderlist->require[i]->flags & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL)) { - fprintf(fout,"["); - if (currheaderlist->require[i]->flags & RPMSENSE_LESS) fprintf(fout, "<"); - if (currheaderlist->require[i]->flags & RPMSENSE_GREATER) fprintf(fout, ">"); - if (currheaderlist->require[i]->flags & RPMSENSE_EQUAL) fprintf(fout, "="); - fprintf(fout, "%s", currheaderlist->require[i]->version); - fprintf(fout,"]"); - } - fprintf(fout," "); - } // if required - } // for - fprintf(fout, "
RPM requirements:"); - - for (i = 0; i < currheaderlist->requirecount; i++) { - if (currheaderlist->require[i]->resolved) { - if (currheaderlist->require[i]->resolved->numproviders == 0) { - // missing provider - fprintf(fout,"%s(unresolved) ",currheaderlist->require[i]->resolved->name); - } else if (currheaderlist->require[i]->resolved->numproviders == 1) { - // single provider - if ((i == 0 || - !currheaderlist->require[i-1]->resolved || - !currheaderlist->require[i-1]->resolved->numproviders || - strcmp(currheaderlist->require[i-1]->resolved->provider[0]->name, - currheaderlist->require[i]->resolved->provider[0]->name)) && - strcmp(currheaderlist->name, - currheaderlist->require[i]->resolved->provider[0]->name)) { - fprintf(fout,"%s ", - ct->configdefaults->url_prefix, - ct->repository[currheaderlist->require[i]->resolved->provider[0]->altrepository]->tag, - currheaderlist->require[i]->resolved->provider[0]->name, - ct->arch[arch], - currheaderlist->require[i]->resolved->provider[0]->name); - if ((ct->repository_level > 0) && - (currheaderlist->sourceheader != currheaderlist->require[i]->resolved->provider[0]->sourceheader) && - (currheaderlist->require[i]->resolved->provider[0]->altrepository == ct->repository_level)) { - snprintf(buffer, PATH_MAX, "%s(%s,%s) requires %s(%s,%s) which is only in this repository", - currheaderlist->name, - ct->arch[arch], - ct->repository[currheaderlist->altrepository]->tag, - currheaderlist->require[i]->resolved->provider[0]->name, - ct->arch[arch], - ct->repository[currheaderlist->require[i]->resolved->provider[0]->altrepository]->tag); - addWarning(currheaderlist->sourceheader, buffer); - } - } - } else { - // multiple providers - if (i == 0 || - !currheaderlist->require[i-1]->resolved || - !currheaderlist->require[i-1]->resolved->numproviders || - strcmp(currheaderlist->require[i-1]->resolved->name, - currheaderlist->require[i]->resolved->name)) { - fprintf(fout,"%s(",currheaderlist->require[i]->resolved->name); - for (j = 0; j < currheaderlist->require[i]->resolved->numproviders; j++) { - fprintf(fout,"%s", - ct->configdefaults->url_prefix, - ct->repository[currheaderlist->require[i]->resolved->provider[j]->altrepository]->tag, - currheaderlist->require[i]->resolved->provider[j]->name, - ct->arch[arch], - currheaderlist->require[i]->resolved->provider[j]->name); - if (j+1 < currheaderlist->require[i]->resolved->numproviders) fprintf(fout,"|"); - } - fprintf(fout,") "); - } - } // if numproviders - } // if required - } // for - fprintf(fout, "
Required by:"); - auxheaderlist = ct->headerlist[arch]; - while (auxheaderlist) { - found = 0; - if (auxheaderlist != currheaderlist) { - for (i = 0; i < auxheaderlist->requirecount; i++) { - if (auxheaderlist->require[i]->resolved) { - for (j = 0; j < auxheaderlist->require[i]->resolved->numproviders; j++) { - if (!strcmp(auxheaderlist->require[i]->resolved->provider[j]->name, currheaderlist->name)) { - fprintf(fout, - "%s(%s) ", - ct->configdefaults->url_prefix, - ct->repository[auxheaderlist->altrepository]->tag, - auxheaderlist->name, - ct->arch[arch], - auxheaderlist->name, - ct->arch[arch]); - found = 1; - } - if (found) break; - } + /* list required by */ + fprintf(fout, "
Required by:"); + auxheaderlist = ct->headerlist[arch]; + while (auxheaderlist) { + found = 0; + if (auxheaderlist != currheaderlist) { + for (i = 0; i < auxheaderlist->requirecount; i++) { + if (auxheaderlist->require[i]->resolved) { + for (j = 0; j < auxheaderlist->require[i]->resolved->numproviders; j++) { + if (!strcmp(auxheaderlist->require[i]->resolved->provider[j]->name, currheaderlist->name)) { + fprintf(fout, "%s(%s) ", + ct->configdefaults->url_prefix, + ct->repository[auxheaderlist->altrepository]->tag, + auxheaderlist->name, + ct->arch[arch], + auxheaderlist->name, + ct->arch[arch]); + found = 1; } - if (found) break; + if (found) break; } - } - auxheaderlist = auxheaderlist->next; - } - fprintf(fout, "
Build required by:"); - auxheadersourcelist = ct->headersourcelist; - while (auxheadersourcelist) { - found=0; - if (auxheadersourcelist != currheaderlist->sourceheader) { - for (i = 0; i < auxheadersourcelist->requirecount; i++) { - if (auxheadersourcelist->require[i]->resolved) { - for (j = 0; j < auxheadersourcelist->require[i]->resolved->numbuildproviders; j++) { - if (!strcmp(auxheadersourcelist->require[i]->resolved->buildprovider[j]->name, - currheaderlist->name)) { - fprintf(fout, - "%s ", - ct->configdefaults->url_prefix, - ct->repository[auxheadersourcelist->altrepository]->tag, - auxheadersourcelist->name, - auxheadersourcelist->name); - found=1; - } - } - } - if (found) break; + /* list build required by */ + fprintf(fout, + "
Build required by:"); + auxheadersourcelist = ct->headersourcelist; + while (auxheadersourcelist) { + found=0; + if (auxheadersourcelist != currheaderlist->sourceheader) { + for (i = 0; i < auxheadersourcelist->requirecount; i++) { + if (auxheadersourcelist->require[i]->resolved) { + for (j = 0; j < auxheadersourcelist->require[i]->resolved->numbuildproviders; j++) { + if (!strcmp(auxheadersourcelist->require[i]->resolved->buildprovider[j]->name, + currheaderlist->name)) { + fprintf(fout, + "%s ", + ct->configdefaults->url_prefix, + ct->repository[auxheadersourcelist->altrepository]->tag, + auxheadersourcelist->name, + auxheadersourcelist->name); + found=1; + } } - } - auxheadersourcelist = auxheadersourcelist->next; - } - fprintf(fout, "
Filenames:"); - for (i = 0; i < currheaderlist->filenamecount; i++) { - ftname((currheaderlist->file)[i], buffer); - - fprintf(fout, "/%s ",buffer); - } - fprintf(fout, "
\n"); - fclose(fout); - } - currheaderlist = currheaderlist->next; + /* list filenames */ + fprintf(fout, "Filenames:"); + for (i = 0; i < currheaderlist->filenamecount; i++) { + ftname((currheaderlist->file)[i], buffer); + fprintf(fout, "/%s ",buffer); + } + fprintf(fout, "\n"); + fclose(fout); } - - return 0; + currheaderlist = currheaderlist->next; + } // while currheaderlist + return 0; } char *ftname(struct fileTree* ft, char* buf) {