|
From: | Kaz Kylheku |
Subject: | [bug#49517] [PATCH] gnu: txr: Build documentation and update to 265. |
Date: | Sat, 17 Jul 2021 20:43:36 -0700 |
User-agent: | Roundcube Webmail/0.9.2 |
On 2021-07-17 15:51, Kaz Kylheku wrote:
On 2021-07-17 02:57, Guillaume Le Vaillant wrote:Hi, When testing the patch to build the HTML and PDF documentation, I noticed that the 'share/doc/txr-263/txr-manpage.pdf' file is not reproducible. There are some timestamps and UUIDs in it that change at each build (diffoscope output attached). Could you take a look at that and see if there's a way to make it reproducible? Thanks.Hi Guillaume,Thank you for your report. I don't see anything in the pdfroff documentationabout getting rid of this. I might use a program similar to this one to just overwrite the UUIDs and dates:
I've noticed that there are some dates in the document which respond to SOURCE_DATE_EPOCH: 2 0 obj <</Producer(GPL Ghostscript 9.26) /CreationDate(D:20210717203740-07'00') /ModDate(D:20210717203740-07'00') /Creator(groff version 1.22.3)>>endobj If I build with the SOURCE_DATE_EPOCH environment variable, these dates from Ghostscript follow that variable. That's why Guillaume isn't seeing an issue in that section of the file. Here is what I am going with: commit 8fbf3f55446427c06248ce222a05fd09d77ac878 (HEAD -> master) Author: Kaz Kylheku <kaz@kylheku.com> Date: Sat Jul 17 19:11:20 2021 -0700 doc: reproducible PDF. * Makefile (txr-manpage.pdf): If SOURCE_DATE_EPOCH exists, then run pdf-clobber-stamps.tl. * pdf-clobber-stamps.tl: New file. diff --git a/Makefile b/Makefile index 0094985f..cac9b3c0 100644 --- a/Makefile +++ b/Makefile @@ -560,6 +560,7 @@ txr-manpage.html: txr.1 genman.txr txr-manpage.pdf: txr.1 checkman.txr $(TXR) checkman.txr $< tbl $< | pdfroff -ww -man --no-toc - > $@ + [ $$SOURCE_DATE_EPOCH ] && $(TXR) pdf-clobber-stamps.tl || true # # Special targets used by ./configure diff --git a/pdf-clobber-stamps.tl b/pdf-clobber-stamps.tl new file mode 100644 index 00000000..0e56a44d --- /dev/null +++ b/pdf-clobber-stamps.tl @@ -0,0 +1,19 @@ +(let* ((epoch (or (tointz (getenv "SOURCE_DATE_EPOCH")) 0)) + (isotime (time-string-utc epoch "%FT%T+00:00")) + (pdf (file-get-string "txr-manpage.pdf")) + (start (search-str pdf "<?xpacket begin=")) + (end (if start (search-str pdf "<?xpacket end" start))) + (xml (if end [pdf start..end])) + (orig-len (len xml))) + (unless xml + (format *stderr* "XML block not found in PDF") + (exit nil)) + (upd xml + (regsub #/uuid:........-....-....-....-............/ + "uuid:00000000-0000-0000-0000-000000000000") + (regsub #/Date>....-..-..T..:..:..-..:../ + `Date>@isotime`)) + (assert (eql (len xml) orig-len)) + (set [pdf start..end] xml) + (file-put-string "txr-manpage.pdf.temp" pdf) + (rename-path "txr-manpage.pdf.temp" "txr-manpage.pdf"))
[Prev in Thread] | Current Thread | [Next in Thread] |