1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/common/bin/difftext.sh Tue Apr 10 08:18:28 2012 -0700 1.3 @@ -0,0 +1,157 @@ 1.4 +#!/bin/bash 1.5 +# 1.6 +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 1.7 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 +# 1.9 +# This code is free software; you can redistribute it and/or modify it 1.10 +# under the terms of the GNU General Public License version 2 only, as 1.11 +# published by the Free Software Foundation. 1.12 +# 1.13 +# This code is distributed in the hope that it will be useful, but WITHOUT 1.14 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.15 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.16 +# version 2 for more details (a copy is included in the LICENSE file that 1.17 +# accompanied this code). 1.18 +# 1.19 +# You should have received a copy of the GNU General Public License version 1.20 +# 2 along with this work; if not, write to the Free Software Foundation, 1.21 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.22 +# 1.23 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.24 +# or visit www.oracle.com if you need additional information or have any 1.25 +# questions. 1.26 +# 1.27 + 1.28 +# The difftext.sh knows how to compare text files and 1.29 +# ignore some specific differences. 1.30 +# When difftext.sh is called, we already know that the 1.31 +# files differ. But if the tests below trigger, then 1.32 +# we ignore differences caused by: 1.33 +# 1.34 +# Timestamps in Java sources generated by idl2java 1.35 +# Sorting order and cleanup style in .properties files. 1.36 + 1.37 +OLD="$1" 1.38 +NEW="$2" 1.39 +SUF="${OLD##*.}" 1.40 +TMP=1 1.41 +if test "x$SUF" == "xjava"; then 1.42 + TMP=$(LANG=C diff $OLD $NEW | \ 1.43 + grep '^[<>]' | \ 1.44 + sed '/[<>] \* from.*\.idl/d' | \ 1.45 + sed '/[<>] \*.*201[12].*/d' | \ 1.46 + sed '/\/\/ Generated from input file.*/d' | \ 1.47 + sed '/\/\/ This file was generated AUTOMATICALLY from a template file.*/d' | \ 1.48 + sed '/\/\/ java GenerateCharacter.*/d') 1.49 +fi 1.50 +if test "x$SUF" == "xproperties"; then 1.51 + cat $OLD | sed -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \ 1.52 +-e 's/\\u0020/\x20/g' \ 1.53 +-e 's/\\u003A/\x3A/g' \ 1.54 +-e 's/\\u006B/\x6B/g' \ 1.55 +-e 's/\\u0075/\x75/g' \ 1.56 +-e 's/\\u00A0/\xA0/g' \ 1.57 +-e 's/\\u00A3/\xA3/g' \ 1.58 +-e 's/\\u00B0/\xB0/g' \ 1.59 +-e 's/\\u00B7/\xB7/g' \ 1.60 +-e 's/\\u00BA/\xBA/g' \ 1.61 +-e 's/\\u00BF/\xBF/g' \ 1.62 +-e 's/\\u00C0/\xC0/g' \ 1.63 +-e 's/\\u00C1/\xC1/g' \ 1.64 +-e 's/\\u00C2/\xC2/g' \ 1.65 +-e 's/\\u00C4/\xC4/g' \ 1.66 +-e 's/\\u00C5/\xC5/g' \ 1.67 +-e 's/\\u00C8/\xC8/g' \ 1.68 +-e 's/\\u00C9/\xC9/g' \ 1.69 +-e 's/\\u00CA/\xCA/g' \ 1.70 +-e 's/\\u00CD/\xCD/g' \ 1.71 +-e 's/\\u00CE/\xCE/g' \ 1.72 +-e 's/\\u00D3/\xD3/g' \ 1.73 +-e 's/\\u00D4/\xD4/g' \ 1.74 +-e 's/\\u00D6/\xD6/g' \ 1.75 +-e 's/\\u00DA/\xDA/g' \ 1.76 +-e 's/\\u00DC/\xDC/g' \ 1.77 +-e 's/\\u00DD/\xDD/g' \ 1.78 +-e 's/\\u00DF/\xDF/g' \ 1.79 +-e 's/\\u00E0/\xE0/g' \ 1.80 +-e 's/\\u00E1/\xE1/g' \ 1.81 +-e 's/\\u00E2/\xE2/g' \ 1.82 +-e 's/\\u00E3/\xE3/g' \ 1.83 +-e 's/\\u00E4/\xE4/g' \ 1.84 +-e 's/\\u00E5/\xE5/g' \ 1.85 +-e 's/\\u00E6/\xE6/g' \ 1.86 +-e 's/\\u00E7/\xE7/g' \ 1.87 +-e 's/\\u00E8/\xE8/g' \ 1.88 +-e 's/\\u00E9/\xE9/g' \ 1.89 +-e 's/\\u00EA/\xEA/g' \ 1.90 +-e 's/\\u00EB/\xEB/g' \ 1.91 +-e 's/\\u00EC/\xEC/g' \ 1.92 +-e 's/\\u00ED/\xED/g' \ 1.93 +-e 's/\\u00EE/\xEE/g' \ 1.94 +-e 's/\\u00EF/\xEF/g' \ 1.95 +-e 's/\\u00F1/\xF1/g' \ 1.96 +-e 's/\\u00F2/\xF2/g' \ 1.97 +-e 's/\\u00F3/\xF3/g' \ 1.98 +-e 's/\\u00F4/\xF4/g' \ 1.99 +-e 's/\\u00F5/\xF5/g' \ 1.100 +-e 's/\\u00F6/\xF6/g' \ 1.101 +-e 's/\\u00F9/\xF9/g' \ 1.102 +-e 's/\\u00FA/\xFA/g' \ 1.103 +-e 's/\\u00FC/\xFC/g' \ 1.104 +-e 's/\\u0020/\x20/g' \ 1.105 +-e 's/\\u003f/\x3f/g' \ 1.106 +-e 's/\\u006f/\x6f/g' \ 1.107 +-e 's/\\u0075/\x75/g' \ 1.108 +-e 's/\\u00a0/\xa0/g' \ 1.109 +-e 's/\\u00a3/\xa3/g' \ 1.110 +-e 's/\\u00b0/\xb0/g' \ 1.111 +-e 's/\\u00ba/\xba/g' \ 1.112 +-e 's/\\u00bf/\xbf/g' \ 1.113 +-e 's/\\u00c1/\xc1/g' \ 1.114 +-e 's/\\u00c4/\xc4/g' \ 1.115 +-e 's/\\u00c5/\xc5/g' \ 1.116 +-e 's/\\u00c8/\xc8/g' \ 1.117 +-e 's/\\u00c9/\xc9/g' \ 1.118 +-e 's/\\u00ca/\xca/g' \ 1.119 +-e 's/\\u00cd/\xcd/g' \ 1.120 +-e 's/\\u00d6/\xd6/g' \ 1.121 +-e 's/\\u00dc/\xdc/g' \ 1.122 +-e 's/\\u00dd/\xdd/g' \ 1.123 +-e 's/\\u00df/\xdf/g' \ 1.124 +-e 's/\\u00e0/\xe0/g' \ 1.125 +-e 's/\\u00e1/\xe1/g' \ 1.126 +-e 's/\\u00e2/\xe2/g' \ 1.127 +-e 's/\\u00e3/\xe3/g' \ 1.128 +-e 's/\\u00e4/\xe4/g' \ 1.129 +-e 's/\\u00e5/\xe5/g' \ 1.130 +-e 's/\\u00e7/\xe7/g' \ 1.131 +-e 's/\\u00e8/\xe8/g' \ 1.132 +-e 's/\\u00e9/\xe9/g' \ 1.133 +-e 's/\\u00ea/\xea/g' \ 1.134 +-e 's/\\u00eb/\xeb/g' \ 1.135 +-e 's/\\u00ec/\xec/g' \ 1.136 +-e 's/\\u00ed/\xed/g' \ 1.137 +-e 's/\\u00ee/\xee/g' \ 1.138 +-e 's/\\u00ef/\xef/g' \ 1.139 +-e 's/\\u00f0/\xf0/g' \ 1.140 +-e 's/\\u00f1/\xf1/g' \ 1.141 +-e 's/\\u00f2/\xf2/g' \ 1.142 +-e 's/\\u00f3/\xf3/g' \ 1.143 +-e 's/\\u00f4/\xf4/g' \ 1.144 +-e 's/\\u00f5/\xf5/g' \ 1.145 +-e 's/\\u00f6/\xf6/g' \ 1.146 +-e 's/\\u00f7/\xf7/g' \ 1.147 +-e 's/\\u00f8/\xf8/g' \ 1.148 +-e 's/\\u00f9/\xf9/g' \ 1.149 +-e 's/\\u00fa/\xfa/g' \ 1.150 +-e 's/\\u00fc/\xfc/g' \ 1.151 +-e 's/\\u00ff/\xff/g' \ 1.152 + | sed -e '/^#/d' -e '/^$/d' \ 1.153 + -e :a -e '/\\$/N; s/\\\n//; ta' \ 1.154 + -e 's/^[ \t]*//;s/[ \t]*$//' \ 1.155 + -e 's/\\=/=/' | LANG=C sort > $OLD.cleaned 1.156 + TMP=$(LANG=C diff $OLD.cleaned $NEW) 1.157 +fi 1.158 +if test -n "$TMP"; then 1.159 + echo Files $OLD and $NEW differ 1.160 +fi