Skip to content
Myr

Drop the date from the committed man page (#3659)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

The date in the .TH line of jq.1.prebuilt changed whenever the manual was regenerated in a new month, causing merge conflicts between pull requests that touch the manual, and it did not reflect the release date anyway. Generate the committed man page without a date. Stamp the date into jq.1 at build time instead, taking it from the current commit, or from SOURCE_DATE_EPOCH where that is set, so that release tarballs and distribution builds still carry one and the behaviour added in #3514 is kept. Write it in UTC and in ISO 8601 rather than the previous "%B %Y", for which mandoc reports "cannot parse date, using it verbatim".

authored by itchyny · committed by GitHub · parent fd25c3e · Browse files · 4 files+15 added−14 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+15 added−14 removed

  • other:+15 added−14 removed

4 files+15 added−14 removed

modified:.github/workflows/manpage.yml+2 added-6 removed
modified:docs/build_manpage.py+1 added-6 removed
1#!/usr/bin/env python32from datetime import date2from io import StringIO3from lxml import etree4import markdown5from markdown.extensions import Extension6import re8import os7import sys10from time import time8import yaml91011# Prevent our markdown parser from trying to help by interpreting things in angle brackets as HTML tags.
52 unmodified lines
64 def _walk(self, root, parent_tag=None):65 last_tag = None66 while root is not None:67 if root.tag == 'h1':71 epoch = int(os.environ.get('SOURCE_DATE_EPOCH', time()))72 self.__write_cmd('.TH "JQ" "1" "{}" "" ""'.format(68 self.__write_cmd('.TH "JQ" "1" "" "" ""')73 date.fromtimestamp(epoch).strftime('%B %Y')))69 self.__write_cmd('.SH "NAME"')70 # TODO: properly parse this71 self.__write_raw(r'\fBjq\fR \- Command\-line JSON processor' +72 "\n")
177 unmodified lines
modified:jq.1.prebuilt+1 added-1 removed
1.2.TH "JQ" "1" "August 2026" "" ""2.TH "JQ" "1" "" "" ""3.4.SH "NAME"5\fBjq\fR \- Command\-line JSON processor6.
4324 unmodified lines
modified:Makefile.am+11 added-1 removed
188 unmodified lines
189 @echo Changes to the manual.yml require docs to be enabled to update the manpage.190 @echo As a result, the manpage is out of date.191endif192193# The committed manpage has no date to avoid merge conflicts. Stamp the date194# of the last commit when building in a git repository, including on make195# dist, so that release tarballs ship a dated jq.1. Respect SOURCE_DATE_EPOCH196# so that distribution builds can pin the date.197jq.1: jq.1.prebuilt194 $(AM_V_GEN) cp $(srcdir)/jq.1.prebuilt $@198 $(AM_V_GEN) date=`if test -n "$$SOURCE_DATE_EPOCH"; then \199 date -u -d "@$$SOURCE_DATE_EPOCH" +%F 2>/dev/null || \200 date -u -r "$$SOURCE_DATE_EPOCH" +%F 2>/dev/null; \201 elif test -e $(srcdir)/.git; then \202 cd $(srcdir) && git log -1 --format=%cd --date=short 2>/dev/null; \203 fi`; \204 sed 's/^\.TH "JQ" "1" ""/.TH "JQ" "1" "'"$$date"'"/' $(srcdir)/jq.1.prebuilt > $@205206CLEANFILES += jq.1207208### Build oniguruma
65 unmodified lines