[Libreoffice-commits] dev-tools.git: 2 commits - scripts/docdiff.sh

Miklos Vajna vmiklos at suse.cz
Mon Apr 15 02:44:53 PDT 2013


 scripts/docdiff.sh |   96 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 96 insertions(+)

New commits:
commit 5306df2204cad2387fb43deef5fcaa145a7086bf
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Mon Apr 15 11:44:09 2013 +0200

    docdiff: fix typo to make -k work
    
    Change-Id: I510e34fcf8de78f5000e52b2d1450dab4c18439c

diff --git a/scripts/docdiff.sh b/scripts/docdiff.sh
index cb04a06..ef5669a 100755
--- a/scripts/docdiff.sh
+++ b/scripts/docdiff.sh
@@ -69,7 +69,7 @@ while getopts r:t:skhq opt ; do
 		r) RES="$OPTARG" ;;
 		t) TMP="$OPTARG" ;;
 		s) SORT="sort -n -k2,2" ;;
-		s) KEEP=1 ;;
+		k) KEEP=1 ;;
 		q) QUIET=1; GS="gs -q";;
 		h) usage; exit ;;
 		?) usage; exit ;;
commit 6786524958bdd3400a244e090f75f57e6956eeef
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Mon Apr 15 11:40:35 2013 +0200

    scripts: import oodocdiff.sh from old build repo
    
    Change-Id: I967e8786ddf08e638cc58845c6dc8ccaca962856

diff --git a/scripts/docdiff.sh b/scripts/docdiff.sh
new file mode 100755
index 0000000..cb04a06
--- /dev/null
+++ b/scripts/docdiff.sh
@@ -0,0 +1,96 @@
+#!/bin/sh
+########################################################################
+#
+#  Copyright (c) 2010 Thorsten Behrens, Miklos Vajna
+#  
+#  Permission is hereby granted, free of charge, to any person
+#  obtaining a copy of this software and associated documentation
+#  files (the "Software"), to deal in the Software without
+#  restriction, including without limitation the rights to use,
+#  copy, modify, merge, publish, distribute, sublicense, and/or sell
+#  copies of the Software, and to permit persons to whom the
+#  Software is furnished to do so, subject to the following
+#  conditions:
+#  
+#  The above copyright notice and this permission notice shall be
+#  included in all copies or substantial portions of the Software.
+#  
+#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+#  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+#  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+#  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+#  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+#  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+#  OTHER DEALINGS IN THE SOFTWARE.
+#
+#  This little hack is much inspired by Caolan McNamara's original
+#  OpenOffice.org convwatch work
+#
+########################################################################
+
+# check for required gs
+which gs >/dev/null 2>&1 || { 
+	echo "need gs"; exit 1 
+}
+
+# check for required imagemagick tools
+which composite >/dev/null 2>&1 || { 
+	echo "need imagemagick's composite"; exit 1 
+}
+which identify >/dev/null 2>&1 || { 
+	echo "need imagemagick's identify"; exit 1 
+}
+
+usage ()
+{
+echo "Usage: $0 [options] <input1>.ps <input2>.ps"
+echo ""
+echo "Generates graphical comparison between input1 & input2"
+echo "and outputs count of different pixel values to stdout"
+echo ""
+echo "Options:"
+echo "-r<num>    Set image resolution to <num> dpi (defaults to 75)"
+echo "-t<tmpdir> Set tmpdir location to use (defaults to /tmp)"
+echo "-s         Sort output by number of increasing differences"
+echo "-k         Keep temp images"
+echo "-h         This help information"
+echo "-q         Be quiet"
+}
+
+RES=75
+TMP=/tmp
+SORT=cat
+GS="gs"
+
+# Parse command line options
+while getopts r:t:skhq opt ; do
+	case "$opt" in
+		r) RES="$OPTARG" ;;
+		t) TMP="$OPTARG" ;;
+		s) SORT="sort -n -k2,2" ;;
+		s) KEEP=1 ;;
+		q) QUIET=1; GS="gs -q";;
+		h) usage; exit ;;
+		?) usage; exit ;;
+	esac
+done
+
+shift $(($OPTIND - 1))
+
+mkdir $TMP/$$.cmpdir
+
+test -z "$QUIET" && echo "Generating bitmap renderings of $1 ..."
+$GS -dNOPROMPT -dBATCH -sDEVICE=jpeg -r$RES -dNOPAUSE -sOutputFile=$TMP/$$.cmpdir/file1.%04d.jpeg $1
+
+test -z "$QUIET" && echo "Generating bitmap renderings of $2 ..."
+$GS -dNOPROMPT -dBATCH -sDEVICE=jpeg -r$RES -dNOPAUSE -sOutputFile=$TMP/$$.cmpdir/file2.%04d.jpeg $2
+
+test -z "$QUIET" && echo "Generating differences..."
+for file in $TMP/$$.cmpdir/file1.*; do test -z "$QUIET" && echo -n "$file: "; num=`echo $file | sed -e ' s/.*\.\(.*\)\..*/\1/'`; composite -compose difference $file $TMP/$$.cmpdir/file2.$num.jpeg - | identify -format %k -; done | $SORT
+
+if test -n "$KEEP"; then
+	echo "Keeping temp images at $TMP/$$.cmpdir" >&2
+else
+    rm -rf $TMP/$$.cmpdir
+fi


More information about the Libreoffice-commits mailing list