From 07548364d62eeb381c7802374e6aad1c34d3a5ab Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sun, 15 Apr 2012 12:08:10 +0200 Subject: [PATCH] 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 --- autogen.sh | 5 ++--- src/changelog.c | 26 +++++++++++++++++--------- src/distromatic.c | 10 ++++------ src/include/changelog.h | 2 ++ src/reports.c | 20 +++++++++++++++----- 5 files changed, 40 insertions(+), 23 deletions(-) diff --git a/autogen.sh b/autogen.sh index 444da9c..5280f70 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,6 +1,5 @@ #!/bin/sh -libtoolize aclocal automake --add-missing -autoreconf -f $@ -./configure --sysconfdir=/etc --prefix=/usr --localstatedir=/var +autoconf +./configure $@ diff --git a/src/changelog.c b/src/changelog.c index 1c14678..6f22838 100644 --- a/src/changelog.c +++ b/src/changelog.c @@ -192,12 +192,21 @@ getPackageChangelog(Header h, struct headerSourceList* headersource) 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 printChangelogSince(FILE *fout, struct configTag *ct, struct tm *sincetime, int html) { struct changeLogFull *changelogfull; - struct tm *changelogtime; char strdate[16]; char buffer[PATH_MAX]; struct Packager *currpackager = firstpackager; @@ -227,20 +236,20 @@ printChangelogSince(FILE *fout, struct configTag *ct, while (changelogfull) { if ((changelogfull->changelog->time >= simpletime) && (changelogfull->source->altrepository == ct->repository_level)) { - changelogtime = localtime((time_t *) & changelogfull->changelog->time); - strftime((char *) &strdate, 16, "%a %h %d %Y", changelogtime); if (!html) { fprintf(fout,"\n[%s %s] ", changelogfull->source->name, 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, "") ? changelogfull->changelog->pkg->name : "(noname)", changelogfull->changelog->text); } else { if (changelogfull->changelog->time != lasttime) { if (lasttime) fprintf(fout,"
"); - fprintf(fout,"

%s

",(char *) &strdate); + fprintf(fout,"

%s

", + changeLogTimeStr(strdate, changelogfull->changelog)); lasttime=changelogfull->changelog->time; } fprintf(fout,"

%s %s - ", @@ -282,12 +291,11 @@ printChangelog(struct changeLog *changelog) { printf("Changelog:\n"); while (changelog) { - struct tm *changelogtime; char strdate[16]; - changelogtime = localtime((time_t *) & changelog->time); - strftime((char *) &strdate, 16, "%a %h %d %Y", changelogtime); - printf("%s - %s\n%s\n", (char *) &strdate, + changeLogTimeStr(strdate, changelog), + printf("%s - %s\n%s\n", + changeLogTimeStr(strdate, changelog), changelog->pkg->name ? changelog->pkg->name : "(noname)", changelog->text); changelog = changelog->next; diff --git a/src/distromatic.c b/src/distromatic.c index 3153bab..27e807d 100644 --- a/src/distromatic.c +++ b/src/distromatic.c @@ -1171,12 +1171,6 @@ main(int argc, char *argv[]) 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++) { if (!quietmode) @@ -1337,6 +1331,10 @@ main(int argc, char *argv[]) if (mode & MODE_HTML) { /* currheaderlist = headerlist; */ + logmsg(LOG_DEBUG,"cleanHTMLFiles - start"); + cleanHTMLFiles(configtag); + logmsg(LOG_DEBUG,"cleanHTMLFiles - done"); + if (!quietmode) fprintf(stdout, "Generating HTML reports...\n"); generateHTMLMainIndex(firstconfigtag); diff --git a/src/include/changelog.h b/src/include/changelog.h index b60c23a..bddc6e9 100644 --- a/src/include/changelog.h +++ b/src/include/changelog.h @@ -68,4 +68,6 @@ getPackagerByName(char *name, int create); struct changeLog * getPackageChangelog(Header h, struct headerSourceList *headersourcelist); +char *changeLogTimeStr(char buf[16], struct changeLog *changelog); + #endif /* FUNCTIONS_H */ diff --git a/src/reports.c b/src/reports.c index 7c07383..3c9c4a8 100644 --- a/src/reports.c +++ b/src/reports.c @@ -150,18 +150,27 @@ printHTMLWarnings(FILE *fout,struct configTag *configtag, struct headerSourceLis void printpkgicon(FILE *fout, struct configTag *configtag, struct headerSourceList *s, int descr ) { char buffer[PATH_MAX]; + char strdate[16]; if (descr) { + simpleTimeToHuman(s->changelog->time, (humanDate *) & strdate); if (s->updrepository >= 0) { fprintf(fout, - "", + "", 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 { fprintf(fout, - "", + "", 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 { if (s->updrepository >= 0) { @@ -541,10 +550,11 @@ generateStats(struct configTag *configtag,int arch) // HTML statistics printpkgicon(htmlout, configtag, (configtag->stats.headersourcelistvec)[i],1); fprintf(htmlout, - "%s %s %s-%s ", + "%s %s %s-%s ", configtag->configdefaults->url_prefix, configtag->tag, (configtag->stats.headersourcelistvec)[i]->name, + htmlclean((configtag->stats.headersourcelistvec)[i]->summary,buffer,PATH_MAX), strdate, (configtag->stats.headersourcelistvec)[i]->name, (configtag->stats.headersourcelistvec)[i]->version,