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? :-)


I was working with ess -- upstream (with my debian/) is at


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 
 Extra debugging is on

I have about six or seven packages with similar issues -- ie pdf
documentation has metadata.


##  Override CreationDate and ModDate timestamps in pdf files
##  Based in part on 
##  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
echo "Using arguments '${FILE}' and '${DEB_DATE}'"

#if [ ! -d debian/ ]; then
#    echo "No debian/ subdirectory"
#    exit 1

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}>]|" 

http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

Reproducible-builds mailing list

Reply via email to