* [PATCH v2 0/2] perf doc improvements to man page reproducibility
@ 2023-05-13 20:35 Ben Hutchings
2023-05-13 20:37 ` [PATCH v2 1/2] perf doc: Define man page date when using asciidoctor Ben Hutchings
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ben Hutchings @ 2023-05-13 20:35 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo
Cc: linux-perf-users, linux-kernel, Salvatore Bonaccorso
[-- Attachment #1: Type: text/plain, Size: 834 bytes --]
I previously sent a patch in 2016(!) to make the dates in man pages
reproducible, with KBUILD_BUILD_TIMESTAMP specifiying the date. That
patch partly overlaps with commit d586ac10ce56 "perf docs: Allow man
page date to be specified", which implemented generation of dates
based on commit timestamps.
However, both of those implementations were specific to the original
asciidoc's DocBook backend and had no effect on asciidoctor's direct
man page generation.
This series builds on the current definition of perf_date, adding
support for asciidoctor and the KBUILD_BUILD_TIMESTAMP variable.
Ben.
Ben Hutchings (2):
perf doc: Define man page date when using asciidoctor
perf doc: Add support for KBUILD_BUILD_TIMESTAMP
tools/perf/Documentation/Makefile | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v2 1/2] perf doc: Define man page date when using asciidoctor
2023-05-13 20:35 [PATCH v2 0/2] perf doc improvements to man page reproducibility Ben Hutchings
@ 2023-05-13 20:37 ` Ben Hutchings
2023-05-13 20:37 ` [PATCH v2 2/2] perf doc: Add support for KBUILD_BUILD_TIMESTAMP Ben Hutchings
[not found] ` <CAP-5=fXmL509c2rhE7SYj9FW62eZPc7tPEWzG1h0DztF+Qmnww@mail.gmail.com>
2 siblings, 0 replies; 4+ messages in thread
From: Ben Hutchings @ 2023-05-13 20:37 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo
Cc: linux-perf-users, linux-kernel, Salvatore Bonaccorso
[-- Attachment #1: Type: text/plain, Size: 1902 bytes --]
From: Ben Hutchings <benh@debian.org>
When building perf documentation with asciidoc, we use "git log" to
find the last commit date of each doc source and pass that to asciidoc
to use as the man page date.
When using asciidoctor, however, the current date is always used
instead. Defining perf_date like we do for asciidoc also doesn't
work because we're not using DocBook as an intermediate format.
The asciidoctor man page backend looks for the variable "docdate",
so set that instead.
Signed-off-by: Ben Hutchings <benh@debian.org>
---
tools/perf/Documentation/Makefile | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/tools/perf/Documentation/Makefile b/tools/perf/Documentation/Makefile
index ba5d942e4c6a..8a7d7078e386 100644
--- a/tools/perf/Documentation/Makefile
+++ b/tools/perf/Documentation/Makefile
@@ -250,11 +250,16 @@ $(MAN_HTML): $(OUTPUT)%.html : %.txt
$(ASCIIDOC_EXTRA) -aperf_version=$(PERF_VERSION) -o $@+ $< && \
mv $@+ $@
+# Generate date from git log of the doc input file
+PERF_DATE = $(shell git log -1 --pretty="format:%cd" \
+ --date=short --no-show-signature $<)
+
ifdef USE_ASCIIDOCTOR
$(OUTPUT)%.1 $(OUTPUT)%.5 $(OUTPUT)%.7 : %.txt
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
$(ASCIIDOC) -b manpage -d manpage \
- $(ASCIIDOC_EXTRA) -aperf_version=$(PERF_VERSION) -o $@+ $< && \
+ $(ASCIIDOC_EXTRA) -aperf_version=$(PERF_VERSION) \
+ -adocdate=$(PERF_DATE) -o $@+ $< && \
mv $@+ $@
endif
@@ -266,9 +271,7 @@ $(OUTPUT)%.xml : %.txt
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
$(ASCIIDOC) -b docbook -d manpage \
$(ASCIIDOC_EXTRA) -aperf_version=$(PERF_VERSION) \
- -aperf_date=$(shell git log -1 --pretty="format:%cd" \
- --date=short --no-show-signature $<) \
- -o $@+ $< && \
+ -aperf_date=$(PERF_DATE) -o $@+ $< && \
mv $@+ $@
XSLT = docbook.xsl
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH v2 2/2] perf doc: Add support for KBUILD_BUILD_TIMESTAMP
2023-05-13 20:35 [PATCH v2 0/2] perf doc improvements to man page reproducibility Ben Hutchings
2023-05-13 20:37 ` [PATCH v2 1/2] perf doc: Define man page date when using asciidoctor Ben Hutchings
@ 2023-05-13 20:37 ` Ben Hutchings
[not found] ` <CAP-5=fXmL509c2rhE7SYj9FW62eZPc7tPEWzG1h0DztF+Qmnww@mail.gmail.com>
2 siblings, 0 replies; 4+ messages in thread
From: Ben Hutchings @ 2023-05-13 20:37 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo
Cc: linux-perf-users, linux-kernel, Salvatore Bonaccorso
From: Ben Hutchings <benh@debian.org>
When building man pages from a Git checkout, we consistently set the
man page date based on when the input was last changed. Otherwise, it
defaults to the build time, which is not reproducible.
Allow the date to be set through the KBUILD_BUILD_TIMESTAMP variable,
as for timestamps in the kernel itself.
Signed-off-by: Ben Hutchings <benh@debian.org>
---
tools/perf/Documentation/Makefile | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tools/perf/Documentation/Makefile b/tools/perf/Documentation/Makefile
index 8a7d7078e386..4407b106d977 100644
--- a/tools/perf/Documentation/Makefile
+++ b/tools/perf/Documentation/Makefile
@@ -250,9 +250,13 @@ $(MAN_HTML): $(OUTPUT)%.html : %.txt
$(ASCIIDOC_EXTRA) -aperf_version=$(PERF_VERSION) -o $@+ $< && \
mv $@+ $@
-# Generate date from git log of the doc input file
-PERF_DATE = $(shell git log -1 --pretty="format:%cd" \
- --date=short --no-show-signature $<)
+# Generate date from either KBUILD_BUILD_TIMESTAMP or git log of
+# the doc input file
+PERF_DATE = $(strip \
+ $(if $(KBUILD_BUILD_TIMESTAMP), \
+ $(shell date -u -d '$(KBUILD_BUILD_TIMESTAMP)' +%Y-%m-%d), \
+ $(shell git log -1 --pretty="format:%cd" \
+ --date=short --no-show-signature $<)))
ifdef USE_ASCIIDOCTOR
$(OUTPUT)%.1 $(OUTPUT)%.5 $(OUTPUT)%.7 : %.txt
^ permalink raw reply related [flat|nested] 4+ messages in thread[parent not found: <CAP-5=fXmL509c2rhE7SYj9FW62eZPc7tPEWzG1h0DztF+Qmnww@mail.gmail.com>]
* Re: [PATCH v2 0/2] perf doc improvements to man page reproducibility
[not found] ` <CAP-5=fXmL509c2rhE7SYj9FW62eZPc7tPEWzG1h0DztF+Qmnww@mail.gmail.com>
@ 2023-05-15 20:49 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2023-05-15 20:49 UTC (permalink / raw)
To: Ian Rogers
Cc: Ben Hutchings, Peter Zijlstra, Ingo Molnar, linux-perf-users,
LKML, Salvatore Bonaccorso
Em Mon, May 15, 2023 at 07:26:52AM -0700, Ian Rogers escreveu:
> On Sat, May 13, 2023, 1:35 PM Ben Hutchings <ben@decadent.org.uk> wrote:
>
> > I previously sent a patch in 2016(!) to make the dates in man pages
> > reproducible, with KBUILD_BUILD_TIMESTAMP specifiying the date. That
> > patch partly overlaps with commit d586ac10ce56 "perf docs: Allow man
> > page date to be specified", which implemented generation of dates
> > based on commit timestamps.
> >
> > However, both of those implementations were specific to the original
> > asciidoc's DocBook backend and had no effect on asciidoctor's direct
> > man page generation.
> >
> > This series builds on the current definition of perf_date, adding
> > support for asciidoctor and the KBUILD_BUILD_TIMESTAMP variable.
> >
> > Ben.
> >
> > Ben Hutchings (2):
> > perf doc: Define man page date when using asciidoctor
> > perf doc: Add support for KBUILD_BUILD_TIMESTAMP
> >
>
> Acked-by: Ian Rogers<irogers@google.com>
Thanks, applied.
- Arnaldo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-05-15 20:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-13 20:35 [PATCH v2 0/2] perf doc improvements to man page reproducibility Ben Hutchings
2023-05-13 20:37 ` [PATCH v2 1/2] perf doc: Define man page date when using asciidoctor Ben Hutchings
2023-05-13 20:37 ` [PATCH v2 2/2] perf doc: Add support for KBUILD_BUILD_TIMESTAMP Ben Hutchings
[not found] ` <CAP-5=fXmL509c2rhE7SYj9FW62eZPc7tPEWzG1h0DztF+Qmnww@mail.gmail.com>
2023-05-15 20:49 ` [PATCH v2 0/2] perf doc improvements to man page reproducibility Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).