common/bin/compare.sh

Print this page


   1 #!/bin/bash
   2 #
   3 # Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
   4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5 #
   6 # This code is free software; you can redistribute it and/or modify it
   7 # under the terms of the GNU General Public License version 2 only, as
   8 # published by the Free Software Foundation.
   9 #
  10 # This code is distributed in the hope that it will be useful, but WITHOUT
  11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13 # version 2 for more details (a copy is included in the LICENSE file that
  14 # accompanied this code).
  15 #
  16 # You should have received a copy of the GNU General Public License version
  17 # 2 along with this work; if not, write to the Free Software Foundation,
  18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19 #
  20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21 # or visit www.oracle.com if you need additional information or have any
  22 # questions.
  23 #


  93     fi
  94     # Ignore date strings in class files.
  95     # On Macosx the system sources for generated java classes produce different output on 
  96     # consequtive invokations seemingly randomly.
  97     # For example a method parameter randomly named "thePoint" or "aPoint". Ignore this.
  98     if test "x$SUFFIX" = "xclass"; then
  99         # To improve performance when large diffs are found, do a rough filtering of classes
 100         # elibeble for these exceptions
 101         if $GREP -R -e '[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}' -e thePoint -e aPoint -e setItemsPtr ${THIS_FILE} > /dev/null; then
 102             $JAVAP -c -constants -l -p ${OTHER_FILE} >  ${OTHER_FILE}.javap
 103             $JAVAP -c -constants -l -p ${THIS_FILE} > ${THIS_FILE}.javap
 104             TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \
 105                 $GREP '^[<>]' | \
 106                 $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
 107                      -e '/[<>].*Point   Lcom\/apple\/jobjc\/foundation\/NSPoint;/d' \
 108                      -e '/[<>].*public com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*itemsPtr();/d' \
 109                      -e '/[<>].*public void setItemsPtr(com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*);/d')
 110         fi
 111     fi
 112     if test "x$SUFFIX" = "xproperties"; then
 113         $CAT $OTHER_FILE | $SED -e 's/\([^\\]\):/\1\\:/g' -e  's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \
 114             | $SED -f "$SRC_ROOT/common/makefiles/support/unicode2x.sed" \
 115             | $SED -e '/^#/d' -e '/^$/d' \
 116             -e :a -e '/\\$/N; s/\\\n//; ta' \
 117             -e 's/^[ \t]*//;s/[ \t]*$//' \
 118             -e 's/\\=/=/' | LANG=C $SORT > $OTHER_FILE.cleaned



 119         TMP=$(LANG=C $DIFF $OTHER_FILE.cleaned $THIS_FILE)
 120     fi
 121     if test -n "$TMP"; then
 122         echo Files $OTHER_FILE and $THIS_FILE differ
 123         return 1
 124     fi
 125 
 126     return 0
 127 }
 128 
 129 ##########################################################################################
 130 # Compare directory structure
 131 
 132 compare_dirs() {
 133     THIS_DIR=$1
 134     OTHER_DIR=$2
 135     WORK_DIR=$3
 136 
 137     mkdir -p $WORK_DIR
 138 


   1 #!/bin/bash
   2 #
   3 # Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved.
   4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5 #
   6 # This code is free software; you can redistribute it and/or modify it
   7 # under the terms of the GNU General Public License version 2 only, as
   8 # published by the Free Software Foundation.
   9 #
  10 # This code is distributed in the hope that it will be useful, but WITHOUT
  11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13 # version 2 for more details (a copy is included in the LICENSE file that
  14 # accompanied this code).
  15 #
  16 # You should have received a copy of the GNU General Public License version
  17 # 2 along with this work; if not, write to the Free Software Foundation,
  18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19 #
  20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21 # or visit www.oracle.com if you need additional information or have any
  22 # questions.
  23 #


  93     fi
  94     # Ignore date strings in class files.
  95     # On Macosx the system sources for generated java classes produce different output on 
  96     # consequtive invokations seemingly randomly.
  97     # For example a method parameter randomly named "thePoint" or "aPoint". Ignore this.
  98     if test "x$SUFFIX" = "xclass"; then
  99         # To improve performance when large diffs are found, do a rough filtering of classes
 100         # elibeble for these exceptions
 101         if $GREP -R -e '[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}' -e thePoint -e aPoint -e setItemsPtr ${THIS_FILE} > /dev/null; then
 102             $JAVAP -c -constants -l -p ${OTHER_FILE} >  ${OTHER_FILE}.javap
 103             $JAVAP -c -constants -l -p ${THIS_FILE} > ${THIS_FILE}.javap
 104             TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \
 105                 $GREP '^[<>]' | \
 106                 $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
 107                      -e '/[<>].*Point   Lcom\/apple\/jobjc\/foundation\/NSPoint;/d' \
 108                      -e '/[<>].*public com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*itemsPtr();/d' \
 109                      -e '/[<>].*public void setItemsPtr(com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*);/d')
 110         fi
 111     fi
 112     if test "x$SUFFIX" = "xproperties"; then
 113         # Run through nawk to add possibly missing newline at end of file.
 114         $CAT $OTHER_FILE | $NAWK '{ print }' > $OTHER_FILE.cleaned
 115 # Disable this exception since we aren't changing the properties cleaning method yet.
 116 #        $CAT $OTHER_FILE | $SED -e 's/\([^\\]\):/\1\\:/g' -e  's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \
 117 #            | $SED -f "$SRC_ROOT/common/makefiles/support/unicode2x.sed" \
 118 #           | $SED -e '/^#/d' -e '/^$/d' \
 119 #            -e :a -e '/\\$/N; s/\\\n//; ta' \
 120 #           -e 's/^[ \t]*//;s/[ \t]*$//' \
 121 #           -e 's/\\=/=/' | LANG=C $SORT > $OTHER_FILE.cleaned
 122         TMP=$(LANG=C $DIFF $OTHER_FILE.cleaned $THIS_FILE)
 123     fi
 124     if test -n "$TMP"; then
 125         echo Files $OTHER_FILE and $THIS_FILE differ
 126         return 1
 127     fi
 128 
 129     return 0
 130 }
 131 
 132 ##########################################################################################
 133 # Compare directory structure
 134 
 135 compare_dirs() {
 136     THIS_DIR=$1
 137     OTHER_DIR=$2
 138     WORK_DIR=$3
 139 
 140     mkdir -p $WORK_DIR
 141