testing/release/common/check_updates.sh

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/testing/release/common/check_updates.sh	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,89 @@
     1.4 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.5 +# License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.7 +
     1.8 +check_updates () {
     1.9 +  # called with 4 args - platform, source package, target package, update package
    1.10 +  update_platform=$1
    1.11 +  source_package=$2
    1.12 +  target_package=$3
    1.13 +  locale=$4
    1.14 +
    1.15 +  # cleanup
    1.16 +  rm -rf source/*
    1.17 +  rm -rf target/*
    1.18 +
    1.19 +  unpack_build $update_platform source "$source_package" $locale
    1.20 +  if [ "$?" != "0" ]; then
    1.21 +    echo "FAILED: cannot unpack_build $update_platform source $source_package"
    1.22 +    return 1
    1.23 +  fi
    1.24 +  unpack_build $update_platform target "$target_package" $locale 
    1.25 +  if [ "$?" != "0" ]; then
    1.26 +    echo "FAILED: cannot unpack_build $update_platform target $target_package"
    1.27 +    return 1
    1.28 +  fi
    1.29 +  
    1.30 +  case $update_platform in
    1.31 +      Darwin_ppc-gcc | Darwin_Universal-gcc3) 
    1.32 +          platform_dirname="*.app"
    1.33 +          updater="Contents/MacOS/updater.app/Contents/MacOS/updater"
    1.34 +          ;;
    1.35 +      WINNT_x86-msvc) 
    1.36 +          platform_dirname="bin"
    1.37 +          updater="updater.exe"
    1.38 +          ;;
    1.39 +      Linux_x86-gcc | Linux_x86-gcc3) 
    1.40 +          platform_dirname=`echo $product | tr '[A-Z]' '[a-z]'`
    1.41 +          updater="updater"
    1.42 +          ;;
    1.43 +  esac
    1.44 +
    1.45 +  if [ -f update/update.status ]; then rm update/update.status; fi
    1.46 +  if [ -f update/update.log ]; then rm update/update.log; fi
    1.47 +
    1.48 +  if [ -d source/$platform_dirname ]; then
    1.49 +    cd source/$platform_dirname;
    1.50 +    cp $updater ../../update
    1.51 +    ../../update/updater ../../update 0
    1.52 +    cd ../..
    1.53 +  else
    1.54 +    echo "FAIL: no dir in source/$platform_dirname"
    1.55 +    return 1
    1.56 +  fi
    1.57 +
    1.58 +  cat update/update.log
    1.59 +  update_status=`cat update/update.status`
    1.60 +
    1.61 +  if [ "$update_status" != "succeeded" ]
    1.62 +  then
    1.63 +    echo "FAIL: update status was not succeeded: $update_status"
    1.64 +    return 1
    1.65 +  fi
    1.66 +
    1.67 +  diff -r source/$platform_dirname target/$platform_dirname  > results.diff
    1.68 +  diffErr=$?
    1.69 +  cat results.diff
    1.70 +  grep '^Binary files' results.diff > /dev/null
    1.71 +  grepErr=$?
    1.72 +  if [ $grepErr == 0 ]
    1.73 +  then
    1.74 +    echo "FAIL: binary files found in diff"
    1.75 +    return 1
    1.76 +  elif [ $grepErr == 1 ]
    1.77 +  then
    1.78 +    if [ -s results.diff ]
    1.79 +    then
    1.80 +      echo "WARN: non-binary files found in diff"
    1.81 +      return 2
    1.82 +    fi
    1.83 +  else
    1.84 +    echo "FAIL: unknown error from grep: $grepErr"
    1.85 +    return 3
    1.86 +  fi
    1.87 +  if [ $diffErr != 0 ]
    1.88 +  then
    1.89 +    echo "FAIL: unknown error from diff: $diffErr"
    1.90 +    return 3
    1.91 +  fi
    1.92 +}

mercurial