help-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Last modification date of the document with git?


From: Gavin Smith
Subject: Re: Last modification date of the document with git?
Date: Mon, 4 Oct 2021 20:26:36 +0100
User-agent: Mutt/1.9.4 (2018-02-28)

On Sun, Oct 03, 2021 at 10:04:34AM +0200, Vivien Kraus wrote:
> Hello, 
> 
> Le dimanche 03 octobre 2021 à 01:29 +0100, Gavin Smith a écrit :
> > Suppose you check out an old version with "git checkout".
> > Updating the file modification times to the present time means that
> > any derivative files will be regenerated by the build system.
> 
> We are not talking about the same thing. Automake generates a file to
> store the date of last modification (we use it as @value{UPDATED} after
> including version.texi), so that this date can be printed in the
> document. This is so people will know whether there is something new in
> the manual or not, I suppose.
> 
> If I clone the repository or otherwise checkout older commits, this
> date will be erased because Automake stores it as the texinfo file
> modification date. However, I can compute that date and I would like to
> restore it, so that @value{UPDATED} is correct.

It seems clear that you can't use version.texi with Automake to implement
what you want, as that uses the file modification date (via the mdate-sh
script).  I never worried about getting the old date to appear in the manual
when you build it.  If that's want you want you'd have to implement it
yourself.

Maybe you could do a "@include gitversion.texi" (avoiding the
version.texi name), and then in Makefile.am have a rule for building
gitversion.texi.  You could adapt the rules for building version.texi
that Automake outputs:

$(srcdir)/version.texi:  $(srcdir)/stamp-vti
$(srcdir)/stamp-vti: texinfo.texi $(top_srcdir)/configure
        @(dir=.; test -f ./texinfo.texi || dir=$(srcdir); \
        set `$(SHELL) $(top_srcdir)/build-aux/mdate-sh $$dir/texinfo.texi`; \
        echo "@set UPDATED $$1 $$2 $$3"; \
        echo "@set UPDATED-MONTH $$2 $$3"; \
        echo "@set EDITION $(VERSION)"; \
        echo "@set VERSION $(VERSION)") > vti.tmp$$$$ && \
        (cmp -s vti.tmp$$$$ $(srcdir)/version.texi \
          || (echo "Updating $(srcdir)/version.texi" && \
              cp vti.tmp$$$$ $(srcdir)/version.texi.tmp$$$$ && \
              mv $(srcdir)/version.texi.tmp$$$$ $(srcdir)/version.texi)) && \
        rm -f vti.tmp$$$$ $(srcdir)/version.texi.$$$$
        @cp $(srcdir)/version.texi $@

If you do this, I recommend that you make sure that the build works even when
the code is not in a git repository.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]