diff --git a/src/reports.c b/src/reports.c index f6fdfe9..e55975f 100644 --- a/src/reports.c +++ b/src/reports.c @@ -1665,348 +1665,341 @@ int print_contentslist(struct configTag *ct, int arch) { int print_datatables(struct configTag *ct, int arch) { - FILE *fbd,*fd,*fv,*fb,*fbsh,*fs,*fw; - char builddeps_filename[PATH_MAX], deps_filename[PATH_MAX], virtual_filename[PATH_MAX], - builds_filename[PATH_MAX], builds_sh_filename[PATH_MAX], sources_filename[PATH_MAX], - warnings_filename[PATH_MAX]; - char obsoletebuf[OBSOLETEBUF_SIZE]; - struct headerList *currheaderlist, *currchild; - struct headerSourceList *currheadersourcelist, *oldheadersourcelist; - struct rebuildList *currrebuild; - int i, nonobsoletednumproviders; + FILE *fbd,*fd,*fv,*fb,*fbsh,*fs,*fw; + char builddeps_filename[PATH_MAX], deps_filename[PATH_MAX], virtual_filename[PATH_MAX], + builds_filename[PATH_MAX], builds_sh_filename[PATH_MAX], sources_filename[PATH_MAX], + warnings_filename[PATH_MAX]; + char obsoletebuf[OBSOLETEBUF_SIZE]; + struct headerList *currheaderlist, *currchild; + struct headerSourceList *currheadersourcelist, *oldheadersourcelist; + struct rebuildList *currrebuild; + int i, nonobsoletednumproviders; - snprintf(builddeps_filename, PATH_MAX, "%sbuilddeps-%s", ct->html_dir, ct->arch[arch]); - snprintf(deps_filename, PATH_MAX, "%sdeps-%s", ct->html_dir, ct->arch[arch]); - snprintf(virtual_filename, PATH_MAX, "%svirtual-%s", ct->html_dir, ct->arch[arch]); - snprintf(builds_filename, PATH_MAX, "%sbuilds-%s", ct->html_dir, ct->arch[arch]); - snprintf(builds_sh_filename, PATH_MAX, "%sbuilds-%s.sh", ct->html_dir, ct->arch[arch]); - snprintf(sources_filename, PATH_MAX, "%ssources-%s", ct->html_dir, ct->arch[arch]); - snprintf(warnings_filename, PATH_MAX, "%swarnings-%s", ct->repository_dir, ct->arch[arch]); + snprintf(builddeps_filename, PATH_MAX, "%sbuilddeps-%s", ct->html_dir, ct->arch[arch]); + snprintf(deps_filename, PATH_MAX, "%sdeps-%s", ct->html_dir, ct->arch[arch]); + snprintf(virtual_filename, PATH_MAX, "%svirtual-%s", ct->html_dir, ct->arch[arch]); + snprintf(builds_filename, PATH_MAX, "%sbuilds-%s", ct->html_dir, ct->arch[arch]); + snprintf(builds_sh_filename, PATH_MAX, "%sbuilds-%s.sh", ct->html_dir, ct->arch[arch]); + snprintf(sources_filename, PATH_MAX, "%ssources-%s", ct->html_dir, ct->arch[arch]); + snprintf(warnings_filename, PATH_MAX, "%swarnings-%s", ct->repository_dir, ct->arch[arch]); - fbd=fopen(builddeps_filename,"w"); - if (!fbd) { - fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", builddeps_filename); - return 1; - } + fbd=fopen(builddeps_filename,"w"); + if (!fbd) { + fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", builddeps_filename); + return 1; + } - fd=fopen(deps_filename,"w"); - if (!fd) { - fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", deps_filename); - return 1; - } + fd=fopen(deps_filename,"w"); + if (!fd) { + fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", deps_filename); + return 1; + } - fv=fopen(virtual_filename,"w"); - if (!fv) { - fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", virtual_filename); - return 1; - } + fv=fopen(virtual_filename,"w"); + if (!fv) { + fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", virtual_filename); + return 1; + } - fb=fopen(builds_filename,"w"); - if (!fb) { - fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", builds_filename); - return 1; - } + fb=fopen(builds_filename,"w"); + if (!fb) { + fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", builds_filename); + return 1; + } - fbsh=fopen(builds_sh_filename,"w"); - if (!fbsh) { - fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", builds_filename); - return 1; - } + fbsh=fopen(builds_sh_filename,"w"); + if (!fbsh) { + fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", builds_filename); + return 1; + } - fs=fopen(sources_filename,"w"); - if (!fs) { - fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", sources_filename); - return 1; - } + fs=fopen(sources_filename,"w"); + if (!fs) { + fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", sources_filename); + return 1; + } - fw=fopen(warnings_filename,"w"); - if (!fw) { - fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", warnings_filename); - return 1; - } + fw=fopen(warnings_filename,"w"); + if (!fw) { + fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", warnings_filename); + return 1; + } - // - // headerlist scan: write top of deps and sources files - // - fprintf(fd,"ALL_PACKAGES = "); - fprintf(fb,"ALL_BUILDS="); - currheaderlist = ct->headerlist[arch]; - while (currheaderlist) { - fprintf(fs,"%s: _%s\n", currheaderlist->name, currheaderlist->sourceheader->name); - fprintf(fd,"%s ", currheaderlist->name); - fprintf(fb,"%s ",currheaderlist->name); - currheaderlist = currheaderlist->next; - } - fprintf(fd,"\n"); + // + // headerlist scan: write top of deps and sources files + // + fprintf(fd,"ALL_PACKAGES = "); + fprintf(fb,"ALL_BUILDS="); + currheaderlist = ct->headerlist[arch]; + while (currheaderlist) { + fprintf(fs,"%s: _%s\n", currheaderlist->name, currheaderlist->sourceheader->name); + fprintf(fd,"%s ", currheaderlist->name); + fprintf(fb,"%s ",currheaderlist->name); + currheaderlist = currheaderlist->next; + } + fprintf(fd,"\n"); - // - // source headerlist scan: write top of deps and sources files - // - fprintf(fbd,"ALL_SOURCES = "); - fprintf(fs,"ALL_SOURCES = "); - currheadersourcelist = ct->headersourcelist; - while (currheadersourcelist) { - if (currheadersourcelist->firstchild[arch]) { - fprintf(fbd,"%s ", currheadersourcelist->name); - fprintf(fs,"_%s ", currheadersourcelist->name); - } - currheadersourcelist = currheadersourcelist->next; - } - fprintf(fbd,"\n"); - fprintf(fs,"\n"); - fprintf(fb,"\n"); + // + // source headerlist scan: write top of deps and sources files + // + fprintf(fbd,"ALL_SOURCES = "); + fprintf(fs,"ALL_SOURCES = "); + currheadersourcelist = ct->headersourcelist; + while (currheadersourcelist) { + if (currheadersourcelist->firstchild[arch]) { + fprintf(fbd,"%s ", currheadersourcelist->name); + fprintf(fs,"_%s ", currheadersourcelist->name); + } + currheadersourcelist = currheadersourcelist->next; + } + fprintf(fbd,"\n"); + fprintf(fs,"\n"); + fprintf(fb,"\n"); - // write deps file - logmsg(LOG_DEBUG,"writing deps files (1)"); - struct providedList* provided = ct->providedlist_idx[arch][0]; - while (provided) { - if (!strncmp("debuginfo(build-id)", provided->name, 20)) { - provided = provided->next; - continue; - } - nonobsoletednumproviders=0; - for (i = 0; i < provided->numproviders; i++) { - // skip duplicated provides - if (i > 0) { - if (provided->provider[i] == provided->provider[i-1]) continue; - else if (!strcmp(provided->provider[i]->name,provided->provider[i-1]->name) && - !provided->provider[i-1]->obsoleted) continue; - } - if (!provided->provider[i]->obsoleted) nonobsoletednumproviders++; - } - if (nonobsoletednumproviders > 1) { - fprintf(fd,"ifndef "); - fprintf_depstable_filtered_var(fd,provided->name); - fprintf(fd,"\n"); - fprintf_depstable_filtered_var(fd,provided->name); - fprintf(fd," := "); - fprintf_depstable_filtered_var(fd,provided->name); - fprintf(fd,"_to_be_defined # "); - - fprintf_depstable_filtered_var(fs,provided->name); - fprintf(fs,":"); - for (i = 0; i < provided->numproviders; i++) { - if (!provided->provider[i]->obsoleted) { - if (i == 0 || strcmp(provided->provider[i-1]->name, - provided->provider[i]->name)) - fprintf(fd,"%s ",provided->provider[i]->name); - if (i == 0 || strcmp(provided->provider[i-1]->sourceheader->name, - provided->provider[i]->sourceheader->name)) - fprintf(fs," _%s",provided->provider[i]->sourceheader->name); - } - } - fprintf(fs,"\n"); - - fprintf(fd,"\nendif\n"); - fprintf_depstable_filtered_var(fd,provided->name); - fprintf(fd,": "); - fprintf(fd,"$("); - fprintf_depstable_filtered_var(fd,provided->name); - fprintf(fd,")\n"); - - fprintf(fv,"%s= # ",provided->name); - for (i = 0; i < provided->numproviders; i++) { - if (!provided->provider[i]->obsoleted) { - if (i == 0 || strcmp(provided->provider[i-1]->name, - provided->provider[i]->name)) - fprintf(fv,"%s ",provided->provider[i]->name); - } - } - fprintf(fv,"\n"); - } else if (nonobsoletednumproviders == 1) { - for (i = 0; i < provided->numproviders; i++) { - if (!provided->provider[i]->obsoleted) break; - } - if (strcmp(provided->name,provided->provider[i]->name)) { - fprintf_depstable_filtered_var(fd,provided->name); - fprintf(fd,": "); - fprintf(fd,"%s\n",provided->provider[i]->name); - fprintf_depstable_filtered_var(fs,provided->name); - fprintf(fs,": _%s\n",provided->provider[i]->sourceheader->name); - } - } else { - fprintf_depstable_filtered_var(fd,provided->name); - fprintf(fd,": "); - fprintf(fd,"__missing_provider_for_"); - fprintf_depstable_filtered_var(fd,provided->name); - fprintf(fd,"\n"); - } + // write deps file + logmsg(LOG_DEBUG,"writing deps files (1)"); + struct providedList* provided = ct->providedlist_idx[arch][0]; + while (provided) { + if (!strncmp("debuginfo(build-id)", provided->name, 20)) { provided = provided->next; - } + continue; + } + nonobsoletednumproviders=0; + for (i = 0; i < provided->numproviders; i++) { + // skip duplicated provides + if (i > 0) { + if (provided->provider[i] == provided->provider[i-1]) continue; + else if (!strcmp(provided->provider[i]->name,provided->provider[i-1]->name) && + !provided->provider[i-1]->obsoleted) continue; + } + if (!provided->provider[i]->obsoleted) nonobsoletednumproviders++; + } + if (nonobsoletednumproviders > 1) { + fprintf(fd,"ifndef "); + fprintf_depstable_filtered_var(fd,provided->name); + fprintf(fd,"\n"); + fprintf_depstable_filtered_var(fd,provided->name); + fprintf(fd," := "); + fprintf_depstable_filtered_var(fd,provided->name); + fprintf(fd,"_to_be_defined # "); + fprintf_depstable_filtered_var(fs,provided->name); + fprintf(fs,":"); + for (i = 0; i < provided->numproviders; i++) { + if (!provided->provider[i]->obsoleted) { + if (i == 0 || strcmp(provided->provider[i-1]->name, + provided->provider[i]->name)) + fprintf(fd,"%s ",provided->provider[i]->name); + if (i == 0 || strcmp(provided->provider[i-1]->sourceheader->name, + provided->provider[i]->sourceheader->name)) + fprintf(fs," _%s",provided->provider[i]->sourceheader->name); + } + } + fprintf(fs,"\n"); - logmsg(LOG_DEBUG,"writing deps files (2)"); - currheaderlist = ct->headerlist[arch]; - while (currheaderlist) { - fprintf(fd,"%s: ", currheaderlist->name); - for (i = 0; i < currheaderlist->requirecount; i++) { - if (currheaderlist->require[i]->resolved) { - if (currheaderlist->require[i]->resolved->numproviders == 0) { - fprintf_depstable_filtered_var(fd,currheaderlist->require[i]->resolved->name); - fprintf(fd,"_unresolved_ "); - } - else if (currheaderlist->require[i]->resolved->numproviders == 1) { - 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(fd,"%s ",currheaderlist->require[i]->resolved->provider[0]->name); - } else { - 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_depstable_filtered_var(fd,currheaderlist->require[i]->resolved->name); - fprintf(fd," "); - } - } - } - } - fprintf(fd,"\n"); + fprintf(fd,"\nendif\n"); + fprintf_depstable_filtered_var(fd,provided->name); + fprintf(fd,": "); + fprintf(fd,"$("); + fprintf_depstable_filtered_var(fd,provided->name); + fprintf(fd,")\n"); - // - // write builddeps file - // - fprintf(fbd,"%s:",currheaderlist->name); - for (i = 0; i < currheaderlist->sourceheader->requirecount; i++) { - if (strncmp("rpmlib(",currheaderlist->sourceheader->require[i]->name,7) && + fprintf(fv,"%s= # ",provided->name); + for (i = 0; i < provided->numproviders; i++) { + if (!provided->provider[i]->obsoleted) { + if (i == 0 || strcmp(provided->provider[i-1]->name, + provided->provider[i]->name)) + fprintf(fv,"%s ",provided->provider[i]->name); + } + } + fprintf(fv,"\n"); + } else if (nonobsoletednumproviders == 1) { + for (i = 0; i < provided->numproviders; i++) { + if (!provided->provider[i]->obsoleted) break; + } + if (strcmp(provided->name,provided->provider[i]->name)) { + fprintf_depstable_filtered_var(fd,provided->name); + fprintf(fd,": "); + fprintf(fd,"%s\n",provided->provider[i]->name); + fprintf_depstable_filtered_var(fs,provided->name); + fprintf(fs,": _%s\n",provided->provider[i]->sourceheader->name); + } + } else { + fprintf_depstable_filtered_var(fd,provided->name); + fprintf(fd,": "); + fprintf(fd,"__missing_provider_for_"); + fprintf_depstable_filtered_var(fd,provided->name); + fprintf(fd,"\n"); + } + provided = provided->next; + } + + logmsg(LOG_DEBUG,"writing deps files (2)"); + currheaderlist = ct->headerlist[arch]; + while (currheaderlist) { + fprintf(fd,"%s: ", currheaderlist->name); + for (i = 0; i < currheaderlist->requirecount; i++) { + if (currheaderlist->require[i]->resolved) { + if (currheaderlist->require[i]->resolved->numproviders == 0) { + fprintf_depstable_filtered_var(fd,currheaderlist->require[i]->resolved->name); + fprintf(fd,"_unresolved_ "); + } else if (currheaderlist->require[i]->resolved->numproviders == 1) { + 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(fd,"%s ",currheaderlist->require[i]->resolved->provider[0]->name); + } else { + 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_depstable_filtered_var(fd,currheaderlist->require[i]->resolved->name); + fprintf(fd," "); + } + } + } + } + fprintf(fd,"\n"); + + // + // write builddeps file + // + fprintf(fbd,"%s:",currheaderlist->name); + for (i = 0; i < currheaderlist->sourceheader->requirecount; i++) { + if (strncmp("rpmlib(",currheaderlist->sourceheader->require[i]->name,7) && strncmp("debuginfo(build-id)",currheaderlist->sourceheader->require[i]->name,20)) { - fprintf(fbd," "); - fprintf_depstable_filtered_var(fbd,currheaderlist->sourceheader->require[i]->name); - } - } + fprintf(fbd," "); + fprintf_depstable_filtered_var(fbd,currheaderlist->sourceheader->require[i]->name); + } + } - fprintf(fbd,"\n"); + fprintf(fbd,"\n"); - /*for (i = 0; i < currheaderlist->obsoletecount; i++) { - fprintf(fbd,"%s: %s\n",currheaderlist->obsoletename[i],currheaderlist->name); - }*/ + /*for (i = 0; i < currheaderlist->obsoletecount; i++) { + fprintf(fbd,"%s: %s\n",currheaderlist->obsoletename[i],currheaderlist->name); + }*/ - for (i = 0; i < currheaderlist->providecount; i++) { - if (strncmp(currheaderlist->provided[i]->name,currheaderlist->name,PATH_MAX) != 0) { - fprintf_depstable_filtered_var(fbd,currheaderlist->provided[i]->name); - fprintf(fbd,": %s\n",currheaderlist->name); - } - } + for (i = 0; i < currheaderlist->providecount; i++) { + if (strncmp(currheaderlist->provided[i]->name,currheaderlist->name,PATH_MAX) != 0) { + fprintf_depstable_filtered_var(fbd,currheaderlist->provided[i]->name); + fprintf(fbd,": %s\n",currheaderlist->name); + } + } - currheaderlist = currheaderlist->next; - } + currheaderlist = currheaderlist->next; + } - // - // headersourcelist scan: write builds and sources files - // - logmsg(LOG_DEBUG,"writing builds and sources files (1)"); - fprintf(fbsh,"pkg_list=("); - currheadersourcelist = ct->headersourcelist; - while (currheadersourcelist != NULL) { - if (((ct->repository_level == 0) || - (currheadersourcelist->altrepository == ct->repository_level)) && - (currheadersourcelist->firstchild[arch])) { - fprintf(fbsh,"%s ",currheadersourcelist->name); - } - currheadersourcelist = currheadersourcelist->next; - } - fprintf(fbsh,");\n"); + // + // headersourcelist scan: write builds and sources files + // + logmsg(LOG_DEBUG,"writing builds and sources files (1)"); + fprintf(fbsh,"pkg_list=("); + currheadersourcelist = ct->headersourcelist; + while (currheadersourcelist != NULL) { + if (((ct->repository_level == 0) || + (currheadersourcelist->altrepository == ct->repository_level)) && + (currheadersourcelist->firstchild[arch])) { + fprintf(fbsh,"%s ",currheadersourcelist->name); + } + currheadersourcelist = currheadersourcelist->next; + } + fprintf(fbsh,");\n"); - fprintf(fbsh,"needport_list=("); - currheadersourcelist = ct->headersourcelist; - while (currheadersourcelist != NULL) { - if (!currheadersourcelist->firstchild[arch] && + fprintf(fbsh,"needport_list=("); + currheadersourcelist = ct->headersourcelist; + while (currheadersourcelist != NULL) { + if (!currheadersourcelist->firstchild[arch] && currheadersourcelist->old && currheadersourcelist->old->firstchild[arch] && (currheadersourcelist->altrepository == ct->repository_level)) { - fprintf(fbsh,"%s ",currheadersourcelist->name); - } - currheadersourcelist = currheadersourcelist->next; - } - fprintf(fbsh,");\n"); + fprintf(fbsh,"%s ",currheadersourcelist->name); + } + currheadersourcelist = currheadersourcelist->next; + } + fprintf(fbsh,");\n"); - fprintf(fbsh,"warnings_list=("); - currheadersourcelist = ct->headersourcelist; - while (currheadersourcelist != NULL) { - if ((currheadersourcelist->altrepository == ct->repository_level) && + fprintf(fbsh,"warnings_list=("); + currheadersourcelist = ct->headersourcelist; + while (currheadersourcelist != NULL) { + if ((currheadersourcelist->altrepository == ct->repository_level) && (printHTMLWarnings(fw,ct,currheadersourcelist,2) == 1)) { - fprintf(fbsh,"%s ",currheadersourcelist->name); - } - currheadersourcelist = currheadersourcelist->next; - } - fprintf(fbsh,");\n"); + fprintf(fbsh,"%s ",currheadersourcelist->name); + } + currheadersourcelist = currheadersourcelist->next; + } + fprintf(fbsh,");\n"); - currheadersourcelist = ct->headersourcelist; - logmsg(LOG_DEBUG,"writing builds and sources files (2)"); - while (currheadersourcelist != NULL) { + currheadersourcelist = ct->headersourcelist; + logmsg(LOG_DEBUG,"writing builds and sources files (2)"); + while (currheadersourcelist != NULL) { + currchild = currheadersourcelist->firstchild[arch]; + if (currchild) { + fprintf(fbsh,"[ \"$pkg\" = \"%s\" ] && { pkg_header=(%s %s %s %s \"%s\" \"%s\" %ld %ld %d %s); ", + currheadersourcelist->name, + currheadersourcelist->name, + currchild->arch, + currheadersourcelist->version, + currheadersourcelist->release, + currheadersourcelist->group, + currheadersourcelist->license, + currheadersourcelist->size, + currheadersourcelist->buildtime, + currheadersourcelist->altrepository, + ct->repository[currheadersourcelist->altrepository]->tag); + fprintf(fb,"%s:", + currheadersourcelist->name); + fprintf(fbsh,"pkg_builds=("); - currchild = currheadersourcelist->firstchild[arch]; + obsoletebuf[0] = '\0'; - if (currchild) { + while (currchild) { + fprintf(fbsh,"%s",currchild->name); + fprintf(fb," %s",currchild->name); + for (i = 0; i < currchild->obsoletecount; i++ ) { + if ((i > 0) && (!strcmp(currchild->obsoletename[i],currchild->obsoletename[i-1]))) continue; + if (strlen(obsoletebuf) + strlen(currchild->obsoletename[i]) >= OBSOLETEBUF_SIZE - 2) { + logmsg(LOG_WARNING, "%s: reached obsoletebuf maximum size (%d); skipping further obsoletes in output file", + currheadersourcelist->name, OBSOLETEBUF_SIZE); + break; + } + if (obsoletebuf[0] != '\0') strncat(obsoletebuf, " ", sizeof(obsoletebuf) - strlen(obsoletebuf)); + strncat(obsoletebuf, currchild->obsoletename[i], sizeof(obsoletebuf) - strlen(obsoletebuf)); + } + currchild = currchild->nextbrother; + if (currchild) fprintf(fbsh," "); + } + fprintf(fbsh,"); pkg_obsoletes=(%s);",obsoletebuf); - fprintf(fbsh,"[ \"$pkg\" = \"%s\" ] && { pkg_header=(%s %s %s %s \"%s\" \"%s\" %ld %ld %d %s); ", - currheadersourcelist->name, - currheadersourcelist->name, - currchild->arch, - currheadersourcelist->version, - currheadersourcelist->release, - currheadersourcelist->group, - currheadersourcelist->license, - currheadersourcelist->size, - currheadersourcelist->buildtime, - currheadersourcelist->altrepository, - ct->repository[currheadersourcelist->altrepository]->tag); - fprintf(fb,"%s:", - currheadersourcelist->name); + /* find pointer to firstrebuild also looking into old packages */ + currrebuild = currheadersourcelist->firstrebuild; + oldheadersourcelist = currheadersourcelist->old; + while (!currrebuild && oldheadersourcelist) { + currrebuild = oldheadersourcelist->firstrebuild; + oldheadersourcelist = oldheadersourcelist->old; + } + fprintf(fbsh," pkg_needrebuild=("); + while (currrebuild) { + fprintf(fbsh, "%s@%s ", currrebuild->sourceheader->name, currrebuild->provider->name); + currrebuild = currrebuild->next; + } + fprintf(fbsh,"); }\n"); + fprintf(fb,"\n"); + } + currheadersourcelist = currheadersourcelist->next; + } - fprintf(fbsh,"pkg_builds=("); + fclose(fd); + fclose(fv); + fclose(fbsh); + fclose(fb); + fclose(fs); + fclose(fw); - obsoletebuf[0] = '\0'; - - while (currchild) { - fprintf(fbsh,"%s",currchild->name); - fprintf(fb," %s",currchild->name); - for (i = 0; i < currchild->obsoletecount; i++ ) { - if ((i > 0) && (!strcmp(currchild->obsoletename[i],currchild->obsoletename[i-1]))) continue; - if (strlen(obsoletebuf) + strlen(currchild->obsoletename[i]) >= OBSOLETEBUF_SIZE - 2) { - logmsg(LOG_WARNING, "%s: reached obsoletebuf maximum size (%d); skipping further obsoletes in output file", - currheadersourcelist->name, OBSOLETEBUF_SIZE); - break; - } - if (obsoletebuf[0] != '\0') strncat(obsoletebuf, " ", sizeof(obsoletebuf) - strlen(obsoletebuf)); - strncat(obsoletebuf, currchild->obsoletename[i], sizeof(obsoletebuf) - strlen(obsoletebuf)); - } - currchild = currchild->nextbrother; - if (currchild) fprintf(fbsh," "); - } - fprintf(fbsh,"); pkg_obsoletes=(%s);",obsoletebuf); - - /* find pointer to firstrebuild also looking into old packages */ - currrebuild = currheadersourcelist->firstrebuild; - oldheadersourcelist = currheadersourcelist->old; - while (!currrebuild && oldheadersourcelist) { - currrebuild = oldheadersourcelist->firstrebuild; - oldheadersourcelist = oldheadersourcelist->old; - } - fprintf(fbsh," pkg_needrebuild=("); - while (currrebuild) { - fprintf(fbsh, "%s@%s ", currrebuild->sourceheader->name, currrebuild->provider->name); - currrebuild = currrebuild->next; - } - fprintf(fbsh,"); }\n"); - fprintf(fb,"\n"); - - } - currheadersourcelist = currheadersourcelist->next; - } - - fclose(fd); - fclose(fv); - fclose(fbsh); - fclose(fb); - fclose(fs); - fclose(fw); - - return 0; + return 0; } int