Check-in by ben on 2025-11-13 19:50:24 Add --verbose flag to give status messages while generating static content. Unconditionally generate home, tickets, and wiki sections. Skip timelines if latest commit already present in the output directory. INSERTED DELETED 38 4 coprolit.awk 38 4 TOTAL over 1 changed file Index: coprolit.awk ================================================================== --- coprolit.awk +++ coprolit.awk @@ -265,10 +265,13 @@ system(cmd) return } function generate_home( cmd, fsout, out) { + if (_verbose) { + print "Generating home (" _conf["project-name"] ") ..." + } out = _work "/gophermap" unlink(out) fsout = gettemp() cmd = sprintf("fossil wiki export -h \"%s\" -R %s >%s 2>&1", _conf["project-name"], _repo, fsout) @@ -284,10 +287,13 @@ close(out) return } function generate_tarball(commit, cmd, file, name, retval) { + if (_verbose) { + print "Generating tarball (" commit ") ..." + } mkdir(_work "/tarball/" commit) name = _conf["short-project-name"] file = sprintf("%s/tarball/%s/%s-%s.tar.gz", _work, commit, name, commit) @@ -351,10 +357,14 @@ function generate_tag_timeline(tag, author, authors, cmd, comment_abbrev, commit, commits, date, dates, fsout, i, label, line, lines, m, out, refs, sel, time, total_commits) { + if (_verbose) { + print "Generating timeline for tag (" tag ") ..." + } + out = sprintf("%s/tags/%s/gophermap", _work, tag) _download_count = 0 _download_max = _download @@ -451,10 +461,14 @@ } function generate_ticket(ticket, ctime, foundin, mtime, priority, resolution, severity, status, title, uuid, type, cmd, out) { + if (_verbose) { + print "Generating ticket (" ticket ") ..." + } + out = sprintf("%s/tickets/%s.txt", _work, ticket) unlink(out) printf "# %s\n\n", _conf["project-name"] >out printf "## View Ticket\n\n" >>out printf "Ticket Hash: %s\n", uuid >>out @@ -572,10 +586,14 @@ function generate_timeline(branch, author, branch_opt, cmd, comment, comment_abbrev, commit, commits, date, download_count, download_max, fsout, i, label, m, out, refs, sel, total_commits) { + if (_verbose) { + print "Generating timeline (" branch ") ..." + } + _download_count = 0 if (length(branch) > 0) { _download_max = -1 branch_opt = "-b " branch " " out = sprintf("%s/timeline/%s/gophermap", _work, branch) @@ -699,10 +717,14 @@ return } function generate_wiki_page(page, cmd, fsout, out) { + if (_verbose) { + print "Generating wiki page (" page ") ..." + } + out = sprintf("%s/wiki/%s.txt", _work, safe_filename(page)) unlink(out) fsout = gettemp() cmd = sprintf("fossil wiki export -h \"%s\" -R %s >%s 2>&1", page, _repo, fsout) @@ -719,10 +741,14 @@ unlink(fsout) return } function generate_zip(commit, cmd, file, name, retval) { + if (_verbose) { + print "Generating zip (" commit ") ..." + } + mkdir(_work "/zip/" commit) name = _conf["short-project-name"] file = sprintf("%s/zip/%s/%s-%s.zip", _work, commit, name, commit) cmd = sprintf("fossil zip %s %s --name %s -R %s", @@ -784,10 +810,11 @@ _download = 5 _port = 70 _server = "localhost" _timeline = 100 + _verbose = 0 _work = "output" format = "gopher" for (i = 3; i < ARGC; i++) { if (ARGV[i] == "--dir") { @@ -810,10 +837,12 @@ _server = ARGV[i + 1] i++ } else if (ARGV[i] == "--timeline") { _timeline = ARGV[i + 1] i++ + } else if (ARGV[i] == "--verbose" || ARGV[i] == "-v") { + _verbose = 1 } else { print "Error: Unrecognized option: " ARGV[i] exit 1 } } @@ -822,11 +851,10 @@ } else { _timeline_opt = "" } _download_count = 0 - quit_if_uptodate(_work) fossil_configuration(_conf) if (length(_conf["project-name"]) == 0) { print "Error: Could not find fossil project name" exit 1 } @@ -836,16 +864,19 @@ } _remote = fossil_remote() mkdir(_work) generate_home() + generate_tickets() + generate_wiki() + + quit_if_uptodate(_work) + generate_timeline("") generate_files() generate_branches() generate_tags() - generate_tickets() - generate_wiki() if (format == "geomyidae") { cmd = sprintf("./geomyidae.sh \"%s\"", _work) system(cmd) } @@ -895,11 +926,13 @@ function quit_if_uptodate(workdir, cmd, path) { cmd = "fossil timeline -n 1 --oneline -R " _repo if ((cmd | getline) > 0) { path = workdir "/info/" $1 if (exists(path "/gophermap") || exists(path "/index.gph")) { - printf "Directory %s up-to-date, quitting early...\n", _work + if (_verbose) { + print "Directory (" _work ") up-to-date, quitting early..." + } exit 0 } } close(cmd) return @@ -946,10 +979,11 @@ print "--format (geomyidae | gopher)" print "--port portnum" print "--server hostname" print "--timeline (default: 100)" print " limit number of items in timeline, 0 = unlimited" + print "--verbose (or -v)" print "" return } # wrap() will break long lines into line continuations