ohair@425: #!/bin/bash ohair@425: # ohair@425: # Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. ohair@425: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ohair@425: # ohair@425: # This code is free software; you can redistribute it and/or modify it ohair@425: # under the terms of the GNU General Public License version 2 only, as ohair@425: # published by the Free Software Foundation. ohair@425: # ohair@425: # This code is distributed in the hope that it will be useful, but WITHOUT ohair@425: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ohair@425: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ohair@425: # version 2 for more details (a copy is included in the LICENSE file that ohair@425: # accompanied this code). ohair@425: # ohair@425: # You should have received a copy of the GNU General Public License version ohair@425: # 2 along with this work; if not, write to the Free Software Foundation, ohair@425: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ohair@425: # ohair@425: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@425: # or visit www.oracle.com if you need additional information or have any ohair@425: # questions. ohair@425: # ohair@425: ohair@425: # The difftext.sh knows how to compare text files and ohair@425: # ignore some specific differences. ohair@425: # When difftext.sh is called, we already know that the ohair@425: # files differ. But if the tests below trigger, then ohair@425: # we ignore differences caused by: ohair@425: # ohair@425: # Timestamps in Java sources generated by idl2java ohair@425: # Sorting order and cleanup style in .properties files. ohair@425: ohair@425: OLD="$1" ohair@425: NEW="$2" ohair@425: SUF="${OLD##*.}" ohair@425: TMP=1 ohair@425: if test "x$SUF" == "xjava"; then ohair@425: TMP=$(LANG=C diff $OLD $NEW | \ ohair@425: grep '^[<>]' | \ ohair@425: sed '/[<>] \* from.*\.idl/d' | \ ohair@425: sed '/[<>] \*.*201[12].*/d' | \ ohair@425: sed '/\/\/ Generated from input file.*/d' | \ ohair@425: sed '/\/\/ This file was generated AUTOMATICALLY from a template file.*/d' | \ ohair@425: sed '/\/\/ java GenerateCharacter.*/d') ohair@425: fi ohair@425: if test "x$SUF" == "xproperties"; then ohair@425: cat $OLD | sed -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \ ohair@425: -e 's/\\u0020/\x20/g' \ ohair@425: -e 's/\\u003A/\x3A/g' \ ohair@425: -e 's/\\u006B/\x6B/g' \ ohair@425: -e 's/\\u0075/\x75/g' \ ohair@425: -e 's/\\u00A0/\xA0/g' \ ohair@425: -e 's/\\u00A3/\xA3/g' \ ohair@425: -e 's/\\u00B0/\xB0/g' \ ohair@425: -e 's/\\u00B7/\xB7/g' \ ohair@425: -e 's/\\u00BA/\xBA/g' \ ohair@425: -e 's/\\u00BF/\xBF/g' \ ohair@425: -e 's/\\u00C0/\xC0/g' \ ohair@425: -e 's/\\u00C1/\xC1/g' \ ohair@425: -e 's/\\u00C2/\xC2/g' \ ohair@425: -e 's/\\u00C4/\xC4/g' \ ohair@425: -e 's/\\u00C5/\xC5/g' \ ohair@425: -e 's/\\u00C8/\xC8/g' \ ohair@425: -e 's/\\u00C9/\xC9/g' \ ohair@425: -e 's/\\u00CA/\xCA/g' \ ohair@425: -e 's/\\u00CD/\xCD/g' \ ohair@425: -e 's/\\u00CE/\xCE/g' \ ohair@425: -e 's/\\u00D3/\xD3/g' \ ohair@425: -e 's/\\u00D4/\xD4/g' \ ohair@425: -e 's/\\u00D6/\xD6/g' \ ohair@425: -e 's/\\u00DA/\xDA/g' \ ohair@425: -e 's/\\u00DC/\xDC/g' \ ohair@425: -e 's/\\u00DD/\xDD/g' \ ohair@425: -e 's/\\u00DF/\xDF/g' \ ohair@425: -e 's/\\u00E0/\xE0/g' \ ohair@425: -e 's/\\u00E1/\xE1/g' \ ohair@425: -e 's/\\u00E2/\xE2/g' \ ohair@425: -e 's/\\u00E3/\xE3/g' \ ohair@425: -e 's/\\u00E4/\xE4/g' \ ohair@425: -e 's/\\u00E5/\xE5/g' \ ohair@425: -e 's/\\u00E6/\xE6/g' \ ohair@425: -e 's/\\u00E7/\xE7/g' \ ohair@425: -e 's/\\u00E8/\xE8/g' \ ohair@425: -e 's/\\u00E9/\xE9/g' \ ohair@425: -e 's/\\u00EA/\xEA/g' \ ohair@425: -e 's/\\u00EB/\xEB/g' \ ohair@425: -e 's/\\u00EC/\xEC/g' \ ohair@425: -e 's/\\u00ED/\xED/g' \ ohair@425: -e 's/\\u00EE/\xEE/g' \ ohair@425: -e 's/\\u00EF/\xEF/g' \ ohair@425: -e 's/\\u00F1/\xF1/g' \ ohair@425: -e 's/\\u00F2/\xF2/g' \ ohair@425: -e 's/\\u00F3/\xF3/g' \ ohair@425: -e 's/\\u00F4/\xF4/g' \ ohair@425: -e 's/\\u00F5/\xF5/g' \ ohair@425: -e 's/\\u00F6/\xF6/g' \ ohair@425: -e 's/\\u00F9/\xF9/g' \ ohair@425: -e 's/\\u00FA/\xFA/g' \ ohair@425: -e 's/\\u00FC/\xFC/g' \ ohair@425: -e 's/\\u0020/\x20/g' \ ohair@425: -e 's/\\u003f/\x3f/g' \ ohair@425: -e 's/\\u006f/\x6f/g' \ ohair@425: -e 's/\\u0075/\x75/g' \ ohair@425: -e 's/\\u00a0/\xa0/g' \ ohair@425: -e 's/\\u00a3/\xa3/g' \ ohair@425: -e 's/\\u00b0/\xb0/g' \ ohair@425: -e 's/\\u00ba/\xba/g' \ ohair@425: -e 's/\\u00bf/\xbf/g' \ ohair@425: -e 's/\\u00c1/\xc1/g' \ ohair@425: -e 's/\\u00c4/\xc4/g' \ ohair@425: -e 's/\\u00c5/\xc5/g' \ ohair@425: -e 's/\\u00c8/\xc8/g' \ ohair@425: -e 's/\\u00c9/\xc9/g' \ ohair@425: -e 's/\\u00ca/\xca/g' \ ohair@425: -e 's/\\u00cd/\xcd/g' \ ohair@425: -e 's/\\u00d6/\xd6/g' \ ohair@425: -e 's/\\u00dc/\xdc/g' \ ohair@425: -e 's/\\u00dd/\xdd/g' \ ohair@425: -e 's/\\u00df/\xdf/g' \ ohair@425: -e 's/\\u00e0/\xe0/g' \ ohair@425: -e 's/\\u00e1/\xe1/g' \ ohair@425: -e 's/\\u00e2/\xe2/g' \ ohair@425: -e 's/\\u00e3/\xe3/g' \ ohair@425: -e 's/\\u00e4/\xe4/g' \ ohair@425: -e 's/\\u00e5/\xe5/g' \ ohair@425: -e 's/\\u00e7/\xe7/g' \ ohair@425: -e 's/\\u00e8/\xe8/g' \ ohair@425: -e 's/\\u00e9/\xe9/g' \ ohair@425: -e 's/\\u00ea/\xea/g' \ ohair@425: -e 's/\\u00eb/\xeb/g' \ ohair@425: -e 's/\\u00ec/\xec/g' \ ohair@425: -e 's/\\u00ed/\xed/g' \ ohair@425: -e 's/\\u00ee/\xee/g' \ ohair@425: -e 's/\\u00ef/\xef/g' \ ohair@425: -e 's/\\u00f0/\xf0/g' \ ohair@425: -e 's/\\u00f1/\xf1/g' \ ohair@425: -e 's/\\u00f2/\xf2/g' \ ohair@425: -e 's/\\u00f3/\xf3/g' \ ohair@425: -e 's/\\u00f4/\xf4/g' \ ohair@425: -e 's/\\u00f5/\xf5/g' \ ohair@425: -e 's/\\u00f6/\xf6/g' \ ohair@425: -e 's/\\u00f7/\xf7/g' \ ohair@425: -e 's/\\u00f8/\xf8/g' \ ohair@425: -e 's/\\u00f9/\xf9/g' \ ohair@425: -e 's/\\u00fa/\xfa/g' \ ohair@425: -e 's/\\u00fc/\xfc/g' \ ohair@425: -e 's/\\u00ff/\xff/g' \ ohair@425: | sed -e '/^#/d' -e '/^$/d' \ ohair@425: -e :a -e '/\\$/N; s/\\\n//; ta' \ ohair@425: -e 's/^[ \t]*//;s/[ \t]*$//' \ ohair@425: -e 's/\\=/=/' | LANG=C sort > $OLD.cleaned ohair@425: TMP=$(LANG=C diff $OLD.cleaned $NEW) ohair@425: fi ohair@425: if test -n "$TMP"; then ohair@425: echo Files $OLD and $NEW differ ohair@425: fi