diff mbox series

[bug#70169,v2,04/12] maint: Help help2man generate reproducible man-pages.

Message ID 34915f43ed2e8b7ae99c3fe2fd65e7b97ff8f57b.1712437365.git.janneke@gnu.org
State New
Headers show
Series Reproducible `make dist' tarball in defiance of Autotools and Gettext | expand

Commit Message

Janneke Nieuwenhuizen April 6, 2024, 9:17 p.m. UTC
* doc/local.mk (SOURCE_DATE_EPOCH): New exported variable.

Change-Id: I6636693695d5502657f1475d93d31949e0b0b39d
---
 doc/local.mk | 3 +++
 1 file changed, 3 insertions(+)

Comments

pelzflorian (Florian Pelz) April 7, 2024, 1:54 p.m. UTC | #1
Hello Jan,

Janneke Nieuwenhuizen <janneke@gnu.org> writes:
> diff --git a/doc/local.mk b/doc/local.mk
> index 5f014b9c3d..017686137a 100644
> --- a/doc/local.mk
> +++ b/doc/local.mk
> @@ -224,6 +224,9 @@ gen_man =						\
>    $(HELP2MANFLAGS)
>  
>  HELP2MANFLAGS = --source=GNU --info-page=$(PACKAGE_TARNAME)
> +# help2man reproducibility
> +SOURCE_DATE_EPOCH = $(shell git show HEAD --format=%ct --no-patch 2>/dev/null || echo 0)
> +export SOURCE_DATE_EPOCH
>  
>  $(srcdir)/%D%/guix.1: scripts/guix.in $(sub_commands_mans)
>  	-$(AM_V_HELP2MAN)$(gen_man) --output="$@" `basename "$@" .1`

Do I interpret correctly that “echo 0” is a fallback timestamp?

Looking at the now gone instructions from “git show
83c60bb0622440afe98930820186ddfa1e6e8b2f”, at that time, a timestamp of
1 was used for the tarball; I do not remember why.  In
guix/scripts/pack.scm, 1 is used for squashfs and docker images.

Is 1 a better timestamp than 0?

Regards,
Florian
Janneke Nieuwenhuizen April 7, 2024, 2:06 p.m. UTC | #2
pelzflorian (Florian Pelz) writes:

Hello Florian,

> Janneke Nieuwenhuizen <janneke@gnu.org> writes:
>> diff --git a/doc/local.mk b/doc/local.mk
>> +SOURCE_DATE_EPOCH = $(shell git show HEAD --format=%ct --no-patch 2>/dev/null || echo 0)
>> +export SOURCE_DATE_EPOCH
>
> Do I interpret correctly that “echo 0” is a fallback timestamp?

Yes.

> Looking at the now gone instructions from “git show
> 83c60bb0622440afe98930820186ddfa1e6e8b2f”, at that time, a timestamp of
> 1 was used for the tarball; I do not remember why.  In
> guix/scripts/pack.scm, 1 is used for squashfs and docker images.

That's probably because of build dependencies.

> Is 1 a better timestamp than 0?

For files, using 1 is preferrable if it's not a source file.  We use 1
for .go files, and 0 for .scm files, iirc.  SOURCE_DATE_EPOCH is (only)
used for the date in the document.  Without git, 0 is as good a guess
for a reproducible date for use in a document as any, I think.

Greetings,
Janneke
pelzflorian (Florian Pelz) April 7, 2024, 3:20 p.m. UTC | #3
Janneke Nieuwenhuizen <janneke@gnu.org> writes:
> pelzflorian (Florian Pelz) writes:
>> Is 1 a better timestamp than 0?
>
> For files, using 1 is preferrable if it's not a source file.  We use 1
> for .go files, and 0 for .scm files, iirc.  SOURCE_DATE_EPOCH is (only)
> used for the date in the document.  Without git, 0 is as good a guess
> for a reproducible date for use in a document as any, I think.
>
> Greetings,
> Janneke

Thank you for explaining.  So this SOURCE_DATE_EPOCH applies to all the
generated files in doc/ but still 0 is fine, because noone warns if they
are not later than source files, IIUC.

Regards,
Florian
Ludovic Courtès April 8, 2024, 9:23 a.m. UTC | #4
Hello,

"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> skribis:

> Looking at the now gone instructions from “git show
> 83c60bb0622440afe98930820186ddfa1e6e8b2f”, at that time, a timestamp of
> 1 was used for the tarball; I do not remember why.  In
> guix/scripts/pack.scm, 1 is used for squashfs and docker images.

In the store, a timestamp of 1 (not 0) is used.  This is because there
are tools (among which ‘make’ IIRC) that behave differently when mtime
is zero.

For consistency and to be on the safe side, it’s probably a good idea to
do the same (as the fallback in this case).

Ludo’.
Janneke Nieuwenhuizen April 8, 2024, 9:40 a.m. UTC | #5
Ludovic Courtès writes:

Hi,

> "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> skribis:
>
>> Looking at the now gone instructions from “git show
>> 83c60bb0622440afe98930820186ddfa1e6e8b2f”, at that time, a timestamp of
>> 1 was used for the tarball; I do not remember why.  In
>> guix/scripts/pack.scm, 1 is used for squashfs and docker images.
>
> In the store, a timestamp of 1 (not 0) is used.  This is because there
> are tools (among which ‘make’ IIRC) that behave differently when mtime
> is zero.
>
> For consistency and to be on the safe side, it’s probably a good idea to
> do the same (as the fallback in this case).

Okay, will change for v3.
diff mbox series

Patch

diff --git a/doc/local.mk b/doc/local.mk
index 5f014b9c3d..017686137a 100644
--- a/doc/local.mk
+++ b/doc/local.mk
@@ -224,6 +224,9 @@  gen_man =						\
   $(HELP2MANFLAGS)
 
 HELP2MANFLAGS = --source=GNU --info-page=$(PACKAGE_TARNAME)
+# help2man reproducibility
+SOURCE_DATE_EPOCH = $(shell git show HEAD --format=%ct --no-patch 2>/dev/null || echo 0)
+export SOURCE_DATE_EPOCH
 
 $(srcdir)/%D%/guix.1: scripts/guix.in $(sub_commands_mans)
 	-$(AM_V_HELP2MAN)$(gen_man) --output="$@" `basename "$@" .1`