Eric Blake <[email protected]> writes: >> --- a/doc/m4.texi >> +++ b/doc/m4.texi >> @@ -41,7 +41,7 @@ >> >> @copying >> >> -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=197001010000.00
AC_MSG_CHECKING([for timestamps of last git commit])
if test -e "$srcdir"/.git && command -v git > /dev/null; then
if tmp=$(env TZ=UTC0 git log -1 --format=%cd
--date=format-local:%Y%m%d%H%M.%S); then
st_touch="$tmp"
fi
fi
AC_MSG_RESULT(touch $st_touch)
env TZ=UTC0 \
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=%cd
--date=format-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
signature.asc
Description: PGP signature
