fig2dev itself honors SOURCE_DATE_EPOCH for generating reproducible output (e.g. for PS and SVG), but unfortunately this does not work when the PS/EPS file is converted to PDF by ghostscript.
ghostscript does not honor CreationDate/ModDate from the preamble, but uses the current time to set both dates/times in the PDF DocInfo and XMP metadata.
Fortunately, this can be overridden using the pdfmark operator and setting the DocInfo explicitly to the same date/time as used in the PostScript preamble.
The attached patch forces ghostscript to use the same Creation/ModDate as used in the PostScript preamble.
The PDF file is still not fully deterministic as ghostscript uses the current time in some other places, but suffices to create a file which can be included in a TeX file without making the final output unreproducible. Notably the PDF trailer ID and DocumentUUID are not part of the final PDF produced by e.g. pdflatex.
Applied with commit [fc429e]. Thank you for the contribution. In the commit afterwards creationdate.c was modified a little bit, since now I keep more strictly to the kernel coding style since creationdate.c was first written.
Related
Commit: [fc429e]