Gents,

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:

 - it works in a normal shell, ie the sequence

       pdfinfo somefile.pdf
       fixTimestamps.sh somefile.pdf 'timestamp_from_debian/changelog'
       pdfinfo somefile.pdf

   works:  the file remains valid, and pdfinfo shows the before/after
   timestamps as desired

 - it does NOT work in pbuilder and I cannot narrow down why -- the second
   pdfinfo call (added for debugging) reports a corrupted pdf file.

To be clear, I use the same exact helper script: it works 'on the shell' but
not in pbuilder.  What am I missing?

The script-let (in its current form) is below.

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

##  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})|" \
       -e "s|^/ModDate (.*)$|/ModDate (${PDF_DATE})|" ${FILE}

MD5=$((echo "${DEB_DATE}" && du -b ${FILE}) | md5sum | cut -c -32)
sed -i "s|^/ID \\[\\(<[0-9A-F]\\{32\\}>\\) \\1]$|/ID [<${MD5}> <${MD5}>]|" 
${FILE}





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

_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to