From 7bc65d8d44d8925133e8a70c005e0b1b99a18505 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Tue, 27 Sep 2011 22:04:40 +0200 Subject: [PATCH] Add altrepository in headerlist structure (binary packages) to have correct values for obsoleted packages; replace occurencies of sourceheaderlist->altrepository with altrepository --- src/distromatic.c | 26 +++++++++++++------------- src/headerlist.c | 6 ++++-- src/include/headerlist.h | 3 ++- src/reports.c | 24 ++++++++++++------------ 4 files changed, 31 insertions(+), 28 deletions(-) diff --git a/src/distromatic.c b/src/distromatic.c index 27b601d..f33bead 100644 --- a/src/distromatic.c +++ b/src/distromatic.c @@ -255,7 +255,7 @@ handleObsoletedPackages(struct configTag *ct, int archidx) prov->provider[i]->obsoleteflags[j], buf)) continue; } - if (prov->provider[k]->sourceheader->altrepository == ct->repository_level) { + if (prov->provider[k]->altrepository == ct->repository_level) { currheader = prov->provider[k]->sourceheader->firstchild[archidx]; while (currheader) { /* print 'obsoleted by' warning only for binary packages belonging to target repository */ @@ -263,10 +263,10 @@ handleObsoletedPackages(struct configTag *ct, int archidx) snprintf(buf, PATH_MAX, "%s(%s,%s) obsoleted by %s(%s,%s)", prov->provider[k]->name, prov->provider[k]->arch, - ct->repository[prov->provider[k]->sourceheader->altrepository]->tag, + ct->repository[prov->provider[k]->altrepository]->tag, prov->provider[i]->name, prov->provider[i]->arch, - ct->repository[prov->provider[i]->sourceheader->altrepository]->tag); + ct->repository[prov->provider[i]->altrepository]->tag); addWarning(prov->provider[k]->sourceheader, buf); logmsg(LOG_WARNING,"%s", buf); break; @@ -274,14 +274,14 @@ handleObsoletedPackages(struct configTag *ct, int archidx) currheader = currheader -> nextbrother; } } - if (prov->provider[i]->sourceheader->altrepository == ct->repository_level) { + if (prov->provider[i]->altrepository == ct->repository_level) { snprintf(buf, PATH_MAX, "%s(%s,%s) obsoletes %s(%s,%s)", prov->provider[i]->name, prov->provider[i]->arch, - ct->repository[prov->provider[i]->sourceheader->altrepository]->tag, + ct->repository[prov->provider[i]->altrepository]->tag, prov->provider[k]->name, prov->provider[k]->arch, - ct->repository[prov->provider[k]->sourceheader->altrepository]->tag); + ct->repository[prov->provider[k]->altrepository]->tag); addWarning(prov->provider[i]->sourceheader, buf); logmsg(LOG_WARNING,"%s", buf); } @@ -327,19 +327,19 @@ handleObsoletedPackages(struct configTag *ct, int archidx) snprintf(buf, PATH_MAX, "%s(%s,%s) obsoletes %s(%s,%s)", currheader->name, currheader->arch, - ct->repository[currheader->sourceheader->altrepository]->tag, + ct->repository[currheader->altrepository]->tag, prov->provider[i]->name, prov->provider[i]->arch, - ct->repository[prov->provider[i]->sourceheader->altrepository]->tag); + ct->repository[prov->provider[i]->altrepository]->tag); } else { snprintf(buf, PATH_MAX, "%s(%s,%s) obsoletes %s provided by %s(%s,%s)", currheader->name, currheader->arch, - ct->repository[currheader->sourceheader->altrepository]->tag, + ct->repository[currheader->altrepository]->tag, prov->name, prov->provider[i]->name, prov->provider[i]->arch, - ct->repository[prov->provider[i]->sourceheader->altrepository]->tag); + ct->repository[prov->provider[i]->altrepository]->tag); } addWarning(currheader->sourceheader, buf); logmsg(LOG_WARNING,"%s", buf); @@ -429,7 +429,7 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx) snprintf(warning,PATH_MAX,"%s(%s,%s): missing provider for %s", currheader->name, ct->arch[archidx], - ct->repository[currheader->sourceheader->altrepository]->tag, + ct->repository[currheader->altrepository]->tag, currheader->require[i]->name); fprintf(stderr,"Warning: %s\n",warning); addWarning(currheader->sourceheader,warning); @@ -467,11 +467,11 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx) currheader->require[i]->version, currheader->name, currheader->arch, - ct->repository[currheader->sourceheader->altrepository]->tag); + ct->repository[currheader->altrepository]->tag); for (k = 0; k < provided->numproviders; k++) { if (provided->provider[k]->sourceheader && - (provided->provider[k]->sourceheader->altrepository == ct->repository_level)) { + (provided->provider[k]->altrepository == ct->repository_level)) { fprintf(stderr,"Warning: %s\n", warning); addWarning(provided->provider[k]->sourceheader, warning); } diff --git a/src/headerlist.c b/src/headerlist.c index 315b618..15ce15a 100644 --- a/src/headerlist.c +++ b/src/headerlist.c @@ -233,7 +233,7 @@ generateHeaderStats(struct configTag *ct, int arch) currheaderlist = headerlist; while (currheaderlist) { if (currheaderlist->sourceheader - && currheaderlist->sourceheader->altrepository == altrepository) { + && currheaderlist->altrepository == altrepository) { (stats->headercount[arch])++; stats->headersize[arch] += currheaderlist->size; } @@ -250,7 +250,7 @@ generateHeaderStats(struct configTag *ct, int arch) c = 0; while (currheaderlist) { if (currheaderlist->sourceheader - && currheaderlist->sourceheader->altrepository == + && currheaderlist->altrepository == altrepository) { stats->headerlistvec[arch][c] = currheaderlist; c++; @@ -1025,6 +1025,8 @@ addToHeaderList(struct configTag *ct, newheaderlist->obsoleteversion = obsoleteversion; newheaderlist->obsoletecount = obsoletecount; + newheaderlist->altrepository = altrepository; + newheaderlist->require = malloc(requirecount * sizeof(struct Require *)); for (j=0; j < requirecount; j++) { newheaderlist->require[j] = malloc(sizeof(struct Require)); diff --git a/src/include/headerlist.h b/src/include/headerlist.h index 16d794c..9e99a66 100644 --- a/src/include/headerlist.h +++ b/src/include/headerlist.h @@ -58,6 +58,7 @@ struct Require { struct headerList { char *name; + int altrepository; long epoch; char *version; char *release; @@ -89,6 +90,7 @@ struct headerList { struct headerSourceList { char *name; + int altrepository; long epoch; char *version; char *release; @@ -109,7 +111,6 @@ struct headerSourceList { char **basename; int filenamecount; long buildtime; - int altrepository; int updrepository; int requirecount; struct Require **require; diff --git a/src/reports.c b/src/reports.c index 1e94e96..435ad93 100644 --- a/src/reports.c +++ b/src/reports.c @@ -1160,7 +1160,7 @@ generateHTML_SRPMSFiles(struct configTag *configtag) currheadersourcelist->require[i]->name)) { if ((configtag->repository_level == 0) || (currheadersourcelist->require[i]->resolved->buildprovider[0]->sourceheader && - currheadersourcelist->require[i]->resolved->buildprovider[0]->sourceheader->altrepository == configtag->repository_level)) { + currheadersourcelist->require[i]->resolved->buildprovider[0]->altrepository == configtag->repository_level)) { fprintf(fout,"%s", configtag->configdefaults->url_prefix, configtag->tag, @@ -1185,7 +1185,7 @@ generateHTML_SRPMSFiles(struct configTag *configtag) for (j = 0; j < currheadersourcelist->require[i]->resolved->numbuildproviders; j++) { if ((configtag->repository_level == 0) || (currheadersourcelist->require[i]->resolved->buildprovider[j]->sourceheader && - currheadersourcelist->require[i]->resolved->buildprovider[j]->sourceheader->altrepository == configtag->repository_level)) + currheadersourcelist->require[i]->resolved->buildprovider[j]->altrepository == configtag->repository_level)) fprintf(fout,"%s", configtag->configdefaults->url_prefix, configtag->tag, @@ -1393,7 +1393,7 @@ generateHTMLFiles(struct configTag *ct, int arch) while (currheaderlist) { if ((ct->repository_level == 0) || ((currheaderlist->sourceheader) && - (currheaderlist->sourceheader->altrepository == ct->repository_level))) { + (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]); @@ -1511,7 +1511,7 @@ generateHTMLFiles(struct configTag *ct, int arch) // single provider if ((ct->repository_level == 0) || (currheaderlist->require[i]->resolved->provider[0]->sourceheader && - currheaderlist->require[i]->resolved->provider[0]->sourceheader->altrepository == ct->repository_level)) { + currheaderlist->require[i]->resolved->provider[0]->altrepository == ct->repository_level)) { fprintf(fout,"%s", ct->configdefaults->url_prefix, ct->tag, @@ -1528,7 +1528,7 @@ generateHTMLFiles(struct configTag *ct, int arch) for (j = 0; j < currheaderlist->require[i]->resolved->numproviders; j++) { if ((ct->repository_level == 0) || (currheaderlist->require[i]->resolved->provider[j]->sourceheader && - currheaderlist->require[i]->resolved->provider[j]->sourceheader->altrepository == ct->repository_level)) + currheaderlist->require[i]->resolved->provider[j]->altrepository == ct->repository_level)) fprintf(fout,"%s", ct->configdefaults->url_prefix, ct->tag, @@ -1574,7 +1574,7 @@ generateHTMLFiles(struct configTag *ct, int arch) if ((ct->repository_level == 0) || (currheaderlist->require[i]->resolved->provider[0]->sourceheader && - currheaderlist->require[i]->resolved->provider[0]->sourceheader->altrepository == ct->repository_level)) { + currheaderlist->require[i]->resolved->provider[0]->altrepository == ct->repository_level)) { fprintf(fout,"%s ", ct->configdefaults->url_prefix, ct->tag, @@ -1586,10 +1586,10 @@ generateHTMLFiles(struct configTag *ct, int arch) snprintf(buffer, PATH_MAX, "%s(%s,%s) requires %s(%s,%s) which is in this repository", currheaderlist->name, ct->arch[arch], - ct->repository[currheaderlist->sourceheader->altrepository]->tag, + ct->repository[currheaderlist->altrepository]->tag, currheaderlist->require[i]->resolved->provider[0]->name, ct->arch[arch], - ct->repository[currheaderlist->require[i]->resolved->provider[0]->sourceheader->altrepository]->tag); + ct->repository[currheaderlist->require[i]->resolved->provider[0]->altrepository]->tag); addWarning(currheaderlist->sourceheader, buffer); } } else @@ -1606,7 +1606,7 @@ generateHTMLFiles(struct configTag *ct, int arch) for (j = 0; j < currheaderlist->require[i]->resolved->numproviders; j++) { if ((ct->repository_level == 0) || (currheaderlist->require[i]->resolved->provider[j]->sourceheader && - currheaderlist->require[i]->resolved->provider[j]->sourceheader->altrepository == ct->repository_level)) + currheaderlist->require[i]->resolved->provider[j]->altrepository == ct->repository_level)) fprintf(fout,"%s", ct->configdefaults->url_prefix, ct->tag, @@ -1635,7 +1635,7 @@ generateHTMLFiles(struct configTag *ct, int arch) (auxheaderlist->require[i]->resolved->numproviders == 1) && !strcmp(auxheaderlist->require[i]->resolved->provider[0]->name, currheaderlist->name)) { - if ((ct->repository_level == 0) || auxheaderlist->sourceheader->altrepository == ct->repository_level) { + if ((ct->repository_level == 0) || auxheaderlist->altrepository == ct->repository_level) { fprintf(fout, "%s(%s) ", ct->configdefaults->url_prefix, @@ -1744,7 +1744,7 @@ void print_contents_subtree(FILE *f, if ((ct->repository_level == 0) || ((ft->provider[k]) && (ft->provider[k]->sourceheader) && - (ft->provider[k]->sourceheader->altrepository == ct->repository_level))) { + (ft->provider[k]->altrepository == ct->repository_level))) { ftname(ft,buf,bufsize); if ((j=strlen(buf)) < 60) { for (i=(60-j)/8; i>0; i--) strncat(buf,"\t",1024); @@ -2104,7 +2104,7 @@ generatePkgList(struct configTag *ct, int arch) currheaderlist->name, currheaderlist->version, currheaderlist->size, currheaderlist->filenamecount, - ct->repository[currheaderlist->sourceheader->altrepository]->tag, + ct->repository[currheaderlist->altrepository]->tag, currheaderlist->epoch, currheaderlist->release); currheaderlist = currheaderlist->next;