From 949e2d7b46465f201ec202d7d21e56cadc538fdb Mon Sep 17 00:00:00 2001 From: "rhelmer%mozilla.com" Date: Fri, 28 Jul 2006 21:00:11 +0000 Subject: [PATCH] release verification scripts, b=346013 --- testing/release/README.txt | 63 ++++++++++++ testing/release/common/download_mars.sh | 46 +++++++++ testing/release/common/unpack.sh | 35 +++++++ testing/release/l10n/verify_l10n.sh | 25 +++++ testing/release/updates/verify_aus.sh | 27 +++++ testing/release/updates/verify_update.sh | 126 +++++++++++++++++++++++ 6 files changed, 322 insertions(+) create mode 100644 testing/release/README.txt create mode 100644 testing/release/common/download_mars.sh create mode 100755 testing/release/common/unpack.sh create mode 100755 testing/release/l10n/verify_l10n.sh create mode 100755 testing/release/updates/verify_aus.sh create mode 100755 testing/release/updates/verify_update.sh diff --git a/testing/release/README.txt b/testing/release/README.txt new file mode 100644 index 000000000000..79b79b666abe --- /dev/null +++ b/testing/release/README.txt @@ -0,0 +1,63 @@ +Mozilla Build Verification Scripts +--- + +-- +Contents +-- + +updates -> AUS and update verification +l10n -> l10n vs. en-US verification +common -> useful utility scripts + +-- +Update verification +-- + +verify_aus.sh + does a low-level check of all advertised MAR files. Expects to have a + file named all-locales, but does not (yet) handle platform exceptions, so + these should be removed from the locales file. + + Does the following: + + 1) download update.xml from AUS for a particular release + 2) download the partial and full mar advertised + 3) check that the partial and full match the advertised size and sha1sum + + This is really just a thin wrapper around the common/download_mars.sh + functionality. + +verify_updates.sh + downloads two consecutive releases, downloads the partial MAR for the older + release (using the technique described for verify_aus.sh), applies the + MAR to the older release, and compares the two releases. + + Expects to have a file named all-locales, but does not (yet) handle platform + exceptions, so these should be removed from the locales file. + +- +Valid Platforms for AUS +- +Linux_x86-gcc3 +Darwin_Universal-gcc3 +Linux_x86-gcc3 +WINNT_x86-msvc +Darwin_ppc-gcc3 + +-- +l10n verification +2A +-- + +verify_l10n.sh + unpacks an en-US build for a particular release/platform, and + then unpacks and compares all locales for that particular release/platform. + + Expects to have a file named all-locales, but does not (yet) handle platform + exceptions, so these should be removed from the locales file. + + Best practice is to take a directory full of diffs for a particular release + and compare to a directory full of diffs for the current release, to see + what l10n changes have occurred. For maintenance releases, this should + be slim to none. + diff --git a/testing/release/common/download_mars.sh b/testing/release/common/download_mars.sh new file mode 100644 index 000000000000..cef6a163351e --- /dev/null +++ b/testing/release/common/download_mars.sh @@ -0,0 +1,46 @@ +download_mars () { + update_url="$1" + + echo "Using $update_url" + curl -s $update_url > update.xml + + mkdir -p update/ + for patch_type in partial complete + do + line=`fgrep "patch type=\"$patch_type" update.xml` + grep_rv=$? + + if [ 0 -ne $grep_rv ]; then + echo "FAIL: no $patch_type update found" + continue + fi + + command=`echo $line | sed -e 's/^.*.*$::' -e 's:\&:\&:g'` + eval "export $command" + + wget -nv -O update/$patch_type.mar $URL + if [ "$?" != 0 ]; then + echo "Could not download $patch_type!" + echo "from: $URL" + fi + actual_size=`perl -e "printf \"%d\n\", (stat(\"update/$patch_type.mar\"))[7]"` + actual_hash=`openssl dgst -$hashFunction update/$patch_type.mar | sed -e 's/^.*= //'` + + if [ $actual_size != $size ]; then + echo "FAIL: $patch_type wrong size" + echo "FAIL: update.xml size: $size" + echo "FAIL: actual size: $actual_size" + continue + fi + + if [ $actual_hash != $hashValue ]; then + echo "FAIL: $patch_type wrong hash" + echo "FAIL: update.xml hash: $hashValue" + echo "FAIL: actual hash: $actual_hash" + continue + fi + +# ln -s $mar_location $patch_type.mar + + done +} diff --git a/testing/release/common/unpack.sh b/testing/release/common/unpack.sh new file mode 100755 index 000000000000..0a1b5dbd5c46 --- /dev/null +++ b/testing/release/common/unpack.sh @@ -0,0 +1,35 @@ +#!/bin/bash +unpack_build () { + platform="$1" + dir_name="$2" + pkg_file="$3" + + mkdir -p $dir_name + pushd $dir_name > /dev/null + case $platform in + mac|mac-ppc) + cd ../ + mkdir -p mnt + echo "y" | PAGER="cat > /dev/null" hdiutil attach \ + -quiet -mountpoint ./mnt "$pkg_file" + sleep 5 + rsync -a ./mnt/* $dir_name/ + hdiutil detach mnt + cd $dir_name + ;; + win32) + /usr/local/bin/7za x ../"$pkg_file" > /dev/null + for file in *.xpi + do + unzip -o $file > /dev/null + done + + ;; + linux) + tar xfvz ../"$pkg_file" > /dev/null + ;; + esac + + popd > /dev/null + +} diff --git a/testing/release/l10n/verify_l10n.sh b/testing/release/l10n/verify_l10n.sh new file mode 100755 index 000000000000..36eb308db2a7 --- /dev/null +++ b/testing/release/l10n/verify_l10n.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +. ../common/unpack.sh + +release=$1 + +if [ -z "$release" ] +then + echo "Syntax: $0 " + exit 1 +fi + +for platform in linux-i686 win32 mac +do + rm -rf source/* + # unpack_build platform dir_name pkg_file + unpack_build $platform source $release/*.en-US.${platform}.* + locales=`ls $release/*.${platform}.* | grep -v en-US | cut -d\. -f5` + for locale in $locales + do + rm -rf target/* + unpack_build ${platform} target $release/*.${locale}.${platform}.* + diff -r source target > ${platform}.${locale}.diff + done +done diff --git a/testing/release/updates/verify_aus.sh b/testing/release/updates/verify_aus.sh new file mode 100755 index 000000000000..deb32f11d9e0 --- /dev/null +++ b/testing/release/updates/verify_aus.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# set -x + +. ../common/unpack.sh +. ../common/download_mars.sh + +build_id="2006050817" +product="Firefox" +release="1.5.0.4" +channel="release" + + +for build_platform in WINNT_x86-msvc Darwin_Universal-gcc3 Linux_x86-gcc3 +do + + for locale in `cat all-locales` + #for locale in ko ja ja-JP-mac zh-CN zh-TW + #for locale in en-US + do + + echo "checking $build_platform $locale" + + download_mars "https://aus2.mozilla.org/update/1/$product/$release/$build_id/$build_platform/$locale/$channel/update.xml" + + done + +done diff --git a/testing/release/updates/verify_update.sh b/testing/release/updates/verify_update.sh new file mode 100755 index 000000000000..14058e3e95c7 --- /dev/null +++ b/testing/release/updates/verify_update.sh @@ -0,0 +1,126 @@ +#!/bin/bash +# set -x + +. ../common/unpack.sh +. ../common/download_mars.sh + +build_id="2006050817" +product="Firefox" +release="1.5.0.4" +channel="release" + +check_update () { +# called with 4 args - platform, source package, target package, update package + platform=$1 + source_package=$2 + target_package=$3 + + # cleanup + rm -rf downloads/* + rm -rf source/* + rm -rf target/* + + unpack_build $platform source "$source_package" + unpack_build $platform target "$target_package" + + #mkdir update + #cp $update_package update/update.mar + + case $platform in + mac|mac-ppc) + platform_dirname="*.app" + ;; + win32) + platform_dirname="bin" + ;; + linux) + platform_dirname=`echo $product | tr '[A-Z]' '[a-z]'` + ;; + esac + + cd source/$platform_dirname; + $HOME/bin/updater ../../update 0 + + cd ../.. + + diff -r source/$platform_dirname target/$platform_dirname + return $? +} + +for build_platform in Linux_x86-gcc3 Darwin_Universal-gcc3 WINNT_x86-msvc +do + + #for locale in `cat all-locales` + for locale in en-US + do + if [ "Darwin_ppc-gcc3" == $build_platform ]; then + source_build_platform=mac-ppc + dirname="mac-ppc" + filename="$product _version_.dmg" + shortfilename="`echo $product | tr '[A-Z]' '[a-z]'`-_version_.$locale.$dirname.dmg" + elif [ "Darwin_Universal-gcc3" == $build_platform ]; then + source_build_platform=mac + dirname="mac" + filename="$product _version_.dmg" + shortfilename="`echo $product | tr '[A-Z]' '[a-z]'`-_version_.$locale.$dirname.dmg" + elif [ "Linux_x86-gcc3" == $build_platform ]; then + source_build_platform=linux + dirname="linux-i686" + #dirname="linux" + filename="`echo $product | tr '[A-Z]' '[a-z]'`-_version_.tar.gz" + shortfilename="`echo $product | tr '[A-Z]' '[a-z]'`-_version_.$locale.$dirname.tar.gz" + elif [ "WINNT_x86-msvc" == $build_platform ]; then + source_build_platform=win32 + dirname="win32" + filename="$product Setup _version_.exe" + shortfilename="`echo $product | tr '[A-Z]' '[a-z]'`-_version_.$locale.$dirname.exe" + fi + + echo "checking $build_platform $locale" + + download_mars "https://aus2.mozilla.org/update/1/$product/$release/$build_id/$build_platform/$locale/$channel/update.xml" + if [ $? != 0 ]; then + echo "download_mars returned error, skipping.." + continue + fi + source_file=`echo $filename | sed "s/_version_/$release/"` + target_file=`echo $filename | sed "s/_version_/1.5.0.5/"` + #target_file=`echo $shortfilename | sed "s/_version_/1.5.0.5/"` + cp update/partial.mar update/update.mar + if [ -f "$source_file" ]; then rm "$source_file"; fi + PARAMS="--user=qa --password=Pho3naib" + build_url="http://stage.mozilla.org/pub/mozilla.org/`echo $product | tr '[A-Z]' '[a-z]'`/releases/$release/$dirname/$locale/$source_file" + #build_url="http://people.mozilla.org/~rhelmer/`echo $product | tr '[A-Z]' '[a-z]'`/releases/yahoo/$release/$dirname/$locale/$source_file" + #build_url="http://people.mozilla.org/~rhelmer/`echo $product | tr '[A-Z]' '[a-z]'`/releases/google/$release/$locale/$source_file" + mkdir -p downloads/ + pushd downloads > /dev/null + if [ -f $source_file ]; then rm $source_file; fi + wget -nv $PARAMS "$build_url" + popd > /dev/null + if [ $? != 0 ]; then + echo "FAIL: Could not download source $source_file from $build_url" + echo "skipping.." + continue + fi + if [ -f "$target_file" ]; then rm "$target_file"; fi + #build_url="http://stage.mozilla.org/pub/mozilla.org/`echo $product | tr '[A-Z]' '[a-z]'`/nightly/1.5.0.5-candidates/rc4/$target_file" + build_url="http://stage.mozilla.org/pub/mozilla.org/`echo $product | tr '[A-Z]' '[a-z]'`/releases/1.5.0.5/$dirname/$locale/$target_file" + # XXX hack to test mac-ppc -> mac + # build_url="http://stage.mozilla.org/pub/mozilla.org/`echo $product | tr '[A-Z]' '[a-z]'`/releases/1.5.0.5/mac/$locale/$target_file" + #build_url="http://people.mozilla.org/~rhelmer/`echo $product | tr '[A-Z]' '[a-z]'`/releases/yahoo/testing/1.5.0.5/$dirname/$locale/$target_file" + #build_url="http://people.mozilla.org/~rhelmer/`echo $product | tr '[A-Z]' '[a-z]'`/releases/google/testing/1.5.0.5/$dirname/$locale/$target_file" + mkdir -p downloads/ + pushd downloads > /dev/null + if [ -f $target_file ]; then rm $target_file; fi + wget -nv $PARAMS "$build_url" + popd > /dev/null + if [ $? != 0 ]; then + echo "FAIL: Could not download target $target_file from $build_url" + echo "skipping.." + continue + fi + check_update "$source_build_platform" "downloads/$source_file" "downloads/$target_file" + + done + +done