Accepting request 116741 from openSUSE:Tools

Further enhancements for PDF files. (forwarded request 116740 from a_jaeger)

OBS-URL: https://build.opensuse.org/request/show/116741
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/build-compare?expand=0&rev=71
This commit is contained in:
Stephan Kulow 2012-05-08 16:00:36 +00:00 committed by Git OBS Bridge
commit f2ff8a4938
2 changed files with 21 additions and 6 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue May 8 12:35:21 UTC 2012 - aj@suse.de
- Further handling of pdf files (bnc#760867), patch by
David Haller <david@dhaller.de>.
-------------------------------------------------------------------
Mon May 7 14:50:43 UTC 2012 - aj@suse.de

View File

@ -138,7 +138,7 @@ diff_two_files()
check_single_file()
{
local file=$1
local file="$1"
case $file in
*.spec)
sed -i -e "s,Release:.*$release1,Release: @RELEASE@," old/$file
@ -406,13 +406,22 @@ check_single_file()
# PDF files contain a unique ID, remove it
# Format of the ID is:
# /ID [<9ACE247A70CF9BEAFEE15E116259BD6D> <9ACE247A70CF9BEAFEE15E116259BD6D>]
# pdftex creates also:
# with optional spaces. pdftex creates also:
# /CreationDate (D:20120103083206Z)
# /ModDate (D:20120103083206Z)
for f in old/$file new/$file; do
sed -i -e 's%/ID \?\[ \?<[^>]\+> <[^>]\+> \?\]%/IDrandom%g' $f
sed -i -e 's%/CreationDate (D:.*)%/CreationDate (D: XXX)%g' $f
sed -i -e 's%/ModDate (D:.*)%/ModDate (D: XXX)%g' $f
# and possibly XML metadata as well
for f in "old/$file" "new/$file"; do
sed -i \
'/obj/,/endobj/{
s%/ID \?\[ \?<[^>]\+> \?<[^>]\+> \?\]%/IDrandom%g;
s%/CreationDate \?(D:[^)]*)%/CreationDate (D: XXX)%g;
s%/ModDate \?(D:[^)]*)%/ModDate (D: XXX)%g;
s%<pdf:CreationDate>[^<]*</pdf:CreationDate>%<pdf:CreationDate>XXX</pdf:CreationDate>%g;
s%<pdf:ModDate>[^<]*</pdf:ModDate>%<pdf:ModDate>XXX</pdf:ModDate>%g;
s%<xap:CreateDate>[^<]*</xap:CreateDate>%<xap:CreateDate>XXX</xap:CreateDate>%g;
s%<xap:ModifyDate>[^<]*</xap:ModifyDate>%<xap:ModifyDate>XXX</xap:ModifyDate>%g;
s%<xap:MetadataDate>[^<]*</xap:MetadataDate>%<xap:MetadataDate>XXX</xap:MetadataDate>%g;
}' "$f"
done
;;
esac