common/bin/compare.sh
changeset 29158 5d46751992d9
parent 29157 e911c898c14c
child 31310 481585782338
equal deleted inserted replaced
29157:e911c898c14c 29158:5d46751992d9
     1 #!/bin/bash
     1 #!/bin/bash
     2 #
     2 #
     3 # Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
     3 # Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
     4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5 #
     5 #
     6 # This code is free software; you can redistribute it and/or modify it
     6 # This code is free software; you can redistribute it and/or modify it
     7 # under the terms of the GNU General Public License version 2 only, as
     7 # under the terms of the GNU General Public License version 2 only, as
     8 # published by the Free Software Foundation.
     8 # published by the Free Software Foundation.
   993     if [ "$(uname -o)" = "Cygwin" ]; then
   993     if [ "$(uname -o)" = "Cygwin" ]; then
   994         COMPARE_ROOT=$(cygpath -msa $COMPARE_ROOT)
   994         COMPARE_ROOT=$(cygpath -msa $COMPARE_ROOT)
   995     fi
   995     fi
   996 fi
   996 fi
   997 
   997 
   998 THIS="$( cd "$( dirname "$0" )" && pwd )"
   998 THIS="$( cd "$( dirname "$0" )" > /dev/null && pwd )"
   999 echo "$THIS"
   999 echo "$THIS"
  1000 THIS_SCRIPT="$0"
  1000 THIS_SCRIPT="$0"
  1001 
  1001 
  1002 if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "-?" ] || [ "$1" = "/h" ] || [ "$1" = "/?" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ]; then
  1002 if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "-?" ] || [ "$1" = "/h" ] || [ "$1" = "/?" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ]; then
  1003     echo "bash ./compare.sh [OPTIONS] [FILTER]"
  1003     echo "bash ./compare.sh [OPTIONS] [FILTER]"
  1083             ;;
  1083             ;;
  1084         -execs)
  1084         -execs)
  1085             CMP_EXECS=true
  1085             CMP_EXECS=true
  1086             ;;
  1086             ;;
  1087         -2dirs)
  1087         -2dirs)
  1088             THIS="$(cd "$2" && pwd )"
  1088             THIS="$(cd "$2" > /dev/null && pwd )"
  1089             OTHER="$(cd "$3" && pwd )"
  1089             OTHER="$(cd "$3" > /dev/null && pwd )"
  1090             THIS_BASE_DIR="$THIS"
  1090             THIS_BASE_DIR="$THIS"
  1091             OTHER_BASE_DIR="$OTHER"
  1091             OTHER_BASE_DIR="$OTHER"
  1092             SKIP_DEFAULT=true
  1092             SKIP_DEFAULT=true
  1093             shift
  1093             shift
  1094             shift
  1094             shift
  1125     shift
  1125     shift
  1126 done
  1126 done
  1127 
  1127 
  1128 if [ "$CMP_2_ZIPS" = "true" ]; then
  1128 if [ "$CMP_2_ZIPS" = "true" ]; then
  1129     THIS_DIR="$(dirname $THIS_FILE)"
  1129     THIS_DIR="$(dirname $THIS_FILE)"
  1130     THIS_DIR="$(cd "$THIS_DIR" && pwd )"
  1130     THIS_DIR="$(cd "$THIS_DIR" > /dev/null && pwd )"
  1131     OTHER_DIR="$(dirname $OTHER_FILE)"
  1131     OTHER_DIR="$(dirname $OTHER_FILE)"
  1132     OTHER_DIR="$(cd "$OTHER_DIR" && pwd )"
  1132     OTHER_DIR="$(cd "$OTHER_DIR" > /dev/null && pwd )"
  1133     THIS_FILE_NAME="$(basename $THIS_FILE)"
  1133     THIS_FILE_NAME="$(basename $THIS_FILE)"
  1134     OTHER_FILE_NAME="$(basename $OTHER_FILE)"
  1134     OTHER_FILE_NAME="$(basename $OTHER_FILE)"
  1135     echo Comparing $THIS_DIR/$THIS_FILE_NAME and $OTHER_DIR/$OTHER_FILE_NAME
  1135     echo Comparing $THIS_DIR/$THIS_FILE_NAME and $OTHER_DIR/$OTHER_FILE_NAME
  1136     compare_zip_file $THIS_DIR $OTHER_DIR $COMPARE_ROOT/2zips $THIS_FILE_NAME $OTHER_FILE_NAME
  1136     compare_zip_file $THIS_DIR $OTHER_DIR $COMPARE_ROOT/2zips $THIS_FILE_NAME $OTHER_FILE_NAME
  1137     exit
  1137     exit
  1138 fi
  1138 fi
  1139 
  1139 
  1140 if [ "$CMP_2_BINS" = "true" ]; then
  1140 if [ "$CMP_2_BINS" = "true" ]; then
  1141     THIS_DIR="$(dirname $THIS_FILE)"
  1141     THIS_DIR="$(dirname $THIS_FILE)"
  1142     THIS_DIR="$(cd "$THIS_DIR" && pwd )"
  1142     THIS_DIR="$(cd "$THIS_DIR" > /dev/null && pwd )"
  1143     OTHER_DIR="$(dirname $OTHER_FILE)"
  1143     OTHER_DIR="$(dirname $OTHER_FILE)"
  1144     OTHER_DIR="$(cd "$OTHER_DIR" && pwd )"
  1144     OTHER_DIR="$(cd "$OTHER_DIR" > /dev/null && pwd )"
  1145     THIS_FILE_NAME="$(basename $THIS_FILE)"
  1145     THIS_FILE_NAME="$(basename $THIS_FILE)"
  1146     OTHER_FILE_NAME="$(basename $OTHER_FILE)"
  1146     OTHER_FILE_NAME="$(basename $OTHER_FILE)"
  1147     echo Comparing $THIS_DIR/$THIS_FILE_NAME and $OTHER_DIR/$OTHER_FILE_NAME
  1147     echo Comparing $THIS_DIR/$THIS_FILE_NAME and $OTHER_DIR/$OTHER_FILE_NAME
  1148     compare_bin_file $THIS_DIR $OTHER_DIR $COMPARE_ROOT/2bins $THIS_FILE_NAME $OTHER_FILE_NAME
  1148     compare_bin_file $THIS_DIR $OTHER_DIR $COMPARE_ROOT/2bins $THIS_FILE_NAME $OTHER_FILE_NAME
  1149     exit
  1149     exit
  1172         if [ ! -d "$OTHER" ]; then
  1172         if [ ! -d "$OTHER" ]; then
  1173             echo "Other build directory does not exist:"
  1173             echo "Other build directory does not exist:"
  1174             echo "$OTHER"
  1174             echo "$OTHER"
  1175             exit 1
  1175             exit 1
  1176         fi
  1176         fi
  1177         OTHER="$( cd "$OTHER" && pwd )"
  1177         OTHER="$( cd "$OTHER" > /dev/null && pwd )"
  1178         echo "Comparing to:"
  1178         echo "Comparing to:"
  1179         echo "$OTHER"
  1179         echo "$OTHER"
  1180         echo
  1180         echo
  1181     fi
  1181     fi
  1182 
  1182 
  1220     else
  1220     else
  1221         echo "No common images found."
  1221         echo "No common images found."
  1222         exit 1
  1222         exit 1
  1223     fi
  1223     fi
  1224 
  1224 
  1225     if [ -d "$THIS/images/jdk-bundle" ] && [ -d "$OTHER/images/jdk-bundle" ]; then
  1225     if [ -d "$THIS/deploy/jdk-bundle" -o -d "$THIS/deploy/images/jdk-bundle" ] \
       
  1226 	     && [ -d "$OTHER/deploy/jdk-bundle" -o -d "$OTHER/deploy/images/jdk-bundle" ]; then
       
  1227 	if [ -d "$THIS/deploy/images/jdk-bundle" ]; then
       
  1228             THIS_JDK_BUNDLE="$THIS/deploy/images/jdk-bundle"
       
  1229             THIS_JRE_BUNDLE="$THIS/deploy/images/jre-bundle"
       
  1230 	else
       
  1231             THIS_JDK_BUNDLE="$THIS/deploy/jdk-bundle"
       
  1232             THIS_JRE_BUNDLE="$THIS/deploy/jre-bundle"
       
  1233 	fi
       
  1234 	if [ -d "$OTHER/deploy/images/jdk-bundle" ]; then
       
  1235             OTHER_JDK_BUNDLE="$OTHER/deploy/images/jdk-bundle"
       
  1236             OTHER_JRE_BUNDLE="$OTHER/deploy/images/jre-bundle"
       
  1237 	else
       
  1238             OTHER_JDK_BUNDLE="$OTHER/deploy/jdk-bundle"
       
  1239             OTHER_JRE_BUNDLE="$OTHER/deploy/jre-bundle"
       
  1240 	fi
       
  1241         echo "Also comparing deploy macosx bundles"
       
  1242     elif [ -d "$THIS/images/jdk-bundle" ] && [ -d "$OTHER/images/jdk-bundle" ]; then
  1226         THIS_JDK_BUNDLE="$THIS/images/jdk-bundle"
  1243         THIS_JDK_BUNDLE="$THIS/images/jdk-bundle"
  1227         THIS_JRE_BUNDLE="$THIS/images/jre-bundle"
  1244         THIS_JRE_BUNDLE="$THIS/images/jre-bundle"
  1228         OTHER_JDK_BUNDLE="$OTHER/images/jdk-bundle"
  1245         OTHER_JDK_BUNDLE="$OTHER/images/jdk-bundle"
  1229         OTHER_JRE_BUNDLE="$OTHER/images/jre-bundle"
  1246         OTHER_JRE_BUNDLE="$OTHER/images/jre-bundle"
  1230         echo "Also comparing macosx bundles"
  1247         echo "Also comparing macosx bundles"
  1231     fi
  1248     fi
  1232 
  1249 
  1233     if [ -d "$THIS/deploy" ] && [ -d "$OTHER/deploy" ]; then
  1250     if [ -d "$THIS/deploy/bundles" -o -d "$THIS/deploy/images/bundles" ] \
  1234         THIS_DEPLOY_BUNDLE_DIR="$THIS/deploy/images/bundles"
  1251 	     && [ -d "$OTHER/deploy/bundles" -o -d "$OTHER/deploy/images/bundles" ]; then
  1235         OTHER_DEPLOY_BUNDLE_DIR="$OTHER/deploy/bundles"
  1252 	if [ -d "$THIS/deploy/images/bundles" ]; then
  1236         echo "Also comparing deploy/bundles"
  1253             THIS_DEPLOY_BUNDLE_DIR="$THIS/deploy/images/bundles"
  1237         if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
  1254 	else
       
  1255             THIS_DEPLOY_BUNDLE_DIR="$THIS/deploy/bundles"
       
  1256 	fi
       
  1257 	if [ -d "$OTHER/deploy/images/bundles" ]; then
       
  1258             OTHER_DEPLOY_BUNDLE_DIR="$OTHER/deploy/images/bundles"
       
  1259 	else
       
  1260             OTHER_DEPLOY_BUNDLE_DIR="$OTHER/deploy/bundles"
       
  1261 	fi
       
  1262         echo "Also comparing deploy javadoc bundles"
       
  1263     fi
       
  1264 
       
  1265     if [ -d "$THIS/deploy/JavaAppletPlugin.plugin" -o -d "$THIS/deploy/images/JavaAppletPlugin.plugin" ] \
       
  1266 	     && [ -d "$OTHER/deploy/JavaAppletPlugin.plugin" -o -d "$OTHER/deploy/images/JavaAppletPlugin.plugin" ]; then
       
  1267 	if [ -d "$THIS/deploy/images/bundles" ]; then
  1238             THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/deploy/images/JavaAppletPlugin.plugin"
  1268             THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/deploy/images/JavaAppletPlugin.plugin"
       
  1269 	else
       
  1270             THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/deploy/JavaAppletPlugin.plugin"
       
  1271 	fi
       
  1272 	if [ -d "$OTHER/deploy/images/bundles" ]; then
       
  1273             OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/deploy/images/JavaAppletPlugin.plugin"
       
  1274 	else
  1239             OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/deploy/JavaAppletPlugin.plugin"
  1275             OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/deploy/JavaAppletPlugin.plugin"
  1240             echo "Also comparing JavaAppletPlugin"
  1276 	fi
  1241         fi
  1277         echo "Also comparing deploy applet image"
  1242     fi
  1278     fi
  1243 
  1279 
  1244     if [ -d "$OTHER/images" ]; then
  1280     if [ -d "$OTHER/images" ]; then
  1245         OTHER_SEC_DIR="$OTHER/images"
  1281         OTHER_SEC_DIR="$OTHER/images"
  1246     else
  1282     else