Subject: Re: [bug#49517] [PATCH] gnu: txr: Build documentation and update to 265.

From: Kaz Kylheku <[email-masked]>
Date: Sat, 17 Jul 2021 15:51:51 -0700

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 
documentation
about getting rid of this. I might use a program similar to this one
to just overwrite the UUIDs and dates:

(let* ((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>1970-01-01T00:00:00-00:00"))
   (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"))

I have some questions.

1. When, for the sake of reproducible binary builds,
    we replace date stamps with fixed dates, is there a preference for
    what date to use? I used the Unix epoch, as you can see.

    I'm aware of the convention involving the environment
    variable SOURCE_DATE_EPOCH.

    Should I use that?

2. Is there some recommended practice with regard to some
    ./configure option or environment/make variable to react to
    for ensuring reproducible builds? So that is to say, suppose
    I don't wish to do the above embedded XML cleaning, except
    when building for a distro that strives for reproducibility.

    For opting in to reproducibilty, should I again rely on
    SOURCE_DATE_EPOCH and have the build react to it?

Thanks ...