diff -uNr rpm2html-1.5.orig/html.c rpm2html-1.5/html.c --- rpm2html-1.5.orig/html.c Tue Nov 7 15:53:33 2000 +++ rpm2html-1.5/html.c Tue Nov 7 15:53:45 2000 @@ -1124,6 +1124,53 @@ } /* + * compose HTML output filename + * + * side effect: it creates output directories + * + * uses rpm->dir->htmldir to store HTML directory name. first call of + * composeHtmlFN upon fresh rpm structure (htmldir is NULL) fills this + * item and calls createDirectory() for this directory so when we call + * composeHtmlFN() more than once (for example when WITH_GPG is defined) + * we do not create directory name and call createDirectory() repeatedly + */ + +char *composeHtmlFN(rpmDataPtr rpm, rpmSubdirPtr tree) { + rpmDirPtr dir = rpm->dir; + + if (rpm->extra->htmldir == NULL) { + /* + * create the directory on the fly if needed. + */ + if ((dir->subdir != NULL) && (dir->subdir[0] != '\0')) { + if ((rpm->subdir != NULL) && (rpm->subdir[0] != '\0')) + snprintf(buf, sizeof(buf), "%s/%s/%s", dir->dir, dir->subdir, + rpm->subdir); + else + snprintf(buf, sizeof(buf), "%s/%s", dir->dir, dir->subdir); + } else { + if ((rpm->subdir != NULL) && (rpm->subdir[0] != '\0')) + snprintf(buf, sizeof(buf), "%s/%s", dir->dir, rpm->subdir); + else + snprintf(buf, sizeof(buf), "%s", dir->dir); + } + + rpm->extra->htmldir = debugMalloc(sizeof(char) * (strlen(buf) + 1)); + strcpy(rpm->extra->htmldir, buf); + + createDirectory(buf); + } + else + strcpy(buf, rpm->extra->htmldir); + + strcat(buf, "/"); + strcat(buf, rpmName(rpm)); + strcat(buf, ".html"); + + return(buf); +} + +/* * Dump an RPM block as an HTML file. */ @@ -1132,43 +1179,26 @@ rpmDirPtr dir = rpm->dir; int installed = dir->installbase; FILE *html; + char *htmlfn; int i; if (!rpm2html_dump_html) return; - /* - * create the directory on the fly if needed. - */ - if ((dir->subdir != NULL) && (dir->subdir[0] != '\0')) { - if ((rpm->subdir != NULL) && (rpm->subdir[0] != '\0')) - snprintf(buf, sizeof(buf), "%s/%s/%s", dir->dir, dir->subdir, - rpm->subdir); - else - snprintf(buf, sizeof(buf), "%s/%s", dir->dir, dir->subdir); - } else { - if ((rpm->subdir != NULL) && (rpm->subdir[0] != '\0')) - snprintf(buf, sizeof(buf), "%s/%s", dir->dir, rpm->subdir); - else - snprintf(buf, sizeof(buf), "%s", dir->dir); - } - - createDirectory(buf); - strcat(buf, "/"); - strcat(buf, rpmName(rpm)); - strcat(buf, ".html"); + htmlfn = composeHtmlFN(rpm, tree); /* * !!!!!!!! - * if (checkDate(buf, rpm->extra->stamp)) return; */ + if (checkDate(htmlfn, rpm->extra->stamp)) return; + if (rpm2htmlVerbose > 1) { - printf("Dumping %s\n", buf); + printf("Dumping %s\n", htmlfn); } - html = fopen(buf, "w"); + html = fopen(htmlfn, "w"); if (html == NULL) { fprintf(stderr, "Couldn't save to file %s: %s\n", - buf, strerror(errno)); + htmlfn, strerror(errno)); return; } snprintf(buf, sizeof(buf), "%s RPM", rpmName(rpm)); diff -uNr rpm2html-1.5.orig/html.h rpm2html-1.5/html.h --- rpm2html-1.5.orig/html.h Sun Nov 15 06:10:11 1998 +++ rpm2html-1.5/html.h Tue Nov 7 15:53:45 2000 @@ -12,6 +12,7 @@ extern void dumpDirIcon(void); extern void createDirectory(const char *dirname); extern void dumpAllRessHtml(int installed); +char *composeHtmlFN(rpmDataPtr rpm, rpmSubdirPtr tree); extern void dumpRpmHtml(rpmDataPtr rpm, rpmSubdirPtr tree); extern void dumpRpmByGroups(rpmDataPtr list, int installed); extern void dumpRpmByDistribs(rpmDataPtr list, int installed); diff -uNr rpm2html-1.5.orig/rpmdata.h rpm2html-1.5/rpmdata.h --- rpm2html-1.5.orig/rpmdata.h Tue Nov 7 15:53:33 2000 +++ rpm2html-1.5/rpmdata.h Tue Nov 7 15:53:45 2000 @@ -151,6 +151,7 @@ int nb_sigs; /* #of signatures required */ int max_sigs; /* #of signatures slot allocated */ struct rpm_sig **sigs; /* list of them */ + char *htmldir; /* target HTML file directory name; used in composeHtmlFN() */ } rpmExtraData, *rpmExtraDataPtr; /* diff -uNr rpm2html-1.5.orig/rpmopen.c rpm2html-1.5/rpmopen.c --- rpm2html-1.5.orig/rpmopen.c Tue Nov 7 15:53:33 2000 +++ rpm2html-1.5/rpmopen.c Tue Nov 7 15:53:45 2000 @@ -91,6 +91,7 @@ } debugFree(extra->sigs); } + if (extra->htmldir != NULL) debugFree(extra->htmldir); debugFree(extra); } @@ -267,6 +268,9 @@ if (rpm == NULL || rpm->extra->nb_sigs == 0 || sigtarget == NULL) return; + if (rpm2htmlVerbose > 1) + printf("Resolving %d signature(s) in %s\n", rpm->extra->nb_sigs, nameRpm); + for (sign = 0; sign < rpm->extra->nb_sigs; sign++) { FD_t sfd; char *sigfile = NULL; @@ -802,7 +806,8 @@ ENTRY_CLEANUP(p); #ifdef WITH_GPG - rpmResolveSignatures(path, nameRpm, sigtarget, rpm); + if (!checkDate(composeHtmlFN(rpm, tree), rpm->extra->stamp)) + rpmResolveSignatures(path, nameRpm, sigtarget, rpm); #endif WITH_GPG #ifdef WITH_SQL