Re: new snapshot available: m4-1.4.19.60-6ebfc.tar.xz

Simon Josefsson via Bug reports for the GNU m4 macro processor <[email protected]> Mon, 14 Apr 2025 21:45:40 +0200
Newsgroups gmane.comp.gnu.m4.bugs,gmane.comp.lib.gnulib.bugs
Message-ID <[email protected]>
--=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Eric Blake <[email protected]> writes:

>> --- a/doc/m4.texi
>> +++ b/doc/m4.texi
>> @@ -41,7 +41,7 @@
>>=20=20
>>  @copying
>>=20=20
>> -This manual (@value{UPDATED}) is for GNU M4 (version
>> +This manual is for GNU M4 (version
>>  @value{VERSION}), a package containing an implementation of the m4 macro
>>  language.
>
> My understanding is that UPDATED is set to the day the manual is built
> (which obviously is not reproducible).  But out of curiosity - but is
> there a way to make the reproducible hard-code the date of the git
> commit into UPDATED rather than the current date?

Here is what I'm using in gsasl's configure.ac (abbreviated for
readability):

st_touch=3D197001010000.00
AC_MSG_CHECKING([for timestamps of last git commit])
if test -e "$srcdir"/.git && command -v git > /dev/null; then
   if tmp=3D$(env TZ=3DUTC0 git log -1 --format=3D%cd --date=3Dformat-local=
:%Y%m%d%H%M.%S); then
      st_touch=3D"$tmp"
   fi
fi
AC_MSG_RESULT(touch $st_touch)
env TZ=3DUTC0 \
    touch -m -t "$st_touch" "$srcdir"/doc/$PACKAGE.texi

This works because doc/version.texi is generated through build-aux/mdate
on doc/$PACKAGE.texi, which with the above snippet is set to the last
git commit timestamp, which is more reproducible.

I'm still not perfectly happy with this idiom, for anyone building from
a 'git archive' snapshot of the git repository, their timestamp will be
different.  But at least this improves from my initial attempt to put it
in Makefile.am like this (from libidn):

dist-hook: mtime-NEWS-to-git-HEAD
.PHONY: mtime-NEWS-to-git-HEAD
mtime-NEWS-to-git-HEAD:
	$(AM_V_GEN)if test -e $(srcdir)/.git \
			&& command -v git > /dev/null; then \
		touch -m -t "$$(git log -1 --format=3D%cd --date=3Dformat-local:%Y%m%d%H%=
M.%S)" $(srcdir)/NEWS; \
	fi

dist-hook: texi-stamps-to-mtime-NEWS
.PHONY: texi-stamps-to-mtime-NEWS
texi-stamps-to-mtime-NEWS: mtime-NEWS-to-git-HEAD
	$(AM_V_GEN)touch -m -r $(srcdir)/NEWS $(srcdir)/doc/$(PACKAGE).texi

I realized that this is running to late in the build process:
doc/version.texi is already generated using the earlier mdate of
doc/$PACKAGE.texi, so it wasn't reproducible.

/Simon

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQNoBAEWCAMQFiEEo8ychwudMQq61M8vUXIrCP5HRaIFAmf9ZeQUHHNpbW9uQGpv
c2Vmc3Nvbi5vcmfCHCYAmDMEXJLOtBYJKwYBBAHaRw8BAQdACIcrZIvhrxDBkK9f
V+QlTmXxo2naObDuGtw58YaxlOu0JVNpbW9uIEpvc2Vmc3NvbiA8c2ltb25Aam9z
ZWZzc29uLm9yZz6IlgQTFggAPgIbAwULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgBYh
BLHSvRN1vst4TPT4xNc89jjFPAa+BQJn0XQkBQkNZGbwAAoJENc89jjFPAa+BtIA
/iR73CfBurG9y8pASh3cbGOMHpDZfMAtosu6jbpO69GHAP4p7l57d+iVty2VQMsx
+3TCSAvZkpr4P/FuTzZ8JZe8BrgzBFySz4EWCSsGAQQB2kcPAQEHQOxTCIOaeXAx
I2hIX4HK9bQTpNVei708oNr1Klm8qCGKiPUEGBYIACYCGwIWIQSx0r0Tdb7LeEz0
+MTXPPY4xTwGvgUCZ9F0SgUJDWRmSQCBdiAEGRYIAB0WIQSjzJyHC50xCrrUzy9R
cisI/kdFogUCXJLPgQAKCRBRcisI/kdFoqdMAQCgH45aseZgIrwKOvUOA9QfsmeE
8GZHYNuFHmM9FEQS6AD6A4x5aYvoY6lo98pgtw2HPDhmcCXFItjXCrV4A0GmJA4J
ENc89jjFPAa+wUUBAO64fbZek6FPlRK0DrlWsrjCXuLi6PUxyzCAY6lG2nhUAQC6
qobB9mkZlZ0q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