Allow generating only html stats with --generatehtmlstats

Calling --generatehtml implies adding --generatehtmlstats
This commit is contained in:
Silvan Calarco 2016-02-24 14:51:06 +01:00
parent 00a88dd5e6
commit ce32dea9ed
2 changed files with 12 additions and 3 deletions

View File

@ -93,6 +93,7 @@
#define MODE_SQLITE3 128
#define MODE_SQLITE3_FILES 256
#define MODE_GENCONTENTSLIST 512
#define MODE_HTMLSTATS 1024
static void program_usage(int exit_code);
static void program_version(void);
@ -143,7 +144,8 @@ static const char *helpmsg[] = {
"Commands:",
" --gendatatables write dependencies, buildinfo and apt db files",
" --genbuildinfo generate build info files for all SRPMS packages",
" --genhtml generate HTML code for repository",
" --genhtml generate HTML code for repository (implies --genhtmlstats)",
" --genhtmlstats generate HTML summary pages for repository",
" --genpkglist generate binary packages list with version and size",
" --gensrcpkglist generate a source packages list with version",
" --gensqlite3 dump data to SQLite3 databases",
@ -960,6 +962,7 @@ main(int argc, char *argv[])
{ "changelogsince", required_argument, 0, 0 },
{ "genbuildinfo", no_argument, 0, 0 },
{ "genhtml", no_argument, 0, 0 },
{ "genhtmlstats", no_argument, 0, 0 },
{ "genpkglist", no_argument, 0, 0 },
{ "gensrcpkglist", no_argument, 0, 0 },
{ "gensqlite3", no_argument, 0, 0 },
@ -1011,7 +1014,12 @@ main(int argc, char *argv[])
date = optarg;
name = NULL;
} else if (!strcmp(longopts[longindex].name, "genhtml")) {
mode |= MODE_HTML;
mode |= MODE_HTML | MODE_HTMLSTATS;
genheader_mode |= GENHEADER_CHANGELOG | GENHEADER_STATS;
recursive_mode = 1;
name = NULL;
} else if (!strcmp(longopts[longindex].name, "genhtmlstats")) {
mode |= MODE_HTMLSTATS;
genheader_mode |= GENHEADER_CHANGELOG | GENHEADER_STATS;
recursive_mode = 1;
name = NULL;
@ -1339,7 +1347,7 @@ main(int argc, char *argv[])
}
// NOTE: generateStats must be called after generateHTML_SRPMSFiles for warnings to appear
if (mode & MODE_HTML) {
if (mode & MODE_HTMLSTATS) {
logmsg(LOG_DEBUG,"generateStats - start");
generateStats(configtag,i);
logmsg(LOG_DEBUG,"generateStats - done");

View File

@ -857,6 +857,7 @@ generateHTML_SRPMSFiles(struct configTag *configtag)
struct stat buf;
sizeString strsize;
// create packages directory
snprintf(buffer,PATH_MAX,"%spackages",configtag->html_dir);
if (stat(buffer,&buf)) {
if (mkdir(buffer,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {