diff options
author | Thorsten Behrens <tbehrens@novell.com> | 2010-06-23 18:28:02 +0200 |
---|---|---|
committer | Thorsten Behrens <tbehrens@novell.com> | 2010-06-23 18:28:02 +0200 |
commit | 227697953e3171b80035bee2e5644d53d26360e0 (patch) | |
tree | 336f80424def72717602f01542f6e8fad0667f8d | |
parent | 3db8221bac4fcd9aa3d4253f72989ff79d7a11a8 (diff) |
Added missing ooxmldiff script, thx to Cedric
-rwxr-xr-x | ooxmldiff | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/ooxmldiff b/ooxmldiff new file mode 100755 index 0000000..1df2bdc --- /dev/null +++ b/ooxmldiff @@ -0,0 +1,49 @@ +#!/bin/sh + +function usage() +{ + echo "$0 <file1> <file2>" +} + +function extract() +{ + # First unzip all + mkdir -p $2 + unzip $1 -d $2 >/dev/null 2>&1 + + # Then convert the XML files to PYX + find $2 -type f | while read F + do + mime=`file -b --mime-type $F` + if [ "z$mime" = "zapplication/xml" ] + then + python `dirname $0`/xml2pyx.py $F $F.pyx + mv $F.pyx $F + fi + done +} + +if [ $# != 2 ] +then + usage + exit 1 +fi + +FILE1=$1 +FILE2=$2 + +TMP=/tmp/ooxmldiff + +# Extract both files +TMP1=$TMP/`basename $FILE1` +extract $FILE1 $TMP1 + +TMP2=$TMP/`basename $FILE2` +extract $FILE2 $TMP2 + +diff -ru $TMP1 $TMP2 + +# Clean up the whole place +rm -r $TMP + +exit 0 |