michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: check_updates () { michael@0: # called with 4 args - platform, source package, target package, update package michael@0: update_platform=$1 michael@0: source_package=$2 michael@0: target_package=$3 michael@0: locale=$4 michael@0: michael@0: # cleanup michael@0: rm -rf source/* michael@0: rm -rf target/* michael@0: michael@0: unpack_build $update_platform source "$source_package" $locale michael@0: if [ "$?" != "0" ]; then michael@0: echo "FAILED: cannot unpack_build $update_platform source $source_package" michael@0: return 1 michael@0: fi michael@0: unpack_build $update_platform target "$target_package" $locale michael@0: if [ "$?" != "0" ]; then michael@0: echo "FAILED: cannot unpack_build $update_platform target $target_package" michael@0: return 1 michael@0: fi michael@0: michael@0: case $update_platform in michael@0: Darwin_ppc-gcc | Darwin_Universal-gcc3) michael@0: platform_dirname="*.app" michael@0: updater="Contents/MacOS/updater.app/Contents/MacOS/updater" michael@0: ;; michael@0: WINNT_x86-msvc) michael@0: platform_dirname="bin" michael@0: updater="updater.exe" michael@0: ;; michael@0: Linux_x86-gcc | Linux_x86-gcc3) michael@0: platform_dirname=`echo $product | tr '[A-Z]' '[a-z]'` michael@0: updater="updater" michael@0: ;; michael@0: esac michael@0: michael@0: if [ -f update/update.status ]; then rm update/update.status; fi michael@0: if [ -f update/update.log ]; then rm update/update.log; fi michael@0: michael@0: if [ -d source/$platform_dirname ]; then michael@0: cd source/$platform_dirname; michael@0: cp $updater ../../update michael@0: ../../update/updater ../../update 0 michael@0: cd ../.. michael@0: else michael@0: echo "FAIL: no dir in source/$platform_dirname" michael@0: return 1 michael@0: fi michael@0: michael@0: cat update/update.log michael@0: update_status=`cat update/update.status` michael@0: michael@0: if [ "$update_status" != "succeeded" ] michael@0: then michael@0: echo "FAIL: update status was not succeeded: $update_status" michael@0: return 1 michael@0: fi michael@0: michael@0: diff -r source/$platform_dirname target/$platform_dirname > results.diff michael@0: diffErr=$? michael@0: cat results.diff michael@0: grep '^Binary files' results.diff > /dev/null michael@0: grepErr=$? michael@0: if [ $grepErr == 0 ] michael@0: then michael@0: echo "FAIL: binary files found in diff" michael@0: return 1 michael@0: elif [ $grepErr == 1 ] michael@0: then michael@0: if [ -s results.diff ] michael@0: then michael@0: echo "WARN: non-binary files found in diff" michael@0: return 2 michael@0: fi michael@0: else michael@0: echo "FAIL: unknown error from grep: $grepErr" michael@0: return 3 michael@0: fi michael@0: if [ $diffErr != 0 ] michael@0: then michael@0: echo "FAIL: unknown error from diff: $diffErr" michael@0: return 3 michael@0: fi michael@0: }