common/bin/compare.sh
author erikj
Sat, 03 Nov 2012 16:28:14 -0700
changeset 14280 7d8ad47b2dbf
parent 14111 2a82ecb35fc7
child 14458 8e22b637770a
permissions -rw-r--r--
8002220: build-infra: update for mac, solaris 11 issues 8002184: Fixed exclude and includes for jarsigner in new build Reviewed-by: ohair
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     1
#!/bin/bash
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     2
#
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     3
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     4
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     5
#
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     6
# This code is free software; you can redistribute it and/or modify it
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     7
# under the terms of the GNU General Public License version 2 only, as
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     8
# published by the Free Software Foundation.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     9
#
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    10
# This code is distributed in the hope that it will be useful, but WITHOUT
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    11
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    12
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    13
# version 2 for more details (a copy is included in the LICENSE file that
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    14
# accompanied this code).
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    15
#
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    16
# You should have received a copy of the GNU General Public License version
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    17
# 2 along with this work; if not, write to the Free Software Foundation,
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    18
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    19
#
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    20
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    21
# or visit www.oracle.com if you need additional information or have any
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    22
# questions.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    23
#
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    24
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    25
# This script is processed by configure before it's usable. It is run from 
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    26
# the root of the build directory.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    27
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    28
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    29
##########################################################################################
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    30
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    31
# Check that we are run via the wrapper generated by configure
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    32
if [ -z "$SRC_ROOT" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    33
    echo "Error: You must run this script using build/[conf]/compare.sh"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    34
    exit 1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    35
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    36
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    37
if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    38
    FULLDUMP_CMD="$OTOOL -v -V -h -X -t -d"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    39
    LDD_CMD="$OTOOL -L"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    40
    DIS_CMD="$OTOOL -v -t"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    41
    STAT_PRINT_SIZE="-f %z"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    42
elif [ "$OPENJDK_TARGET_OS" = "windows" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    43
    FULLDUMP_CMD="$DUMPBIN -all"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    44
    LDD_CMD="$DUMPBIN -dependants | $GREP .dll"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    45
    DIS_CMD="$DUMPBIN -disasm:nobytes"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    46
    STAT_PRINT_SIZE="-c %s"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    47
else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    48
    FULLDUMP_CMD="$READELF -a"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    49
    LDD_CMD="$LDD"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    50
    DIS_CMD="$OBJDUMP -d"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    51
    STAT_PRINT_SIZE="-c %s"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    52
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    53
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    54
UNARCHIVE="$UNZIP -q"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    55
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    56
COMPARE_EXCEPTIONS_INCLUDE="$SRC_ROOT/common/bin/compare_exceptions.sh.incl"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    57
if [ ! -e "$COMPARE_EXCEPTIONS_INCLUDE" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    58
    echo "Error: Cannot locate the exceptions file, it should have been here: $COMPARE_EXCEPTIONS_INCLUDE"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    59
    exit 1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    60
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    61
# Include exception definitions
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    62
. "$COMPARE_EXCEPTIONS_INCLUDE"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    63
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    64
##########################################################################################
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    65
# Compare text files and ignore specific differences:
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    66
#
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    67
#  * Timestamps in Java sources generated by idl2java
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    68
#  * Sorting order and cleanup style in .properties files
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    69
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    70
diff_text() {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    71
    OTHER_FILE=$1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    72
    THIS_FILE=$2
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    73
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    74
    SUFFIX="${THIS_FILE##*.}"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    75
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    76
    TMP=1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    77
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    78
    if [[ "$THIS_FILE" = *"META-INF/MANIFEST.MF" ]]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    79
        TMP=$(LANG=C $DIFF $OTHER_FILE $THIS_FILE | \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    80
            $GREP '^[<>]' | \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    81
            $SED -e '/[<>] Ant-Version: Apache Ant .*/d' \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    82
	         -e '/[<>] Created-By: .* (Oracle Corporation).*/d')
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    83
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    84
    if test "x$SUFFIX" = "xjava"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    85
        TMP=$(LANG=C $DIFF $OTHER_FILE $THIS_FILE | \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    86
            $GREP '^[<>]' | \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    87
            $SED -e '/[<>] \* from.*\.idl/d' \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    88
                 -e '/[<>] \*.*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    89
                 -e '/[<>] \*.*[0-9]\{4\} [0-9][0-9]*:[0-9]\{2\}:[0-9]\{2\}.*/d' \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    90
                 -e '/\/\/ Generated from input file.*/d' \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    91
                 -e '/\/\/ This file was generated AUTOMATICALLY from a template file.*/d' \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    92
                 -e '/\/\/ java GenerateCharacter.*/d')
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    93
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    94
    # Ignore date strings in class files.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    95
    # On Macosx the system sources for generated java classes produce different output on 
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    96
    # consequtive invokations seemingly randomly.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    97
    # For example a method parameter randomly named "thePoint" or "aPoint". Ignore this.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    98
    if test "x$SUFFIX" = "xclass"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    99
        # To improve performance when large diffs are found, do a rough filtering of classes
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   100
        # elibeble for these exceptions
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   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
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   102
            $JAVAP -c -constants -l -p ${OTHER_FILE} >  ${OTHER_FILE}.javap
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   103
            $JAVAP -c -constants -l -p ${THIS_FILE} > ${THIS_FILE}.javap
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   104
            TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   105
                $GREP '^[<>]' | \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   106
                $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   107
 	             -e '/[<>].*Point   Lcom\/apple\/jobjc\/foundation\/NSPoint;/d' \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   108
	             -e '/[<>].*public com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*itemsPtr();/d' \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   109
	             -e '/[<>].*public void setItemsPtr(com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*);/d')
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   110
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   111
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   112
    if test "x$SUFFIX" = "xproperties"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   113
        $CAT $OTHER_FILE | $SED -e 's/\([^\\]\):/\1\\:/g' -e  's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   114
            | $SED -f "$SRC_ROOT/common/makefiles/support/unicode2x.sed" \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   115
  	    | $SED -e '/^#/d' -e '/^$/d' \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   116
            -e :a -e '/\\$/N; s/\\\n//; ta' \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   117
  	    -e 's/^[ \t]*//;s/[ \t]*$//' \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   118
	    -e 's/\\=/=/' | LANG=C $SORT > $OTHER_FILE.cleaned
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   119
        TMP=$(LANG=C $DIFF $OTHER_FILE.cleaned $THIS_FILE)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   120
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   121
    if test -n "$TMP"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   122
        echo Files $OTHER_FILE and $THIS_FILE differ
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   123
        return 1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   124
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   125
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   126
    return 0
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   127
}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   128
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   129
##########################################################################################
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   130
# Compare directory structure
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   131
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   132
compare_dirs() {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   133
    THIS_DIR=$1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   134
    OTHER_DIR=$2
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   135
    WORK_DIR=$3
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   136
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   137
    mkdir -p $WORK_DIR
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   138
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   139
    (cd $OTHER_DIR && $FIND . -type d | $SORT > $WORK_DIR/dirs_other)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   140
    (cd $THIS_DIR && $FIND . -type d | $SORT > $WORK_DIR/dirs_this)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   141
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   142
    $DIFF $WORK_DIR/dirs_other $WORK_DIR/dirs_other > $WORK_DIR/dirs_diff
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   143
    
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   144
    echo -n Directory structure...
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   145
    if [ -s $WORK_DIR/dirs_diff ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   146
        echo Differences found.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   147
        REGRESSIONS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   148
        # Differences in directories found.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   149
        ONLY_OTHER=$($GREP '<' $WORK_DIR/dirs_diff)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   150
        if [ "$ONLY_OTHER" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   151
            echo Only in $OTHER
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   152
            $GREP '<' $WORK_DIR/dirs_diff | $SED 's|< ./|    |g'
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   153
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   154
        ONLY_THIS=$($GREP '>' $WORK_DIR/dirs_diff)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   155
        if [ "$ONLY_THIS" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   156
            echo Only in $THIS
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   157
            $GREP '>' $WORK_DIR/dirs_diff | $SED 's|> ./|    |g'
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   158
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   159
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   160
        echo Identical!
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   161
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   162
}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   163
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   164
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   165
##########################################################################################
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   166
# Compare file structure
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   167
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   168
compare_files() {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   169
    THIS_DIR=$1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   170
    OTHER_DIR=$2
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   171
    WORK_DIR=$3
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   172
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   173
    $MKDIR -p $WORK_DIR
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   174
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   175
    (cd $OTHER_DIR && $FIND . ! -type d | $SORT > $WORK_DIR/files_other)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   176
    (cd $THIS_DIR && $FIND . ! -type d | $SORT > $WORK_DIR/files_this)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   177
    
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   178
    $DIFF $WORK_DIR/files_other $WORK_DIR/files_this > $WORK_DIR/files_diff
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   179
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   180
    echo -n File names...
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   181
    if [ -s $WORK_DIR/files_diff ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   182
        echo Differences found.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   183
        REGRESSIONS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   184
        # Differences in files found.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   185
        ONLY_OTHER=$($GREP '<' $WORK_DIR/files_diff)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   186
        if [ "$ONLY_OTHER" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   187
            echo Only in $OTHER
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   188
            $GREP '<' $WORK_DIR/files_diff | $SED 's|< ./|    |g'
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   189
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   190
        ONLY_THIS=$($GREP '>' $WORK_DIR/files_diff)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   191
        if [ "$ONLY_THIS" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   192
            echo Only in $THIS
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   193
            $GREP '>' $WORK_DIR/files_diff | $SED 's|> ./|    |g'
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   194
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   195
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   196
        echo Identical!
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   197
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   198
}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   199
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   200
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   201
##########################################################################################
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   202
# Compare permissions
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   203
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   204
compare_permissions() {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   205
    THIS_DIR=$1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   206
    OTHER_DIR=$2
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   207
    WORK_DIR=$3
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   208
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   209
    mkdir -p $WORK_DIR
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   210
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   211
    echo -n Permissions...
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   212
    found=""
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   213
    for f in `cd $OTHER_DIR && $FIND . -type f`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   214
    do
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   215
        if [ ! -f ${OTHER_DIR}/$f ]; then continue; fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   216
        if [ ! -f ${THIS_DIR}/$f ]; then continue; fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   217
        OP=`ls -l ${OTHER_DIR}/$f | awk '{printf("%.10s\n", $1);}'`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   218
        TP=`ls -l ${THIS_DIR}/$f | awk '{printf("%.10s\n", $1);}'`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   219
        if [ "$OP" != "$TP" ]
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   220
        then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   221
	    if [ -z "$found" ]; then echo ; found="yes"; fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   222
	    $PRINTF "\told: ${OP} new: ${TP}\t$f\n"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   223
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   224
    done
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   225
    if [ -z "$found" ]; then 
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   226
        echo "Identical!"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   227
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   228
        REGRESSIONS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   229
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   230
}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   231
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   232
##########################################################################################
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   233
# Compare file command output
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   234
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   235
compare_file_types() {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   236
    THIS_DIR=$1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   237
    OTHER_DIR=$2
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   238
    WORK_DIR=$3
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   239
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   240
    $MKDIR -p $WORK_DIR
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   241
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   242
    echo -n File types...
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   243
    found=""
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   244
    for f in `cd $OTHER_DIR && $FIND . ! -type d`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   245
    do
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   246
        if [ ! -f ${OTHER_DIR}/$f ]; then continue; fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   247
        if [ ! -f ${THIS_DIR}/$f ]; then continue; fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   248
        OF=`cd ${OTHER_DIR} && $FILE -h $f`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   249
        TF=`cd ${THIS_DIR} && $FILE -h $f`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   250
        if [ "$f" = "./src.zip" ] || [[ "$f" = *"/Home/src.zip" ]] || [[ "$f" = *"/lib/JObjC.jar" ]]
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   251
        then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   252
	    if [ "`echo $OF | $GREP -ic zip`" -gt 0 -a "`echo $TF | $GREP -ic zip`" -gt 0 ]
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   253
	    then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   254
	        # the way we produces zip-files make it so that directories are stored in old file
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   255
	        # but not in new (only files with full-path)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   256
	        # this makes file-5.09 report them as different
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   257
	        continue;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   258
	    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   259
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   260
        
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   261
        if [ "$OF" != "$TF" ]
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   262
        then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   263
	    if [ -z "$found" ]; then echo ; found="yes"; fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   264
	    $PRINTF "\tother: ${OF}\n\tthis : ${TF}\n"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   265
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   266
    done
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   267
    if [ -z "$found" ]; then 
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   268
        echo "Identical!"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   269
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   270
        REGRESSIONS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   271
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   272
}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   273
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   274
##########################################################################################
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   275
# Compare the rest of the files
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   276
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   277
compare_general_files() {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   278
    THIS_DIR=$1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   279
    OTHER_DIR=$2
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   280
    WORK_DIR=$3
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   281
    
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   282
    GENERAL_FILES=$(cd $THIS_DIR && $FIND . -type f ! -name "*.so" ! -name "*.jar" ! -name "*.zip" \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   283
        ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   284
        ! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   285
        ! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   286
        ! -name "*.lib" ! -name "*.war" \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   287
        | $GREP -v "./bin/"  | $SORT | $FILTER)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   288
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   289
    echo General files...
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   290
    for f in $GENERAL_FILES
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   291
    do
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   292
        if [ -e $OTHER_DIR/$f ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   293
            if [ "$(basename $f)" = "release" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   294
                # Ignore differences in change numbers in release file.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   295
                OTHER_FILE=$WORK_DIR/$f.other
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   296
                THIS_FILE=$WORK_DIR/$f.this
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   297
                $MKDIR -p $(dirname $OTHER_FILE)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   298
                $MKDIR -p $(dirname $THIS_FILE)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   299
                $CAT $OTHER_DIR/$f | $SED 's/\:[0-9a-f]\{12,12\}/:CHANGE/g' > $OTHER_FILE
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   300
                $CAT $THIS_DIR/$f  | $SED 's/\:[0-9a-f]\{12,12\}/:CHANGE/g' > $THIS_FILE
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   301
            else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   302
                OTHER_FILE=$OTHER_DIR/$f
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   303
                THIS_FILE=$THIS_DIR/$f
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   304
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   305
            DIFF_OUT=$($DIFF $OTHER_FILE $THIS_FILE 2>&1)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   306
            if [ -n "$DIFF_OUT" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   307
                echo $f
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   308
                REGRESSIONS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   309
                if [ "$SHOW_DIFFS" = "true" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   310
                    echo "$DIFF_OUT"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   311
                fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   312
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   313
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   314
    done
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   315
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   316
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   317
}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   318
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   319
##########################################################################################
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   320
# Compare zip file
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   321
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   322
compare_zip_file() {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   323
    THIS_DIR=$1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   324
    OTHER_DIR=$2
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   325
    WORK_DIR=$3
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   326
    ZIP_FILE=$4
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   327
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   328
    THIS_ZIP=$THIS_DIR/$ZIP_FILE
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   329
    OTHER_ZIP=$OTHER_DIR/$ZIP_FILE
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   330
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   331
    THIS_SUFFIX="${THIS_ZIP##*.}"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   332
    OTHER_SUFFIX="${OTHER_ZIP##*.}"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   333
    if [ "$THIS_SUFFIX" != "$OTHER_SUFFIX" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   334
        echo The files do not have the same suffix type!
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   335
        return 2
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   336
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   337
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   338
    TYPE="$THIS_SUFFIX"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   339
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   340
    if $CMP $OTHER_ZIP $THIS_ZIP > /dev/null
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   341
    then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   342
        return 0
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   343
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   344
    # Not quite identical, the might still contain the same data.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   345
    # Unpack the jar/zip files in temp dirs
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   346
    
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   347
    THIS_UNZIPDIR=$WORK_DIR/$ZIP_FILE.this
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   348
    OTHER_UNZIPDIR=$WORK_DIR/$ZIP_FILE.other
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   349
    $RM -rf $THIS_UNZIPDIR $OTHER_UNZIPDIR
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   350
    $MKDIR -p $THIS_UNZIPDIR
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   351
    $MKDIR -p $OTHER_UNZIPDIR
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   352
    (cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   353
    (cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   354
14280
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   355
    # Find all archives inside and unzip them as well to compare the contents rather than
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   356
    # the archives.
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   357
    EXCEPTIONS=""
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   358
    for pack in $($FIND $THIS_UNZIPDIR -name "*.pack" -o -name "*.pack.gz"); do
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   359
        ($UNPACK200 $pack $pack.jar)
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   360
        # Filter out the unzipped archives from the diff below.
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   361
        EXCEPTIONS="$EXCEPTIONS $pack $pack.jar"
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   362
    done
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   363
    for pack in $($FIND $OTHER_UNZIPDIR -name "*.pack" -o -name "*.pack.gz"); do
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   364
        ($UNPACK200 $pack $pack.jar)
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   365
        EXCEPTIONS="$EXCEPTIONS $pack $pack.jar"
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   366
    done
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   367
    for zip in $($FIND $THIS_UNZIPDIR -name "*.jar" -o -name "*.zip"); do
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   368
        $MKDIR $zip.unzip
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   369
        (cd $zip.unzip && $UNARCHIVE $zip)
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   370
        EXCEPTIONS="$EXCEPTIONS $zip"
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   371
    done
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   372
    for zip in $($FIND $OTHER_UNZIPDIR -name "*.jar" -o -name "*.zip"); do
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   373
        $MKDIR $zip.unzip
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   374
        (cd $zip.unzip && $UNARCHIVE $zip)
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   375
        EXCEPTIONS="$EXCEPTIONS $zip"
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   376
    done
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   377
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   378
    CONTENTS_DIFF_FILE=$WORK_DIR/$ZIP_FILE.diff
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   379
    # On solaris, there is no -q option.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   380
    if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   381
        LANG=C $DIFF -r $OTHER_UNZIPDIR $THIS_UNZIPDIR \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   382
            | $GREP -v -e "^<" -e "^>" -e "^Common subdirectories:" \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   383
            > $CONTENTS_DIFF_FILE
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   384
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   385
        LANG=C $DIFF -rq $OTHER_UNZIPDIR $THIS_UNZIPDIR > $CONTENTS_DIFF_FILE
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   386
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   387
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   388
    ONLY_OTHER=$($GREP "^Only in $OTHER_UNZIPDIR" $CONTENTS_DIFF_FILE)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   389
    ONLY_THIS=$($GREP "^Only in $THIS_UNZIPDIR" $CONTENTS_DIFF_FILE)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   390
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   391
    return_value=0
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   392
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   393
    if [ -n "$ONLY_OTHER" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   394
        echo "        Only OTHER $ZIP_FILE contains:"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   395
        echo "$ONLY_OTHER" | sed "s|Only in $OTHER_UNZIPDIR|            |"g | sed 's|: |/|g'
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   396
        return_value=1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   397
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   398
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   399
    if [ -n "$ONLY_THIS" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   400
        echo "        Only THIS $ZIP_FILE contains:"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   401
        echo "$ONLY_THIS" | sed "s|Only in $THIS_UNZIPDIR|            |"g | sed 's|: |/|g'
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   402
        return_value=1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   403
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   404
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   405
    if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   406
        DIFFING_FILES=$($GREP -e "differ$" -e "^diff " $CONTENTS_DIFF_FILE \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   407
            | $CUT -f 3 -d ' ' | $SED "s|$OTHER_UNZIPDIR/||g")
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   408
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   409
        DIFFING_FILES=$($GREP -e "differ$" $CONTENTS_DIFF_FILE \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   410
            | $CUT -f 2 -d ' ' | $SED "s|$OTHER_UNZIPDIR/||g")
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   411
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   412
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   413
    $RM -f $WORK_DIR/$ZIP_FILE.diffs
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   414
    for file in $DIFFING_FILES; do
14280
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   415
	if [[ "$ACCEPTED_JARZIP_CONTENTS $EXCEPTIONS" != *"$file"* ]]; then
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   416
            diff_text $OTHER_UNZIPDIR/$file $THIS_UNZIPDIR/$file >> $WORK_DIR/$ZIP_FILE.diffs
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   417
	fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   418
    done
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   419
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   420
    if [ -s "$WORK_DIR/$ZIP_FILE.diffs" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   421
        return_value=1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   422
        echo "        Differing files in $ZIP_FILE"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   423
        $CAT $WORK_DIR/$ZIP_FILE.diffs | $GREP differ | cut -f 2 -d ' ' | \
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   424
            $SED "s|$OTHER_UNZIPDIR|            |g" > $WORK_DIR/$ZIP_FILE.difflist
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   425
        $CAT $WORK_DIR/$ZIP_FILE.difflist
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   426
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   427
        if [ -n "$SHOW_DIFFS" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   428
            for i in $(cat $WORK_DIR/$ZIP_FILE.difflist) ; do
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   429
                if [ -f "${OTHER_UNZIPDIR}/$i.javap" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   430
                    LANG=C $DIFF ${OTHER_UNZIPDIR}/$i.javap ${THIS_UNZIPDIR}/$i.javap
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   431
                elif [ -f "${OTHER_UNZIPDIR}/$i.cleaned" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   432
                    LANG=C $DIFF ${OTHER_UNZIPDIR}/$i.cleaned ${THIS_UNZIPDIR}/$i
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   433
                else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   434
                    LANG=C $DIFF ${OTHER_UNZIPDIR}/$i ${THIS_UNZIPDIR}/$i
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   435
                fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   436
            done
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   437
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   438
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   439
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   440
    return $return_value
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   441
}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   442
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   443
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   444
##########################################################################################
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   445
# Compare all zip files
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   446
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   447
compare_all_zip_files() {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   448
    THIS_DIR=$1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   449
    OTHER_DIR=$2
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   450
    WORK_DIR=$3
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   451
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   452
    ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.zip" | $SORT | $FILTER )
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   453
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   454
    if [ -n "$ZIPS" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   455
        echo Zip files...
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   456
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   457
        return_value=0
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   458
        for f in $ZIPS; do
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   459
            if [ -f "$OTHER_DIR/$f" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   460
                compare_zip_file $THIS_DIR $OTHER_DIR $WORK_DIR $f
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   461
                if [ "$?" != "0" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   462
                    return_value=1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   463
                    REGRESSIONS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   464
                fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   465
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   466
        done
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   467
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   468
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   469
    return $return_value
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   470
}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   471
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   472
##########################################################################################
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   473
# Compare all jar files
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   474
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   475
compare_all_jar_files() {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   476
    THIS_DIR=$1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   477
    OTHER_DIR=$2
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   478
    WORK_DIR=$3
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   479
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   480
    # TODO filter?
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   481
    ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.jar" -o -name "*.war" | $SORT | $FILTER)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   482
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   483
    if [ -n "$ZIPS" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   484
        echo Jar files...
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   485
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   486
        return_value=0
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   487
        for f in $ZIPS; do
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   488
            if [ -f "$OTHER_DIR/$f" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   489
                compare_zip_file $THIS_DIR $OTHER_DIR $WORK_DIR $f
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   490
                if [ "$?" != "0" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   491
                    return_value=1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   492
                    REGRESSIONS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   493
                fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   494
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   495
        done
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   496
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   497
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   498
    return $return_value
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   499
}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   500
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   501
##########################################################################################
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   502
# Compare binary (executable/library) file
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   503
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   504
compare_bin_file() {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   505
    THIS_DIR=$1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   506
    OTHER_DIR=$2
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   507
    WORK_DIR=$3
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   508
    BIN_FILE=$4
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   509
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   510
    THIS_FILE=$THIS_DIR/$BIN_FILE
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   511
    OTHER_FILE=$OTHER_DIR/$BIN_FILE
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   512
    NAME=$(basename $BIN_FILE)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   513
    WORK_FILE_BASE=$WORK_DIR/$BIN_FILE
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   514
    FILE_WORK_DIR=$(dirname $WORK_FILE_BASE)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   515
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   516
    $MKDIR -p $FILE_WORK_DIR
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   517
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   518
    ORIG_THIS_FILE="$THIS_FILE"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   519
    ORIG_OTHER_FILE="$OTHER_FILE"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   520
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   521
    if [[ "$STRIP_BEFORE_COMPARE" = *"$BIN_FILE"* ]]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   522
        THIS_STRIPPED_FILE=$FILE_WORK_DIR/this/$NAME
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   523
        OTHER_STRIPPED_FILE=$FILE_WORK_DIR/other/$NAME
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   524
        $MKDIR -p $FILE_WORK_DIR/this $FILE_WORK_DIR/other
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   525
        $CP $THIS_FILE $THIS_STRIPPED_FILE
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   526
        $CP $OTHER_FILE $OTHER_STRIPPED_FILE
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   527
        $STRIP $THIS_STRIPPED_FILE
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   528
        $STRIP $OTHER_STRIPPED_FILE
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   529
        THIS_FILE="$THIS_STRIPPED_FILE"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   530
        OTHER_FILE="$OTHER_STRIPPED_FILE"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   531
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   532
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   533
    if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   534
	unset _NT_SYMBOL_PATH
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   535
	# On windows we need to unzip the debug symbols, if present
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   536
	OTHER_FILE_BASE=${OTHER_FILE/.dll/}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   537
	OTHER_FILE_BASE=${OTHER_FILE_BASE/.exe/}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   538
	DIZ_NAME=$(basename $OTHER_FILE_BASE).diz
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   539
        # java.exe and java.dll diz files will have the same name. Have to
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   540
	# make sure java.exe gets the right one. This is only needed for 
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   541
	# OTHER since in the new build, all pdb files are left around.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   542
	if [ "$NAME" = "java.exe" ] && [ -f "$OTHER/tmp/java/java/obj64/java.diz" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   543
	    OTHER_DIZ_FILE="$OTHER/tmp/java/java/obj64/java.diz"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   544
	elif [ -f "${OTHER_FILE_BASE}.diz" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   545
	    OTHER_DIZ_FILE=${OTHER_FILE_BASE}.diz
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   546
	else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   547
            # Some files, jli.dll, appears twice in the image but only one of
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   548
	    # thme has a diz file next to it.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   549
	    OTHER_DIZ_FILE="$($FIND $OTHER_DIR -name $DIZ_NAME | $SED 1q)"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   550
	    if [ ! -f "$OTHER_DIZ_FILE" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   551
		# As a last resort, look for diz file in the whole build output
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   552
		# dir.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   553
		OTHER_DIZ_FILE="$($FIND $OTHER -name $DIZ_NAME | $SED 1q)"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   554
	    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   555
	fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   556
	if [ -n "$OTHER_DIZ_FILE" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   557
	    $MKDIR -p $FILE_WORK_DIR/other
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   558
	    (cd $FILE_WORK_DIR/other ; $UNARCHIVE -o $OTHER_DIZ_FILE)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   559
	    export _NT_SYMBOL_PATH="$FILE_WORK_DIR/other"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   560
	fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   561
	THIS_FILE_BASE=${THIS_FILE/.dll/}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   562
	THIS_FILE_BASE=${THIS_FILE_BASE/.exe/}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   563
	if [ -f "${THIS_FILE/.dll/}.diz" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   564
	    THIS_DIZ_FILE=${THIS_FILE/.dll/}.diz
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   565
	else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   566
	    THIS_DIZ_FILE="$($FIND $THIS_DIR -name $DIZ_NAME | $SED 1q)"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   567
	    if [ ! -f "$THIS_DIZ_FILE" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   568
		# As a last resort, look for diz file in the whole build output
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   569
		# dir.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   570
		THIS_DIZ_FILE="$($FIND $THIS -name $DIZ_NAME | $SED 1q)"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   571
	    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   572
	fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   573
	if [ -n "$THIS_DIZ_FILE" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   574
	    $MKDIR -p $FILE_WORK_DIR/this
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   575
	    (cd $FILE_WORK_DIR/this ; $UNARCHIVE -o $THIS_DIZ_FILE)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   576
	    export _NT_SYMBOL_PATH="$_NT_SYMBOL_PATH;$FILE_WORK_DIR/this"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   577
	fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   578
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   579
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   580
    if [ -z "$SKIP_BIN_DIFF" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   581
        if cmp $OTHER_FILE $THIS_FILE > /dev/null; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   582
        # The files were bytewise identical.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   583
            if [ -n "$VERBOSE" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   584
                echo "        :           :         :         :          : $BIN_FILE"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   585
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   586
            return 0
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   587
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   588
        BIN_MSG=" diff "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   589
        if [[ "$ACCEPTED_BIN_DIFF" != *"$BIN_FILE"* ]]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   590
            DIFF_BIN=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   591
            if [[ "$KNOWN_BIN_DIFF" != *"$BIN_FILE"* ]]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   592
                BIN_MSG="*$BIN_MSG*"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   593
                REGRESSIONS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   594
            else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   595
                BIN_MSG=" $BIN_MSG "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   596
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   597
        else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   598
            BIN_MSG="($BIN_MSG)"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   599
            DIFF_BIN=
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   600
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   601
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   602
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   603
    if [ -n "$STAT" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   604
        THIS_SIZE=$($STAT $STAT_PRINT_SIZE "$THIS_FILE")
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   605
        OTHER_SIZE=$($STAT $STAT_PRINT_SIZE "$OTHER_FILE")
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   606
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   607
        THIS_SIZE=$(ls -l "$THIS_FILE" | awk '{ print $5 }')
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   608
        OTHER_SIZE=$(ls -l "$OTHER_FILE" | awk '{ print $5 }')
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   609
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   610
    if [ $THIS_SIZE -ne $OTHER_SIZE ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   611
        DIFF_SIZE_NUM=$($EXPR $THIS_SIZE - $OTHER_SIZE)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   612
        DIFF_SIZE_REL=$($EXPR $THIS_SIZE \* 100 / $OTHER_SIZE)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   613
        SIZE_MSG=$($PRINTF "%3d%% %4d" $DIFF_SIZE_REL $DIFF_SIZE_NUM)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   614
        if [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] && [ "$DIFF_SIZE_REL" -gt 98 ] && [ "$DIFF_SIZE_REL" -lt 102 ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   615
            SIZE_MSG="($SIZE_MSG)"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   616
            DIFF_SIZE=
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   617
        elif [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] && [ "$DIFF_SIZE_NUM" = 512 ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   618
	    # On windows, size of binaries increase in 512 increments.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   619
            SIZE_MSG="($SIZE_MSG)"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   620
            DIFF_SIZE=
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   621
        else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   622
            if [[ "$ACCEPTED_SIZE_DIFF" != *"$BIN_FILE"* ]]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   623
                DIFF_SIZE=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   624
                if [[ "$KNOWN_SIZE_DIFF" != *"$BIN_FILE"* ]]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   625
                    SIZE_MSG="*$SIZE_MSG*"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   626
                    REGRESSIONS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   627
                else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   628
                    SIZE_MSG=" $SIZE_MSG "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   629
                fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   630
            else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   631
                SIZE_MSG="($SIZE_MSG)"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   632
                DIFF_SIZE=
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   633
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   634
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   635
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   636
        SIZE_MSG="           "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   637
        DIFF_SIZE=
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   638
        if [[ "$KNOWN_SIZE_DIFF $ACCEPTED_SIZE_DIFF" = *"$BIN_FILE"* ]]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   639
            SIZE_MSG="     !     "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   640
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   641
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   642
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   643
    if [[ "$SORT_SYMBOLS" = *"$BIN_FILE"* ]]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   644
        SYM_SORT_CMD="sort"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   645
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   646
        SYM_SORT_CMD="cat"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   647
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   648
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   649
    # Check symbols
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   650
    if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   651
        # The output from dumpbin on windows differs depending on if the debug symbol
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   652
        # files are still around at the location the binary is pointing too. Need
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   653
	# to filter out that extra information.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   654
	$DUMPBIN -exports $OTHER_FILE | $GREP  -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   655
	$DUMPBIN -exports $THIS_FILE  | $GREP  -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   656
    elif [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   657
        # Some symbols get seemingly random 15 character prefixes. Filter them out.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   658
        $NM -a $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SED 's/^\([a-zA-Z] [\.\$]\)[a-zA-Z0-9_\$]\{15,15\}\./\1./g' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   659
	$NM -a $ORIG_THIS_FILE  2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SED 's/^\([a-zA-Z] [\.\$]\)[a-zA-Z0-9_\$]\{15,15\}\./\1./g' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   660
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   661
	$NM -a $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   662
	$NM -a $ORIG_THIS_FILE  2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   663
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   664
    
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   665
    LANG=C $DIFF $WORK_FILE_BASE.symbols.other $WORK_FILE_BASE.symbols.this > $WORK_FILE_BASE.symbols.diff
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   666
    if [ -s $WORK_FILE_BASE.symbols.diff ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   667
        SYM_MSG=" diff  "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   668
        if [[ "$ACCEPTED_SYM_DIFF" != *"$BIN_FILE"* ]]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   669
            DIFF_SYM=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   670
            if [[ "$KNOWN_SYM_DIFF" != *"$BIN_FILE"* ]]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   671
                SYM_MSG="*$SYM_MSG*"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   672
                REGRESSIONS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   673
            else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   674
                SYM_MSG=" $SYM_MSG "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   675
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   676
        else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   677
            SYM_MSG="($SYM_MSG)"            
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   678
            DIFF_SYM=
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   679
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   680
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   681
        SYM_MSG="         "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   682
        DIFF_SYM=
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   683
        if [[ "$KNOWN_SYM_DIFF $ACCEPTED_SYM_DIFF" = *"$BIN_FILE"* ]]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   684
            SYM_MSG="    !    "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   685
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   686
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   687
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   688
    # Check dependencies
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   689
    if [ -n "$LDD_CMD" ]; then
14280
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   690
	(cd $FILE_WORK_DIR && $CP $OTHER_FILE . && $LDD_CMD $NAME 2>/dev/null | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.other | $UNIQ > $WORK_FILE_BASE.deps.other.uniq)
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   691
	(cd $FILE_WORK_DIR && $CP $THIS_FILE . && $LDD_CMD $NAME 2</dev/null | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.this | $UNIQ > $WORK_FILE_BASE.deps.this.uniq)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   692
	(cd $FILE_WORK_DIR && $RM -f $NAME)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   693
	
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   694
	LANG=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this > $WORK_FILE_BASE.deps.diff
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   695
	LANG=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq > $WORK_FILE_BASE.deps.diff.uniq
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   696
	
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   697
	if [ -s $WORK_FILE_BASE.deps.diff ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   698
            if [ -s $WORK_FILE_BASE.deps.diff.uniq ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   699
		DEP_MSG=" diff  "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   700
            else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   701
		DEP_MSG=" redun "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   702
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   703
            if [[ "$ACCEPTED_DEP_DIFF" != *"$BIN_FILE"* ]]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   704
		DIFF_DEP=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   705
		if [[ "$KNOWN_DEP_DIFF" != *"$BIN_FILE"* ]]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   706
                    DEP_MSG="*$DEP_MSG*"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   707
                    REGRESSIONS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   708
		else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   709
                    DEP_MSG=" $DEP_MSG "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   710
		fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   711
            else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   712
		DEP_MSG="($DEP_MSG)"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   713
		DIFF_DEP=
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   714
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   715
	else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   716
	    DEP_MSG="         "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   717
	    DIFF_DEP=
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   718
            if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   719
                DEP_MSG="     !      "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   720
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   721
	fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   722
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   723
	DEP_MSG="    -    "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   724
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   725
    
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   726
    # Compare fulldump output
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   727
    if [ -n "$FULLDUMP_CMD" ] && [ -z "$SKIP_FULLDUMP_DIFF" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   728
        $FULLDUMP_CMD $OTHER_FILE > $WORK_FILE_BASE.fulldump.other 2>&1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   729
        $FULLDUMP_CMD $THIS_FILE > $WORK_FILE_BASE.fulldump.this 2>&1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   730
        LANG=C $DIFF $WORK_FILE_BASE.fulldump.other $WORK_FILE_BASE.fulldump.this > $WORK_FILE_BASE.fulldump.diff
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   731
        
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   732
        if [ -s $WORK_FILE_BASE.fulldump.diff ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   733
            ELF_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.fulldump.diff | awk '{print $5}')
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   734
            ELF_MSG=$($PRINTF "%8d" $ELF_DIFF_SIZE)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   735
            if [[ "$ACCEPTED_ELF_DIFF" != *"$BIN_FILE"* ]]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   736
                DIFF_ELF=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   737
                if [[ "$KNOWN_ELF_DIFF" != *"$BIN_FILE"* ]]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   738
                    ELF_MSG="*$ELF_MSG*"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   739
                    REGRESSIONS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   740
                else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   741
                    ELF_MSG=" $ELF_MSG "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   742
                fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   743
            else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   744
                ELF_MSG="($ELF_MSG)"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   745
                DIFF_ELF=
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   746
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   747
        else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   748
            ELF_MSG="          "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   749
            DIFF_ELF=
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   750
            if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   751
                ELF_MSG="    !    "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   752
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   753
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   754
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   755
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   756
    # Compare disassemble output
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   757
    if [ -n "$DIS_CMD" ] && [ -z "$SKIP_DIS_DIFF" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   758
	if [ -z "$DIS_DIFF_FILTER" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   759
	    DIS_DIFF_FILTER="$CAT"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   760
	fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   761
        $DIS_CMD $OTHER_FILE | $GREP -v $NAME | $DIS_DIFF_FILTER > $WORK_FILE_BASE.dis.other 2>&1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   762
        $DIS_CMD $THIS_FILE  | $GREP -v $NAME | $DIS_DIFF_FILTER > $WORK_FILE_BASE.dis.this  2>&1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   763
        
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   764
        LANG=C $DIFF $WORK_FILE_BASE.dis.other $WORK_FILE_BASE.dis.this > $WORK_FILE_BASE.dis.diff
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   765
        
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   766
        if [ -s $WORK_FILE_BASE.dis.diff ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   767
            DIS_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.dis.diff | awk '{print $5}')
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   768
            DIS_MSG=$($PRINTF "%8d" $DIS_DIFF_SIZE)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   769
            if [[ "$ACCEPTED_DIS_DIFF" != *"$BIN_FILE"* ]]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   770
                DIFF_DIS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   771
                if [[ "$KNOWN_DIS_DIFF" != *"$BIN_FILE"* ]]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   772
                    DIS_MSG="*$DIS_MSG*"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   773
                    REGRESSIONS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   774
                else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   775
                    DIS_MSG=" $DIS_MSG "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   776
                fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   777
            else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   778
                DIS_MSG="($DIS_MSG)"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   779
                DIFF_DIS=
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   780
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   781
        else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   782
            DIS_MSG="          "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   783
            DIFF_DIS=
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   784
            if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   785
                DIS_MSG="    !    "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   786
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   787
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   788
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   789
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   790
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   791
    if [ -n "$DIFF_BIN$DIFF_SIZE$DIFF_SYM$DIFF_DEP$DIFF_ELF$DIFF_DIS" ] || [ -n "$VERBOSE" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   792
        if [ -n "$BIN_MSG" ]; then echo -n "$BIN_MSG:"; fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   793
        if [ -n "$SIZE_MSG" ]; then echo -n "$SIZE_MSG:"; fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   794
        if [ -n "$SYM_MSG" ]; then echo -n "$SYM_MSG:"; fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   795
        if [ -n "$DEP_MSG" ]; then echo -n "$DEP_MSG:"; fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   796
        if [ -n "$ELF_MSG" ]; then echo -n "$ELF_MSG:"; fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   797
        if [ -n "$DIS_MSG" ]; then echo -n "$DIS_MSG:"; fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   798
        echo " $BIN_FILE"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   799
        if [ "$SHOW_DIFFS" = "true" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   800
            if [ -s "$WORK_FILE_BASE.symbols.diff" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   801
                echo "Symbols diff:"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   802
                $CAT $WORK_FILE_BASE.symbols.diff
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   803
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   804
            if [ -s "$WORK_FILE_BASE.deps.diff" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   805
                echo "Deps diff:"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   806
                $CAT $WORK_FILE_BASE.deps.diff
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   807
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   808
            if [ -s "$WORK_FILE_BASE.fulldump.diff" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   809
                echo "Fulldump diff:"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   810
                $CAT $WORK_FILE_BASE.fulldump.diff
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   811
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   812
            if [ -s "$WORK_FILE_BASE.dis.diff" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   813
                echo "Disassembly diff:"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   814
                $CAT $WORK_FILE_BASE.dis.diff
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   815
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   816
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   817
        return 1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   818
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   819
    return 0
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   820
}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   821
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   822
##########################################################################################
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   823
# Print binary diff header
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   824
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   825
print_binary_diff_header() {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   826
    if [ -z "$SKIP_BIN_DIFF" ]; then echo -n " Binary :"; fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   827
    if [ -z "$SKIP_SIZE_DIFF" ]; then echo -n "   Size    :"; fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   828
    if [ -z "$SKIP_SYM_DIFF" ]; then echo -n " Symbols :"; fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   829
    if [ -z "$SKIP_DEP_DIFF" ]; then echo -n "  Deps   :"; fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   830
    if [ -z "$SKIP_FULLDUMP_DIFF" ]; then echo -n " Fulldump :"; fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   831
    if [ -z "$SKIP_DIS_DIFF" ]; then echo -n " Disass   :"; fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   832
    echo
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   833
}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   834
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   835
##########################################################################################
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   836
# Compare all libraries
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   837
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   838
compare_all_libs() {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   839
    THIS_DIR=$1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   840
    OTHER_DIR=$2
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   841
    WORK_DIR=$3
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   842
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   843
    LIBS=$(cd $THIS_DIR && $FIND . -type f \( -name 'lib*.so' -o -name '*.dylib' -o -name '*.dll' \) | $SORT | $FILTER)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   844
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   845
    if [ -n "$LIBS" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   846
        echo Libraries...
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   847
        print_binary_diff_header
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   848
        for l in $LIBS; do
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   849
            if [ -f "$OTHER_DIR/$l" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   850
                compare_bin_file $THIS_DIR $OTHER_DIR $WORK_DIR $l
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   851
                if [ "$?" != "0" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   852
                    return_value=1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   853
                fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   854
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   855
        done
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   856
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   857
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   858
    return $return_value
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   859
}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   860
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   861
##########################################################################################
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   862
# Compare all executables
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   863
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   864
compare_all_execs() {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   865
    THIS_DIR=$1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   866
    OTHER_DIR=$2
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   867
    WORK_DIR=$3
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   868
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   869
    if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   870
        EXECS=$(cd $THIS_DIR && $FIND . -type f -name '*.exe' | $SORT | $FILTER)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   871
    else
14280
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   872
        EXECS=$(cd $THIS_DIR && $FIND . -name db -prune -o -type f -perm -100 \! \
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   873
            \( -name '*.so' -o -name '*.dylib' -o -name '*.dll' -o -name '*.cgi' \
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   874
            -o -name '*.jar' -o -name '*.diz' -o -name 'jcontrol' -o -name '*.properties' \
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   875
            -o -name '*.data' -o -name '*.bfc' -o -name '*.src' -o -name '*.txt' \
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   876
            -o -name '*.cfg' -o -name 'meta-index' -o -name '*.properties.ja' \
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
   877
            -o -name 'classlist' \) | $SORT | $FILTER)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   878
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   879
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   880
    if [ -n "$EXECS" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   881
        echo Executables...
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   882
        print_binary_diff_header
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   883
        for e in $EXECS; do
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   884
            if [ -f "$OTHER_DIR/$e" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   885
                compare_bin_file $THIS_DIR $OTHER_DIR $WORK_DIR $e
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   886
                if [ "$?" != "0" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   887
                    return_value=1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   888
                fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   889
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   890
        done
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   891
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   892
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   893
    return $return_value
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   894
}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   895
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   896
##########################################################################################
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   897
# Initiate configuration
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   898
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   899
COMPARE_ROOT=/tmp/cimages.$USER
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   900
$MKDIR -p $COMPARE_ROOT
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   901
if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   902
    if [ "$(uname -o)" = "Cygwin" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   903
	COMPARE_ROOT=$(cygpath -msa $COMPARE_ROOT)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   904
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   905
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   906
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   907
THIS="$( cd "$( dirname "$0" )" && pwd )"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   908
echo "$THIS"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   909
THIS_SCRIPT="$0"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   910
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   911
if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "-?" ] || [ "$1" = "/h" ] || [ "$1" = "/?" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   912
    echo "bash ./compare.sh [OPTIONS] [FILTER]"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   913
    echo ""
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   914
    echo "-all                Compare all files in all known ways"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   915
    echo "-names              Compare the file names and directory structure"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   916
    echo "-perms              Compare the permission bits on all files and directories"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   917
    echo "-types              Compare the output of the file command on all files"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   918
    echo "-general            Compare the files not convered by the specialized comparisons"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   919
    echo "-zips               Compare the contents of all zip files"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   920
    echo "-jars               Compare the contents of all jar files"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   921
    echo "-libs               Compare all native libraries"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   922
    echo "-execs              Compare all executables"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   923
    echo "-v                  Verbose output, does not hide known differences"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   924
    echo "-vv                 More verbose output, shows diff output of all comparisons"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   925
    echo "-o [OTHER]          Compare with build in other directory. Will default to the old build directory"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   926
    echo ""
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   927
    echo "[FILTER]            List filenames in the image to compare, works for jars, zips, libs and execs"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   928
    echo "Example:"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   929
    echo "bash ./common/bin/compareimages.sh CodePointIM.jar"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   930
    exit 10
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   931
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   932
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   933
CMP_NAMES=false
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   934
CMP_PERMS=false
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   935
CMP_TYPES=false
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   936
CMP_GENERAL=false
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   937
CMP_ZIPS=false
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   938
CMP_JARS=false
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   939
CMP_LIBS=false
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   940
CMP_EXECS=false
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   941
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   942
while [ -n "$1" ]; do
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   943
    case "$1" in
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   944
        -v)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   945
            VERBOSE=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   946
            ;;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   947
        -vv)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   948
            VERBOSE=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   949
            SHOW_DIFFS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   950
            ;;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   951
        -o)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   952
            OTHER="$2"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   953
            shift
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   954
            ;;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   955
        -all)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   956
            CMP_NAMES=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   957
            if [ "$OPENJDK_TARGET_OS" != "windows" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   958
                CMP_PERMS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   959
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   960
            CMP_TYPES=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   961
            CMP_GENERAL=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   962
            CMP_ZIPS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   963
            CMP_JARS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   964
            CMP_LIBS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   965
            CMP_EXECS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   966
            ;;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   967
        -names)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   968
            CMP_NAMES=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   969
            ;;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   970
        -perms)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   971
            CMP_PERMS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   972
            ;;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   973
        -types)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   974
            CMP_TYPES=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   975
            ;;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   976
        -general)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   977
            CMP_GENERAL=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   978
            ;;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   979
        -zips)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   980
            CMP_ZIPS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   981
            ;;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   982
        -jars)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   983
            CMP_JARS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   984
            ;;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   985
        -libs)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   986
            CMP_LIBS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   987
            ;;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   988
        -execs)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   989
            CMP_EXECS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   990
            ;;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   991
        *)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   992
            CMP_NAMES=false
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   993
            CMP_PERMS=false
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   994
            CMP_TYPES=false
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   995
            CMP_ZIPS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   996
            CMP_JARS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   997
            CMP_LIBS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   998
            CMP_EXECS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   999
            
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1000
            if [ -z "$FILTER" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1001
                FILTER="$GREP"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1002
            fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1003
            FILTER="$FILTER -e $1"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1004
            ;;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1005
    esac
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1006
    shift
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1007
done
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1008
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1009
if [ "$CMP_NAMES" = "false" ] && [ "$CMP_TYPES" = "false" ] && [ "$CMP_PERMS" = "false" ] && [ "$CMP_GENERAL" = "false" ] && [ "$CMP_ZIPS" = "false" ] && [ "$CMP_JARS" = "false" ] && [ "$CMP_LIBS" = "false" ] && [ "$CMP_EXECS" = "false" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1010
    CMP_NAMES=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1011
    CMP_PERMS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1012
    CMP_TYPES=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1013
    CMP_GENERAL=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1014
    CMP_ZIPS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1015
    CMP_JARS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1016
    CMP_LIBS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1017
    CMP_EXECS=true
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1018
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1019
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1020
if [ -z "$FILTER" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1021
    FILTER="$CAT"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1022
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1023
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1024
if [ -z "$OTHER" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1025
    OTHER="$THIS/../$LEGACY_BUILD_DIR"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1026
    if [ -d "$OTHER" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1027
        OTHER="$( cd "$OTHER" && pwd )"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1028
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1029
        echo "Default old build directory does not exist:"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1030
        echo "$OTHER"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1031
        exit 1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1032
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1033
    echo "Comparing to default old build:"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1034
    echo "$OTHER"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1035
    echo
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1036
else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1037
    if [ ! -d "$OTHER" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1038
        echo "Other build directory does not exist:"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1039
        echo "$OTHER"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1040
        exit 1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1041
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1042
    OTHER="$( cd "$OTHER" && pwd )"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1043
    echo "Comparing to:"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1044
    echo "$OTHER"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1045
    echo
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1046
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1047
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1048
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1049
# Figure out the layout of the this build. Which kinds of images have been produced
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1050
if [ -d "$THIS/deploy/j2sdk-image" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1051
    THIS_J2SDK="$THIS/deploy/j2sdk-image"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1052
    THIS_J2RE="$THIS/deploy/j2re-image"
14280
7d8ad47b2dbf 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14111
diff changeset
  1053
    echo "Comparing deploy images"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1054
elif [ -d "$THIS/images/j2sdk-image" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1055
    THIS_J2SDK="$THIS/images/j2sdk-image"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1056
    THIS_J2RE="$THIS/images/j2re-image"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1057
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1058
if [ -d "$THIS/images/j2sdk-overlay-image" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1059
    THIS_J2SDK_OVERLAY="$THIS/images/j2sdk-overlay-image"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1060
    THIS_J2RE_OVERLAY="$THIS/images/j2re-overlay-image"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1061
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1062
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1063
if [ -d "$THIS/images/j2sdk-bundle" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1064
    THIS_J2SDK_BUNDLE="$THIS/images/j2sdk-bundle"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1065
    THIS_J2RE_BUNDLE="$THIS/images/j2re-bundle"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1066
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1067
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1068
# Figure out the layout of the other build (old or new, normal or overlay image)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1069
if [ -d "$OTHER/j2sdk-image" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1070
    if [ -f "$OTHER/j2sdk-image/LICENSE" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1071
        OTHER_J2SDK="$OTHER/j2sdk-image"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1072
        OTHER_J2RE="$OTHER/j2re-image"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1073
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1074
        OTHER_J2SDK_OVERLAY="$OTHER/j2sdk-image"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1075
        OTHER_J2RE_OVERLAY="$OTHER/j2re-image"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1076
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1077
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1078
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1079
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1080
if [ -d "$OTHER/j2sdk-bundle" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1081
    OTHER_J2SDK_BUNDLE="$OTHER/j2sdk-bundle"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1082
    OTHER_J2RE_BUNDLE="$OTHER/j2re-bundle"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1083
elif [ -d "$OTHER/images/j2sdk-bundle" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1084
    OTHER_J2SDK_BUNDLE="$OTHER/images/j2sdk-bundle"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1085
    OTHER_J2RE_BUNDLE="$OTHER/images/j2re-bundle"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1086
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1087
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1088
if [ -z "$THIS_J2SDK" ] || [ -z "$THIS_J2RE" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1089
    if [ -z "$THIS_J2SDK_OVERLAY" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1090
        echo "Cannot locate images for this build. Are you sure you have run 'make images'?"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1091
        exit 1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1092
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1093
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1094
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1095
if [ -z "$OTHER_J2SDK" ] && [ -n "$OTHER_J2SDK_OVERLAY" ] && [ -z "$THIS_J2SDK_OVERLAY" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1096
    echo "OTHER build only has an overlay image while this build does not. Nothing to compare!"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1097
    exit 1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1098
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1099
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1100
if [ -z "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1101
    echo "WARNING! OTHER build has bundles built while this build does not."
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1102
    echo "Skipping bundle compare!"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1103
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1104
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1105
##########################################################################################
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1106
# Do the work
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1107
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1108
if [ "$CMP_NAMES" = "true" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1109
    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1110
        echo -n "J2SDK "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1111
        compare_dirs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1112
        echo -n "J2RE  "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1113
        compare_dirs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1114
        
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1115
        echo -n "J2SDK "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1116
        compare_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1117
        echo -n "J2RE  "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1118
        compare_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1119
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1120
    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1121
        echo -n "J2SDK Overlay "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1122
        compare_dirs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1123
        echo -n "J2RE  Overlay "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1124
        compare_dirs $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1125
        
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1126
        echo -n "J2SDK Overlay "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1127
        compare_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1128
        echo -n "J2RE  Overlay "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1129
        compare_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1130
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1131
    if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1132
        echo -n "J2SDK Bundle "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1133
        compare_dirs $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1134
        echo -n "J2RE  Bundle "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1135
        compare_dirs $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1136
        
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1137
        echo -n "J2SDK Bundle "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1138
        compare_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1139
        echo -n "J2RE  Bundle "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1140
        compare_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1141
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1142
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1143
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1144
if [ "$CMP_PERMS" = "true" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1145
    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1146
        echo -n "J2SDK "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1147
        compare_permissions $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1148
        echo -n "J2RE  "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1149
        compare_permissions $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1150
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1151
    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1152
        echo -n "J2SDK Overlay "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1153
        compare_permissions $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1154
        echo -n "J2RE  Overlay "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1155
        compare_permissions $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1156
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1157
    if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1158
        echo -n "J2SDK Bundle "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1159
        compare_permissions $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1160
        echo -n "J2RE  Bundle "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1161
        compare_permissions $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1162
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1163
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1164
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1165
if [ "$CMP_TYPES" = "true" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1166
    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1167
        echo -n "J2SDK "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1168
        compare_file_types $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1169
        echo -n "J2RE  "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1170
        compare_file_types $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1171
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1172
    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1173
        echo -n "J2SDK Overlay "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1174
        compare_file_types $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1175
        echo -n "J2RE  Overlay "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1176
        compare_file_types $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1177
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1178
    if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1179
        echo -n "J2SDK Bundle "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1180
        compare_file_types $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1181
        echo -n "J2RE  Bundle "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1182
        compare_file_types $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1183
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1184
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1185
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1186
if [ "$CMP_GENERAL" = "true" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1187
    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1188
        echo -n "J2SDK "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1189
        compare_general_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1190
        echo -n "J2RE  "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1191
        compare_general_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1192
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1193
    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1194
        echo -n "J2SDK Overlay "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1195
        compare_general_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1196
        echo -n "J2RE  Overlay "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1197
        compare_general_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1198
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1199
    if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1200
        echo -n "J2SDK Bundle "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1201
        compare_general_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1202
        echo -n "J2RE  Bundle "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1203
        compare_general_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1204
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1205
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1206
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1207
if [ "$CMP_ZIPS" = "true" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1208
    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1209
        compare_all_zip_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1210
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1211
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1212
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1213
if [ "$CMP_JARS" = "true" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1214
    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1215
        compare_all_jar_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1216
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1217
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1218
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1219
if [ "$CMP_LIBS" = "true" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1220
    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1221
        compare_all_libs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1222
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1223
    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1224
        echo -n "Bundle   "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1225
        compare_all_libs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1226
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1227
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1228
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1229
if [ "$CMP_EXECS" = "true" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1230
    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1231
        compare_all_execs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1232
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1233
    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1234
        echo -n "Overlay "
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1235
        compare_all_execs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1236
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1237
fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1238
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1239
echo
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1240
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1241
if [ -n "$REGRESSIONS" ]; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1242
    echo "REGRESSIONS FOUND!"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1243
    echo
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1244
    exit 1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1245
else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1246
    echo "No regressions found"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1247
    echo
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1248
    exit 0
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
  1249
fi