[Reproducible-builds] Timestamps from pdflatex -- almost but not quite there (?)
Dirk Eddelbuettel
edd at debian.org
Wed Sep 23 00:38:36 UTC 2015
Hi Holger,
Thanks for the follow-up!
On 23 September 2015 at 02:09, Holger Levsen wrote:
| Hi Dirk,
|
| thanks for caring and contacting us!
|
| On Samstag, 19. September 2015, Dirk Eddelbuettel wrote:
| > I still have a few packages where the included pdf has a creation/mod time
| > stamp that differs. I am __almost__ at the point where I can override the
| > created pdf file:
|
| can you give a (few) package name(s) which you are talking about? :-)
Certainly.
I was working with ess -- upstream (with my debian/) is at
https://github.com/emacs-ess/ESS
Package name is ess. I am (too) old-school and don't have source in our git
(and still don't build via git, my bad).
The build process descends into doc/refcard/ and runs 'pdflatex refcard.tex'.
I create an upstream pull request (now accepted) to not use \date{} but fix
that, and with that I was able to __in the shell only__ postprocess via the
script below.
However, when I run the same script via pbuilder in my chroot it fails. I do
not understand why. I jumped into the #irc channel but didn't get too
far. One suggestion for LC_ALL was tried, no difference.
Script is below:
Argument $1 is the pdf file to modify
Argument $2 is what 'dpkg-parsechangelog -S date' produces above debian/changelog.
Extra debugging is on
I have about six or seven packages with similar issues -- ie pdf
documentation has metadata.
Dirk
#!/bin/bash
##
## Override CreationDate and ModDate timestamps in pdf files
##
## Based in part on
## https://wiki.debian.org/ReproducibleBuilds/TimestampsInPDFGeneratedByLaTeX
## as well as a fair amount of trial and error
##
## Dirk Eddelbuettel, September 2015
## Released under GPL-2 or later
set -u
set -e
if [ $# -lt 2 ]; then
echo "Usage: $0 file datestr"
exit 1
fi
FILE=$1
DEB_DATE=$2
echo "Using arguments '${FILE}' and '${DEB_DATE}'"
#if [ ! -d debian/ ]; then
# echo "No debian/ subdirectory"
# exit 1
#fi
export LC_ALL=C.UTF-8
## Meant for debian/ subdirectories containing file debian/changelog
#DEB_DATE=$(dpkg-parsechangelog -S date)
PDF_DATE=$(date -ud "${DEB_DATE}" +D:%Y%m%d%H%M%S-00\'00\')
echo "Using PDF_DATE ${PDF_DATE}"
sed -i -e "s|^/CreationDate (.*)$|/CreationDate (${PDF_DATE})|" ${FILE}
sed -i -e "s|^/ModDate (.*)$|/ModDate (${PDF_DATE})|" ${FILE}
MD5=$((echo "${DEB_DATE}" && du -b ${FILE}) | md5sum | cut -c -32)
echo "Using MD5 ${MD5}"
sed -i "s|^/ID \\[\\(<[0-9A-F]\\{32\\}>\\) \\1]$|/ID [<${MD5}> <${MD5}>]|" ${FILE}
--
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
More information about the Reproducible-builds
mailing list