Restructure popup information and provide Changelog information in recent packages HTML boxes

Cleanup old HTML files just before recreating new ones to avoid having them missing during distromatic execution
This commit is contained in:
Silvan Calarco 2012-04-15 12:08:10 +02:00
parent b292e47af6
commit 07548364d6
5 changed files with 40 additions and 23 deletions

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
libtoolize
aclocal aclocal
automake --add-missing automake --add-missing
autoreconf -f $@ autoconf
./configure --sysconfdir=/etc --prefix=/usr --localstatedir=/var ./configure $@

View File

@ -192,12 +192,21 @@ getPackageChangelog(Header h, struct headerSourceList* headersource)
return firstchangelog; return firstchangelog;
} }
char *changeLogTimeStr(char buf[16], struct changeLog *changelog)
{
struct tm *changelogtime;
changelogtime = localtime((time_t *) & changelog->time);
strftime((char *) buf, 16, "%a %h %d %Y", changelogtime);
return buf;
}
int int
printChangelogSince(FILE *fout, struct configTag *ct, printChangelogSince(FILE *fout, struct configTag *ct,
struct tm *sincetime, int html) struct tm *sincetime, int html)
{ {
struct changeLogFull *changelogfull; struct changeLogFull *changelogfull;
struct tm *changelogtime;
char strdate[16]; char strdate[16];
char buffer[PATH_MAX]; char buffer[PATH_MAX];
struct Packager *currpackager = firstpackager; struct Packager *currpackager = firstpackager;
@ -227,20 +236,20 @@ printChangelogSince(FILE *fout, struct configTag *ct,
while (changelogfull) { while (changelogfull) {
if ((changelogfull->changelog->time >= simpletime) && if ((changelogfull->changelog->time >= simpletime) &&
(changelogfull->source->altrepository == ct->repository_level)) { (changelogfull->source->altrepository == ct->repository_level)) {
changelogtime = localtime((time_t *) & changelogfull->changelog->time);
strftime((char *) &strdate, 16, "%a %h %d %Y", changelogtime);
if (!html) { if (!html) {
fprintf(fout,"\n[%s %s] ", fprintf(fout,"\n[%s %s] ",
changelogfull->source->name, changelogfull->source->name,
changelogfull->changelog->release); changelogfull->changelog->release);
fprintf(fout,"%s %s\n%s\n", (char *) &strdate, fprintf(fout,"%s %s\n%s\n",
changeLogTimeStr(strdate, changelogfull->changelog),
strcmp(changelogfull->changelog->pkg->name, "") ? strcmp(changelogfull->changelog->pkg->name, "") ?
changelogfull->changelog->pkg->name : "(noname)", changelogfull->changelog->pkg->name : "(noname)",
changelogfull->changelog->text); changelogfull->changelog->text);
} else { } else {
if (changelogfull->changelog->time != lasttime) { if (changelogfull->changelog->time != lasttime) {
if (lasttime) fprintf(fout,"<hr>"); if (lasttime) fprintf(fout,"<hr>");
fprintf(fout,"<p><h2>%s</h2>",(char *) &strdate); fprintf(fout,"<p><h2>%s</h2>",
changeLogTimeStr(strdate, changelogfull->changelog));
lasttime=changelogfull->changelog->time; lasttime=changelogfull->changelog->time;
} }
fprintf(fout,"<p><a href=\"%stag=%s&amp;pkg=%s.source\">%s</a> %s - ", fprintf(fout,"<p><a href=\"%stag=%s&amp;pkg=%s.source\">%s</a> %s - ",
@ -282,12 +291,11 @@ printChangelog(struct changeLog *changelog)
{ {
printf("Changelog:\n"); printf("Changelog:\n");
while (changelog) { while (changelog) {
struct tm *changelogtime;
char strdate[16]; char strdate[16];
changelogtime = localtime((time_t *) & changelog->time); changeLogTimeStr(strdate, changelog),
strftime((char *) &strdate, 16, "%a %h %d %Y", changelogtime); printf("%s - %s\n%s\n",
printf("%s - %s\n%s\n", (char *) &strdate, changeLogTimeStr(strdate, changelog),
changelog->pkg->name ? changelog->pkg->name : "(noname)", changelog->pkg->name ? changelog->pkg->name : "(noname)",
changelog->text); changelog->text);
changelog = changelog->next; changelog = changelog->next;

View File

@ -1171,12 +1171,6 @@ main(int argc, char *argv[])
if (genheader_mode) { if (genheader_mode) {
if (mode & MODE_HTML) {
logmsg(LOG_DEBUG,"cleanHTMLFiles - start");
cleanHTMLFiles(configtag);
logmsg(LOG_DEBUG,"cleanHTMLFiles - done");
}
for (i = 0; i < ARCHS_MAX && configtag->arch[i]; i++) { for (i = 0; i < ARCHS_MAX && configtag->arch[i]; i++) {
if (!quietmode) if (!quietmode)
@ -1337,6 +1331,10 @@ main(int argc, char *argv[])
if (mode & MODE_HTML) { if (mode & MODE_HTML) {
/* currheaderlist = headerlist; */ /* currheaderlist = headerlist; */
logmsg(LOG_DEBUG,"cleanHTMLFiles - start");
cleanHTMLFiles(configtag);
logmsg(LOG_DEBUG,"cleanHTMLFiles - done");
if (!quietmode) if (!quietmode)
fprintf(stdout, "Generating HTML reports...\n"); fprintf(stdout, "Generating HTML reports...\n");
generateHTMLMainIndex(firstconfigtag); generateHTMLMainIndex(firstconfigtag);

View File

@ -68,4 +68,6 @@ getPackagerByName(char *name, int create);
struct changeLog * struct changeLog *
getPackageChangelog(Header h, struct headerSourceList *headersourcelist); getPackageChangelog(Header h, struct headerSourceList *headersourcelist);
char *changeLogTimeStr(char buf[16], struct changeLog *changelog);
#endif /* FUNCTIONS_H */ #endif /* FUNCTIONS_H */

View File

@ -150,18 +150,27 @@ printHTMLWarnings(FILE *fout,struct configTag *configtag, struct headerSourceLis
void printpkgicon(FILE *fout, struct configTag *configtag, struct headerSourceList *s, int descr ) { void printpkgicon(FILE *fout, struct configTag *configtag, struct headerSourceList *s, int descr ) {
char buffer[PATH_MAX]; char buffer[PATH_MAX];
char strdate[16];
if (descr) { if (descr) {
simpleTimeToHuman(s->changelog->time, (humanDate *) & strdate);
if (s->updrepository >= 0) { if (s->updrepository >= 0) {
fprintf(fout, fprintf(fout,
"<img src=\"%s/pkgup.png\" title=\"%s\">", "<img src=\"%s/pkgup.png\" title=\"%s - %s (%s)\n%s\n\nUpdates package in %s\">",
configtag->configdefaults->url_dir, configtag->configdefaults->url_dir,
htmlclean(s->summary,buffer,PATH_MAX)); strdate,
s->changelog->pkg->name,
s->changelog->release,
htmlclean(s->changelog->text,buffer,PATH_MAX),
configtag->repository[s->updrepository]->tag);
} else { } else {
fprintf(fout, fprintf(fout,
"<img src=\"%s/pkg.png\" title=\"%s\">", "<img src=\"%s/pkg.png\" title=\"%s - %s (%s)\n%s\">",
configtag->configdefaults->url_dir, configtag->configdefaults->url_dir,
htmlclean(s->summary,buffer,PATH_MAX)); strdate,
s->changelog->pkg->name,
s->changelog->release,
htmlclean(s->changelog->text,buffer,PATH_MAX));
} }
} else { } else {
if (s->updrepository >= 0) { if (s->updrepository >= 0) {
@ -541,10 +550,11 @@ generateStats(struct configTag *configtag,int arch)
// HTML statistics // HTML statistics
printpkgicon(htmlout, configtag, (configtag->stats.headersourcelistvec)[i],1); printpkgicon(htmlout, configtag, (configtag->stats.headersourcelistvec)[i],1);
fprintf(htmlout, fprintf(htmlout,
"<a href=\"%stag=%s&amp;pkg=%s.source\">%s %s %s-%s</a>&nbsp;", "<a href=\"%stag=%s&amp;pkg=%s.source\" title=\"%s\">%s %s %s-%s</a>&nbsp;",
configtag->configdefaults->url_prefix, configtag->configdefaults->url_prefix,
configtag->tag, configtag->tag,
(configtag->stats.headersourcelistvec)[i]->name, (configtag->stats.headersourcelistvec)[i]->name,
htmlclean((configtag->stats.headersourcelistvec)[i]->summary,buffer,PATH_MAX),
strdate, strdate,
(configtag->stats.headersourcelistvec)[i]->name, (configtag->stats.headersourcelistvec)[i]->name,
(configtag->stats.headersourcelistvec)[i]->version, (configtag->stats.headersourcelistvec)[i]->version,