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
libtoolize
aclocal
automake --add-missing
autoreconf -f $@
./configure --sysconfdir=/etc --prefix=/usr --localstatedir=/var
autoconf
./configure $@

View File

@ -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,"<hr>");
fprintf(fout,"<p><h2>%s</h2>",(char *) &strdate);
fprintf(fout,"<p><h2>%s</h2>",
changeLogTimeStr(strdate, changelogfull->changelog));
lasttime=changelogfull->changelog->time;
}
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");
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;

View File

@ -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);

View File

@ -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 */

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 ) {
char buffer[PATH_MAX];
char strdate[16];
if (descr) {
simpleTimeToHuman(s->changelog->time, (humanDate *) & strdate);
if (s->updrepository >= 0) {
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,
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,
"<img src=\"%s/pkg.png\" title=\"%s\">",
"<img src=\"%s/pkg.png\" title=\"%s - %s (%s)\n%s\">",
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,
"<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->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,