testing/release/common/check_updates.sh

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rwxr-xr-x

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 # This Source Code Form is subject to the terms of the Mozilla Public
     2 # License, v. 2.0. If a copy of the MPL was not distributed with this
     3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
     5 check_updates () {
     6   # called with 4 args - platform, source package, target package, update package
     7   update_platform=$1
     8   source_package=$2
     9   target_package=$3
    10   locale=$4
    12   # cleanup
    13   rm -rf source/*
    14   rm -rf target/*
    16   unpack_build $update_platform source "$source_package" $locale
    17   if [ "$?" != "0" ]; then
    18     echo "FAILED: cannot unpack_build $update_platform source $source_package"
    19     return 1
    20   fi
    21   unpack_build $update_platform target "$target_package" $locale 
    22   if [ "$?" != "0" ]; then
    23     echo "FAILED: cannot unpack_build $update_platform target $target_package"
    24     return 1
    25   fi
    27   case $update_platform in
    28       Darwin_ppc-gcc | Darwin_Universal-gcc3) 
    29           platform_dirname="*.app"
    30           updater="Contents/MacOS/updater.app/Contents/MacOS/updater"
    31           ;;
    32       WINNT_x86-msvc) 
    33           platform_dirname="bin"
    34           updater="updater.exe"
    35           ;;
    36       Linux_x86-gcc | Linux_x86-gcc3) 
    37           platform_dirname=`echo $product | tr '[A-Z]' '[a-z]'`
    38           updater="updater"
    39           ;;
    40   esac
    42   if [ -f update/update.status ]; then rm update/update.status; fi
    43   if [ -f update/update.log ]; then rm update/update.log; fi
    45   if [ -d source/$platform_dirname ]; then
    46     cd source/$platform_dirname;
    47     cp $updater ../../update
    48     ../../update/updater ../../update 0
    49     cd ../..
    50   else
    51     echo "FAIL: no dir in source/$platform_dirname"
    52     return 1
    53   fi
    55   cat update/update.log
    56   update_status=`cat update/update.status`
    58   if [ "$update_status" != "succeeded" ]
    59   then
    60     echo "FAIL: update status was not succeeded: $update_status"
    61     return 1
    62   fi
    64   diff -r source/$platform_dirname target/$platform_dirname  > results.diff
    65   diffErr=$?
    66   cat results.diff
    67   grep '^Binary files' results.diff > /dev/null
    68   grepErr=$?
    69   if [ $grepErr == 0 ]
    70   then
    71     echo "FAIL: binary files found in diff"
    72     return 1
    73   elif [ $grepErr == 1 ]
    74   then
    75     if [ -s results.diff ]
    76     then
    77       echo "WARN: non-binary files found in diff"
    78       return 2
    79     fi
    80   else
    81     echo "FAIL: unknown error from grep: $grepErr"
    82     return 3
    83   fi
    84   if [ $diffErr != 0 ]
    85   then
    86     echo "FAIL: unknown error from diff: $diffErr"
    87     return 3
    88   fi
    89 }

mercurial