Re: [PATCH 1/3] Documentation: allow overriding timestamps of generated asciidoc
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Nov 22, 2017, 01:15 UTC
- Message-ID
- <20171122011531.GQ3429@aiede.mtv.corp.google.com>
- In-Reply-To
- <20171122005433.kwv4bin6y65xuxm5@genre.crustytoothpaste.net>
Hi,
brian m. carlson wrote:
> On Tue, Nov 21, 2017 at 03:34:32PM -0800, Jonathan Nieder wrote:
Show 12 quoted lines
>> --- a/Documentation/Makefile >> +++ b/Documentation/Makefile >> @@ -410,6 +410,7 @@ $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml >> howto-index.txt: howto-index.sh $(wildcard howto/*.txt) >> $(QUIET_GEN)$(RM) $@+ $@ && \ >> '$(SHELL_PATH_SQ)' ./howto-index.sh $(sort $(wildcard howto/*.txt)) >$@+ && \ >> + $(if $(SOURCE_DATE_EPOCH),touch -d '@$(SOURCE_DATE_EPOCH)' $@+ &&) \ > > touch -d @SECONDS isn't POSIX compliant, and non-Linux systems don't > provide it. POSIX only allows certain fixed format, and I assume that > non-Linux parties (maybe OpenBSD) will want to have reproducible builds > as well.
Interesting. My knee-jerk preference is still to go with this patch as-is for now, since the non-portability only triggers when SOURCE_DATE_EPOCH is set.
Show 18 quoted lines
> It's unfortunate for shell users that this variable is in seconds from
> the epoch, since there's no portable way to format such a time in shell.
> (POSIX doesn't allow date(1) to format anything but the current time.)
>
> My proposed solution was to use Perl to do so, and simply require that
> if you wanted a reproducible build, then you had to have Perl. That
> would, of course, require a separate variable in the Makefile holding
> the formatted date.
>
> Maybe something like the following in the Makefile:
>
> ifndef NO_PERL
> SOURCE_DATE_TIMESTAMP=$(shell perl -MPOSIX -e 'print strftime("%FT%TZ", gmtime($ENV{SOURCE_DATE_EPOCH}));')
> endif
>
> and then:
>
> + $(if $(SOURCE_DATE_TIMESTAMP),touch -d '$(SOURCE_DATE_TIMESTAMP)' $@+ &&) \Neat. I can play with this a little.
http://asciidoc.org/CHANGELOG.html is stale but asciidoc still seems to be getting changes at https://github.com/asciidoc/asciidoc. I wonder how difficult it would be to add any required SOURCE_DATE_EPOCH support there.
Longer term, I wonder what it would take to move to a markup language that is more widely known, like commonmark.
Thanks, Jonathan