Bug 509164 - Sisyphus - support mozilla-build start*.bat environment settings, r=ctalbert.
authorBob Clary <bclary@bclary.com>
Tue, 18 Aug 2009 00:29:59 -0700
changeset 31859 b66ddcabf8aeef3465309ae382756abf07acb6c4
parent 31858 3c03e96d6910931cb366511f8dd3f26f3ee6aec3
child 31860 4b9e2f886b9fbf57c68bfc3816b2d2d4b62fc7fe
push idunknown
push userunknown
push dateunknown
reviewersctalbert
bugs509164
milestone1.9.3a1pre
Bug 509164 - Sisyphus - support mozilla-build start*.bat environment settings, r=ctalbert.
js/tests/bisect.sh
js/tests/config.sh
testing/sisyphus/bin/build.sh
testing/sisyphus/bin/checkout.sh
testing/sisyphus/bin/clobber.sh
testing/sisyphus/bin/install-extensions.sh
testing/sisyphus/bin/library.sh
testing/sisyphus/bin/set-build-env.sh
testing/sisyphus/bin/set-msvc6-env.sh
testing/sisyphus/bin/set-msvc8-env.sh
--- a/js/tests/bisect.sh
+++ b/js/tests/bisect.sh
@@ -138,17 +138,25 @@ done
 
 if [[ -z "$bisect_product" || -z "$bisect_branch" || -z "$bisect_buildtype" || -z "$bisect_test" || -z "$bisect_good" || -z "$bisect_bad" ]]; then
     echo "bisect_product: $bisect_product, bisect_branch: $bisect_branch, bisect_buildtype: $bisect_buildtype, bisect_test: $bisect_test, bisect_good: $bisect_good, bisect_bad: $bisect_bad"
     usage
 fi
 
 OPTIND=1
 
+# evaluate set-build-env.sh in this process to pick up the necessary environment
+# variables, but restore the PATH and PYTHON to prevent their interfering with
+# Sisyphus.
+
+savepath="$PATH"
+savepython="$PYTHON"
 eval source $TEST_DIR/bin/set-build-env.sh -p $bisect_product -b $bisect_branch $bisect_extraflag -T $bisect_buildtype > /dev/null
+PATH=$savepath
+PYTHON=$savepython
 
 # TEST_JSDIR must be set after set-build-env.sh is called
 # on Windows since TEST_DIR can be modified in set-build-env.sh
 # from the pure cygwin path /work/... to a the cygwin windows path
 # /c/work/...
 TEST_JSDIR=${TEST_JSDIR:-$TEST_DIR/tests/mozilla.org/js}
 
 case $bisect_branch in
--- a/js/tests/config.sh
+++ b/js/tests/config.sh
@@ -82,16 +82,25 @@ if echo "$OS_ARCH" | grep -iq CYGWIN_NT;
     OS_RELEASE="`echo $OS_ARCH|sed 's/CYGWIN_NT-//'`"
     OS_ARCH="WINNT"
 fi
 
 if [[ "$OS_ARCH" == "CYGWIN32_NT" ]]; then
     OS_ARCH="WINNT"
 fi
 
+if echo "$OS_ARCH" | grep -iq MINGW32_NT; then
+    OS_RELEASE="`echo $OS_ARCH|sed 's/MINGW32_NT-//'`"
+    OS_ARCH="WINNT"
+fi
+
+if [[ "$OS_ARCH" == "MINGW32_NT" ]]; then
+    OS_ARCH="WINNT"
+fi
+
 # Virtually all Linux versions are identical.
 # Any distinctions are handled in linux.h
 
 case "$OS_ARCH" in
     "Linux")
         OS_CONFIG="Linux_All"
         ;;
     "dgux")
--- a/testing/sisyphus/bin/build.sh
+++ b/testing/sisyphus/bin/build.sh
@@ -39,26 +39,26 @@
 
 source $TEST_DIR/bin/library.sh
 source $TEST_DIR/bin/set-build-env.sh $@
 
 case $product in
     firefox|thunderbird|fennec)
         cd $BUILDTREE/mozilla
 
-        if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla; make -f client.mk build" 2>&1; then
+        if ! $buildbash $bashlogin -c "export PATH=\"$BUILDPATH\"; cd $BUILDTREE/mozilla; make -f client.mk build" 2>&1; then
 
             if [[ -z "$TEST_FORCE_CLOBBER_ON_ERROR" ]]; then
                 error "error during build" $LINENO
             else
                 echo "error occured during build. attempting a clobber build" $LINENO
-                if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla; make -f client.mk distclean" 2>&1; then
+                if ! $buildbash $bashlogin -c "export PATH=\"$BUILDPATH\"; cd $BUILDTREE/mozilla; make -f client.mk distclean" 2>&1; then
                     error "error during forced clobber" $LINENO
                 fi
-                if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla; make -f client.mk build" 2>&1; then
+                if ! $buildbash $bashlogin -c "export PATH=\"$BUILDPATH\"; cd $BUILDTREE/mozilla; make -f client.mk build" 2>&1; then
                     error "error during forced build" $LINENO
                 fi
             fi
         fi
 
         case "$OSID" in
             mac) 
                 if [[ "$buildtype" == "debug" ]]; then
@@ -112,82 +112,80 @@ case $product in
         if [[ -e "$BUILDTREE/mozilla/js/src/configure.in" ]]; then
 
             # use the new fangled autoconf build environment for spidermonkey
 
             # recreate the OBJ directories to match the old naming standards
             TEST_JSDIR=${TEST_JSDIR:-$TEST_DIR/tests/mozilla.org/js}
             source $TEST_JSDIR/config.sh
 
-            mkdir -p "$BUILDTREE/mozilla/js/src/$JS_OBJDIR"
-
-            # run autoconf everytime instead of only when configure
-            # needs to be initially generated in order to pick up
-            # configure.in changes.
+            cd "$BUILDTREE/mozilla/js/src"
+            mkdir -p "$JS_OBJDIR"
 
-            if findprogram autoconf-2.13; then
-                AUTOCONF=autoconf-2.13
-            elif findprogram autoconf213; then
-                AUTOCONF=autoconf213
-            else
-                error "autoconf 2.13 not detected"
+            # run autoconf when configure.in is newer than configure
+            if [[ configure.in -nt configure ]]; then
+                if [[ "$OSID" == "nt" ]]; then
+                    AUTOCONF=autoconf-2.13
+                elif findprogram autoconf-2.13; then
+                    AUTOCONF=autoconf-2.13
+                elif findprogram autoconf213; then
+                    AUTOCONF=autoconf213
+                else
+                    error "autoconf 2.13 not detected"
+                fi
+
+                if ! $buildbash $bashlogin -c "export PATH=\"$BUILDPATH\"; cd $BUILDTREE/mozilla/js/src; eval \"$AUTOCONF\";" 2>&1; then
+                    error "during js/src autoconf" $LINENO
+                fi
             fi
 
-            cd "$BUILDTREE/mozilla/js/src"
-            eval "$AUTOCONF" 
-
-            cd "$BUILDTREE/mozilla/js/src/$JS_OBJDIR"
-
-            if [[ -e "Makefile" ]]; then
-                if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla/js/src/$JS_OBJDIR; make clean" 2>&1; then
-                    error "during js/src clean" $LINENO
-                fi
-            fi
 
             # XXX: Todo
             # This reproduces the limited approach which previously existed with Makefile.ref but
             # does not provide the full functionality provided by the available configure options.
             # Ideally, it would be good to use a mozconfig approach (if available) that would generate
             # the necessary configure command line arguments. This would provide the generality to
             # specify arbitrary configure options.
             #
 
-            if [[ "$buildtype" == "debug" ]]; then
-                if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla/js/src/$JS_OBJDIR; ../configure --prefix=$BUILDTREE/mozilla/js/src/$JS_OBJDIR  --disable-optimize --enable-debug"; then
-                    error "during js/src/$JS_OBJDIR configure" $LINENO
-                fi
-            else
-                if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla/js/src/$JS_OBJDIR; ../configure --prefix=$BUILDTREE/mozilla/js/src/$JS_OBJDIR  --enable-optimize --disable-debug"; then
-                    error "during js/src/$JS_OBJDIR configure" $LINENO
+            if [[ "configure" -nt "$JS_OBJDIR/Makefile" ]]; then
+                if [[ "$buildtype" == "debug" ]]; then
+                    if ! $buildbash $bashlogin -c "export PATH=\"$BUILDPATH\"; cd $BUILDTREE/mozilla/js/src/$JS_OBJDIR; ../configure --prefix=$BUILDTREE/mozilla/js/src/$JS_OBJDIR  --disable-optimize --enable-debug"; then
+                        error "during js/src/$JS_OBJDIR configure" $LINENO
+                    fi
+                else
+                    if ! $buildbash $bashlogin -c "export PATH=\"$BUILDPATH\"; cd $BUILDTREE/mozilla/js/src/$JS_OBJDIR; ../configure --prefix=$BUILDTREE/mozilla/js/src/$JS_OBJDIR  --enable-optimize --disable-debug"; then
+                        error "during js/src/$JS_OBJDIR configure" $LINENO
+                    fi
                 fi
             fi
 
-            if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla/js/src/$JS_OBJDIR; make" 2>&1; then
+            if ! $buildbash $bashlogin -c "export PATH=\"$BUILDPATH\"; cd $BUILDTREE/mozilla/js/src/$JS_OBJDIR; make" 2>&1; then
                 error "during js/src build" $LINENO
             fi
 
-            if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla/js/src/$JS_OBJDIR; make install" 2>&1; then
+            if ! $buildbash $bashlogin -c "export PATH=\"$BUILDPATH\"; cd $BUILDTREE/mozilla/js/src/$JS_OBJDIR; make install" 2>&1; then
                 error "during js/src install" $LINENO
             fi
 
         elif [[ -e "$BUILDTREE/mozilla/js/src/Makefile.ref" ]]; then
 
             # use the old-style Makefile.ref build environment for spidermonkey
 
             if [[ $buildtype == "debug" ]]; then
                 export JSBUILDOPT=
             else
                 export JSBUILDOPT=BUILD_OPT=1
             fi
 
-            if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla/js/src; make -f Makefile.ref ${JSBUILDOPT} clean" 2>&1; then
+            if ! $buildbash $bashlogin -c "export PATH=\"$BUILDPATH\"; cd $BUILDTREE/mozilla/js/src; make -f Makefile.ref ${JSBUILDOPT} clean" 2>&1; then
                 error "during js/src clean" $LINENO
             fi 
 
-            if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla/js/src; make -f Makefile.ref ${JSBUILDOPT}" 2>&1; then
+            if ! $buildbash $bashlogin -c "export PATH=\"$BUILDPATH\"; cd $BUILDTREE/mozilla/js/src; make -f Makefile.ref ${JSBUILDOPT}" 2>&1; then
                 error "during js/src build" $LINENO
             fi
 
         else
 
             error "Neither Makefile.ref or autoconf builds available"
 
         fi
--- a/testing/sisyphus/bin/checkout.sh
+++ b/testing/sisyphus/bin/checkout.sh
@@ -117,17 +117,17 @@ case $product in
                 if [[ ! ( -d mozilla && \
                     -e mozilla/client.mk && \
                     -e "mozilla/$project/config/mozconfig" ) ]]; then
                     if ! eval cvs -z3 -q co $MOZ_CO_FLAGS $BRANCH_CO_FLAGS $DATE_CO_FLAGS \
                         mozilla/client.mk mozilla/$project/config/mozconfig; then
                         error "during checkout of $project mozconfig" $LINENO
                     fi
                 fi
-                if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla; make -f client.mk checkout" 2>&1; then
+                if ! $buildbash $bashlogin -c "export PATH=\"$BUILDPATH\"; cd $BUILDTREE/mozilla; make -f client.mk checkout" 2>&1; then
                     error "during checkout of $project tree" $LINENO
                 fi
                 ;;
 
             1.9.1|1.9.2)
 
                 # do not use mozilla-build on windows systems as we 
                 # must use the cygwin python with the cygwin mercurial.
@@ -160,17 +160,17 @@ case $product in
                     -e mozilla/client.mk && \
                     -e "mozilla/browser/config/mozconfig" ) ]]; then
                     if ! eval cvs -z3 -q co $MOZ_CO_FLAGS $BRANCH_CO_FLAGS $DATE_CO_FLAGS \
                         mozilla/client.mk mozilla/browser/config/mozconfig; then
                         error "during checkout of $MOZ_CO_FLAGS $BRANCH_CO_FLAGS $DATE_CO_FLAGS browser mozconfig" $LINENO
                     fi
                 fi
 
-                if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla; make -f client.mk checkout" 2>&1; then
+                if ! $buildbash $bashlogin -c "export PATH=\"$BUILDPATH\"; cd $BUILDTREE/mozilla; make -f client.mk checkout" 2>&1; then
                     error "during checkout of $project tree" $LINENO
                 fi
                 ;;
 
             1.9.1|1.9.2)
 
                 # do not use mozilla-build on windows systems as we 
                 # must use the cygwin python with the cygwin mercurial.
--- a/testing/sisyphus/bin/clobber.sh
+++ b/testing/sisyphus/bin/clobber.sh
@@ -48,17 +48,17 @@ fi
 case $product in
     firefox|thunderbird|fennec)
 
         if [[ ! -e "$executablepath" ]]; then
             echo "executable path $executablepath doesn't exist, ignoring clobber"
             exit
         fi 
 
-        if ! $buildbash $bashlogin -c "cd $BUILDTREE/mozilla; make -f client.mk clobber" 2>&1; then
+        if ! $buildbash $bashlogin -c "export PATH=\"$BUILDPATH\"; cd $BUILDTREE/mozilla; make -f client.mk clobber" 2>&1; then
             echo "error during client.mk clobber" $LINENO
             echo "Forcing clobber" $LINENO
             rm -fR $BUILDTREE/mozilla/$product-$buildtype/
         fi
         ;;
 
     js)
 
--- a/testing/sisyphus/bin/install-extensions.sh
+++ b/testing/sisyphus/bin/install-extensions.sh
@@ -44,78 +44,78 @@ TEST_STARTUP_TRIES=${TEST_STARTUP_TRIES:
 #
 # options processing
 #
 options="p:b:x:N:E:d:"
 function usage()
 {
     cat <<EOF
 usage:
-$SCRIPT -p product -b branch -x executablepath -N profilename -E extensions
+$SCRIPT -p product -b branch -x executablepath -N profilename -E extensiondir
        [-d datafiles]
 
 variable            description
 ===============     ============================================================
 -p product          required. firefox, thunderbird or fennec
 -b branch           required. one of 1.8.0 1.8.1 1.9.0 1.9.1 1.9.2
 -x executablepath   required. directory-tree containing executable named
                     'product'
 -N profilename      required. profile name
--E extensions       required. path to directory containing xpis to be installed
+-E extensiondir       required. path to directory containing xpis to be installed
 -d datafiles        optional. one or more filenames of files containing
             environment variable definitions to be included.
 
 note that the environment variables should have the same names as in the
 "variable" column.
 
 EOF
     exit 1
 }
 
-unset product branch executablepath profilename extensions datafiles
+unset product branch executablepath profilename extensiondir datafiles
 
 while getopts $options optname ;
 do
     case $optname in
         p) product=$OPTARG;;
         b) branch=$OPTARG;;
         x) executablepath=$OPTARG;;
         N) profilename=$OPTARG;;
-        E) extensions=$OPTARG;;
+        E) extensiondir=$OPTARG;;
         d) datafiles=$OPTARG;;
     esac
 done
 
 # include environment variables
 loaddata $datafiles
 
 if [[ -z "$product" || -z "$branch" || \
-    -z "$executablepath" || -z "$profilename" || -z "$extensions" ]]; then
+    -z "$executablepath" || -z "$profilename" || -z "$extensiondir" ]]; then
     usage
 fi
 
 checkProductBranch $product $branch
 
 if echo $profilename | egrep -qiv '[a-z0-9_]'; then
     error "profile name must consist of letters, digits or _" $LINENO
 fi
 
 executable=`get_executable $product $branch $executablepath`
-extensiondir=`dirname $executable`/extensions
+executableextensiondir=`dirname $executable`/extensions
 
 # create directory to contain installed extensions
 if [[ ! -d /tmp/sisyphus/extensions ]]; then
     create-directory.sh -n -d /tmp/sisyphus/extensions
 fi
 
-for extensionloc in $extensions/all/*.xpi $extensions/$OSID/*.xpi; do
-    if [[ $extensionloc == "$extensions/all/*.xpi" ]]; then
+for extensionloc in $extensiondir/all/*.xpi $extensiondir/$OSID/*.xpi; do
+    if [[ $extensionloc == "$extensiondir/all/*.xpi" ]]; then
         continue
     fi
-    if [[ $extensionloc == "$extensions/$OSID/*.xpi" ]]; then
+    if [[ $extensionloc == "$extensiondir/$OSID/*.xpi" ]]; then
         continue
     fi
 
     extensionname=`xbasename $extensionloc .xpi`
     extensioninstalldir=/tmp/sisyphus/extensions/$extensionname
 
     if [[ "$OSID" == "nt" ]]; then
         extensionosinstalldir=`cygpath -a -w $extensioninstalldir`
@@ -126,18 +126,18 @@ for extensionloc in $extensions/all/*.xp
 
     # unzip the extension if it does not already exist.
     if [[ ! -e $extensioninstalldir ]]; then
         create-directory.sh -n -d $extensioninstalldir
         unzip -d $extensioninstalldir $extensionloc
     fi
 
     extensionuuid=`perl $TEST_DIR/bin/get-extension-uuid.pl $extensioninstalldir/install.rdf`
-    if [[ ! -e $extensiondir/$extensionuuid ]]; then
-        echo $extensionosinstalldir > $extensiondir/$extensionuuid
+    if [[ ! -e $executableextensiondir/$extensionuuid ]]; then
+        echo $extensionosinstalldir > $executableextensiondir/$extensionuuid
     fi
 
 done
 
 # restart to make extension manager happy
 if ! $TEST_DIR/bin/timed_run.py ${TEST_STARTUP_TIMEOUT} "install extensions - first restart" \
     $executable -P $profilename "http://${TEST_HTTP}/bin/install-extensions-1.html"; then
     echo "Ignoring 1st failure to load the install-extensions page"
--- a/testing/sisyphus/bin/library.sh
+++ b/testing/sisyphus/bin/library.sh
@@ -392,17 +392,17 @@ if [[ -z "$LIBRARYSH" ]]; then
     TEST_STARTUP_TIMEOUT=${TEST_STARTUP_TIMEOUT:-30}
     TEST_MACHINE=`uname -n`
 
     kernel_name=`uname -s`
 
     if [[ $kernel_name == 'Linux' ]]; then
         OSID=linux
         EXE_EXT=
-        TEST_KERNEL=`uname -r | sed 's|\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)[-.0-9]*\.\([a-zA-Z0-9]*\)|\1.\2.\3|'`
+        TEST_KERNEL=`uname -r | sed 's|\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*|\1.\2.\3|'`
         TEST_PROCESSORTYPE=`cat /proc/cpuinfo | grep vendor | uniq | sed 's|vendor.* : \(.*\)|\1|'`
         TIMECOMMAND='/usr/bin/time -f "Elapsed time %e seconds, User %U seconds, System %S seconds, CPU %P, Memory: %M"'
 
         if echo $TEST_PROCESSORTYPE | grep -q 'Intel'; then
             TEST_PROCESSORTYPE=intel
         elif echo $TEST_PROCESSORTYPE | grep -q 'AMD'; then
             TEST_PROCESSORTYPE=amd
         fi
--- a/testing/sisyphus/bin/set-build-env.sh
+++ b/testing/sisyphus/bin/set-build-env.sh
@@ -142,64 +142,170 @@ for step in step1; do # dummy loop for h
     if [[ -n "$MOZ_CO_DATE" ]]; then
         if [[ $branch == "1.8.0" || $branch == "1.8.1" || $branch == "1.9.0" ]]; then
             export DATE_CO_FLAGS="-D \"$MOZ_CO_DATE\""
         else
             export DATE_CO_FLAGS="--date \"<$MOZ_CO_DATE\""
         fi
     fi
 
-    case $OSID in 
+    # use BUILDPATH to record the PATH to be used during build
+    # related scripts. This is used to pass MSYS specific PATHs
+    # to mozilla-build on Windows.
+    export BUILDPATH="$PATH"
+    case $OSID in
         nt)
 
             # On Windows, Sisyphus is run under Cygwin, so the OS will be CYGWIN
             # regardless. Check if mozilla-build has been installed to the default
             # location, and if so, set up to call mozilla-build to perform the actual
             # build steps.
-            # 
+            #
             # To make life simpler, change the mount point of the C: drive in cygwin from
             # /cygdrive/c to /c via mount -c /
             # which will make paths to non cygwin and non msys locations identical between cygwin
             # and msys, e.g. /c/work will work in both to point to c:\work
-            # 
+            #
+            # It is also necessary to set the /tmp path in cygwin and msys to point to the
+            # same physical directory.
+            #
             # Note that all commands *except* make client.mk will be performed in cygwin.
             #
             # Note that when calling a command string of the form $buildbash --login -c "command",
-            # you must cd to the desired directory as part of "command" since msys will set the 
+            # you must cd to the desired directory as part of "command" since msys will set the
             # directory to the home directory prior to executing the command.
 
-            if [[ -e "/c/mozilla-build" && $branch != "1.8.0" ]]; then
-                export PYTHON=/c/mozilla-build/python25/python
-                export BUILDDIR=${BUILDDIR:-/c/work/mozilla/builds}
-                export buildbash="/c/mozilla-build/msys/bin/bash"
-                export bashlogin=--login # this is for msys' bash.
+            export mozillabuild=${mozillabuild:-/c/mozilla-build}
+            export PYTHON=$mozillabuild/python25/python
+            export BUILDDIR=${BUILDDIR:-/c/work/mozilla/builds}
+            export buildbash="$mozillabuild/msys/bin/bash"
+            export bashlogin=--login # this is for msys' bash.
+
+            # determine installed compilers
+            export MSVCROOTKEY="/machine/SOFTWARE/Microsoft/VisualStudio"
+            export MSVC6KEY="$MSVCROOTKEY/6.0/Setup/Microsoft Visual C++"
+            export MSVC71KEY="$MSVCROOTKEY/7.1/Setup/VC"
+            export MSVC8KEY="$MSVCROOTKEY/8.0/Setup/VC"
+            export MSVC8EXPRESSKEY="/machine/SOFTWARE/Microsoft/VCExpress/8.0/Setup/VC"
+            export MSVC9KEY="$MSVCROOTKEY/9.0/Setup/VC"
+            export MSVC9EXPRESSKEY="/machine/SOFTWARE/Microsoft/VCExpress/9.0/Setup/VC"
+
+            if [[ -z "$VC6DIR" ]]; then
+                export VC6DIR=`regtool get "$MSVC6KEY/ProductDir" 2> /dev/null`
+            fi
 
-                if echo $branch | egrep -q '^1\.8'; then
-                    export MOZ_TOOLS=${MOZ_TOOLS:-"/c/mozilla-build/moztools-180compat"}
-                    export SET_MSVC_ENV=${SET_MSVC_ENV:-${TEST_DIR}/bin/set-msvc6-env.sh}
-                else
-                    export MOZ_TOOLS=${MOZ_TOOLS:-"/c/mozilla-build/moztools"}
-                    export SET_MSVC_ENV=${SET_MSVC_ENV:-${TEST_DIR}/bin/set-msvc8-env.sh}
-                fi
+            if [[ -z "$VC71DIR" ]]; then
+                export VC71DIR=`regtool get "$MSVC71KEY/ProductDir" 2> /dev/null`
+            fi
+
+            if [[ -z "$VC8DIR" ]]; then
+                export VC8DIR=`regtool get "$MSVC8KEY/ProductDir" 2> /dev/null`
+            fi
 
-            else
-                export BUILDDIR=${BUILDDIR:-/work/mozilla/builds}
-                export buildbash="/bin/bash"
-                export bashlogin=-l
+            if [[ -z "$VC8EXPRESSDIR" ]]; then
+                export VC8EXPRESSDIR=`regtool get "$MSVC8EXPRESSKEY/ProductDir" 2> /dev/null`
+            fi
 
-                if echo $branch | egrep -q '^1\.8'; then
-                    export MOZ_TOOLS=${MOZ_TOOLS:-"$BUILDDIR/moztools"}
-                    export SET_MSVC_ENV=${SET_MSVC_ENV:-${TEST_DIR}/bin/set-msvc6-env.sh}
-                else
-                    export MOZ_TOOLS=${MOZ_TOOLS:-"$BUILDDIR/moztools-static"}
-                    export SET_MSVC_ENV=${SET_MSVC_ENV:-${TEST_DIR}/bin/set-msvc8-env.sh}
-                fi
+            if [[ -z "$VC9DIR" ]]; then
+                export VC9DIR=`regtool get "$MSVC9KEY/ProductDir" 2> /dev/null`
+            fi
+
+            if [[ -z "$VC9EXPRESSDIR" ]]; then
+                export VC9EXPRESSDIR=`regtool get "$MSVC9EXPRESSKEY/ProductDir" 2> /dev/null`
             fi
 
-            source $SET_MSVC_ENV
+            case $branch in
+                1.8.0)
+                    # only msvc6 supported
+                    if [[ -n "$VC6DIR" ]]; then
+                        startbat=start-msvc6.bat
+                    fi
+                    ;;
+                1.8.1)
+                    # msvc6 official, vc7.1 (2003) supported
+                    if [[ -n "$VC6DIR" ]]; then
+                        startbat=start-msvc6.bat
+                    elif [[ -n "$VC71DIR" ]]; then
+                        startbat=start-msvc71.bat
+                    fi
+                    ;;
+                1.9.0|1.9.1|1.9.2)
+                    # msvc8 official, vc7.1, (2003), vc9 (2009) supported
+                    if [[ -n "$VC8DIR" ]]; then
+                        startbat=start-msvc8.bat
+                        # set VCINSTALLDIR for use in detecting the MS CRT
+                        # source when building jemalloc.
+                        VCINSTALLDIR=$VC8DIR
+                    elif [[ -n "$VC8EXPRESSDIR" ]]; then
+                        startbat=start-msvc8.bat
+                    elif [[ -n "$VC71DIR" ]]; then
+                        startbat=start-msvc71.bat
+                    elif [[ -n "$VC9DIR" || -n "$VC9EXPRESSDIR" ]]; then
+                        startbat=start-msvc9.bat
+                    fi
+                    ;;
+                *)
+                    ;;
+            esac
+
+            if [[ -z "$startbat" ]]; then
+                myexit 2
+            fi
+
+            startbat="$mozillabuild/$startbat"
+
+            # The start batch file changes directory and starts an msys bash shell
+            # which will block its execution. Create a working copy without the
+            # bash invocation to just set the environment variables and save them
+            # to ~/mozilla-build-env.dat.
+            varsbat=`echo $startbat | sed 's|start|vars|'`;
+            if [[ ! -e "$varsbat" ]]; then
+                sed 's|\(^cd.*USERPROFILE.*\)|rem \1|; s|\(^.*MOZILLABUILD.*bash.*\)|\1 -c "set > ~/mozilla-build-env.dat"|' $startbat > $varsbat
+            fi
+
+            # call the windows command line to execute the new batch file
+            varsbat=`cygpath -w "$varsbat"`
+            cmd /c "$varsbat"
+            # escape the windows path delimiter \ in the mozilla-build-env.dat
+            sed -i.bak 's|\\|\\\\\\\\|g' ~/mozilla-build-env.dat
+            # set IFS to bel in order to read full line including leading whitespace.
+            saveIFS=$IFS
+            IFS=`echo -e '\007'`
+            # read from ~/mozilla-build-env.dat without forking a process
+            # see "Advanced Bash-Scripting Guide" 19-4. Avoiding a subshell
+            exec 3< ~/mozilla-build-env.dat
+            while read line <&3; do
+                if ! echo "$line" | grep -q '^[a-zA-Z_0-9]*=[^(]'; then
+                    # skip function definitions
+                    continue
+                fi
+                name="`echo $line | sed 's|\(^[a-zA-Z_0-9]*\)=.*|\1|'`"
+                if [[ "$name" == "_" ]]; then
+                    continue
+                fi
+                if [[ "$name" == "BASH_EXECUTION_STRING" ]]; then
+                    continue
+                fi
+                eval "var=\$$name"
+                # remove any single quotes around the value
+                value="`echo $line | sed \"s|^[a-zA-Z_0-9]*='*\([^']*\)'*|\1|\"`"
+                if [[ -z "$var" ]]; then
+                    # variable is not defined, i.e. was defined by the batch file.
+                    # export it into the current process.
+                    eval "export $name=\"$value\""
+                elif [[ "$name" == "PATH" ]]; then
+                    # convert msys relative paths to paths relative to /c/.
+                    value=`echo "$value" | sed 's|/local/bin|/c/mozilla-build/msys/local/bin|' | sed 's|:/usr/local/bin:/mingw/bin:/bin:|:/c/mozilla-build/msys/usr/local/bin:/c/mozilla-build/msys/mingw/bin:/c/mozilla-build/msys/bin:|'`
+                    eval "export BUILDPATH=\"$value:$PATH\""
+                fi
+            done
+            IFS=$saveIFS
+            # close mozilla-build-env.dat
+            exec 3>&-
+
             echo moztools Location: $MOZ_TOOLS
 
             # now convert TEST_DIR and BUILDDIR to cross compatible paths using
             # the common cygdrive prefix for cygwin and msys
             TEST_DIR_WIN=`cygpath -w $TEST_DIR`
             BUILDDIR_WIN=`cygpath -w $BUILDDIR`
             TEST_DIR=`cygpath -u $TEST_DIR_WIN`
             BUILDDIR=`cygpath -u $BUILDDIR_WIN`
@@ -213,18 +319,18 @@ for step in step1; do # dummy loop for h
             # if a 64 bit linux system, assume the 
             # compiler is in the standard reference
             # location /tools/gcc/bin/
             case "$TEST_PROCESSORTYPE" in
                 *64)
                     export PATH=/tools/gcc/bin:$PATH
                     ;;
             esac
-            
             ;;
+
         darwin)
             export BUILDDIR=${BUILDDIR:-/work/mozilla/builds}
             export buildbash="/bin/bash"
             export bashlogin=-l
             ;;
         *)
             ;;
     esac
deleted file mode 100755
--- a/testing/sisyphus/bin/set-msvc6-env.sh
+++ /dev/null
@@ -1,78 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is mozilla.org code.
-#
-# The Initial Developer of the Original Code is
-# Mozilla Corporation.
-# Portions created by the Initial Developer are Copyright (C) 2006.
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#  Bob Clary <bob@bclary.com>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-echo Setting environment for using Microsoft Visual Studio 6
-
-# Visual Studio 6 Installation Directory
-export VS6INSTALLDIR=${VS6INSTALLDIR:-'C:\Program Files\Microsoft Visual Studio'}
-
-# Root of Visual Developer Studio Common files.
-export VSCommonDir="$VS6INSTALLDIR\\Common"
-export VSCommonDir_cyg=`cygpath -u "$VSCommonDir"`
-
-# Root of Visual Developer Studio installed files.
-export MSDevDir="$VSCommonDir\\MSDev98"
-export MSDevDir_cyg=`cygpath -u "$MSDevDir"`
-
-# Root of Visual C++ installed files.
-export MSVCDir="$VS6INSTALLDIR\\VC98"
-export MSVCDir_cyg=`cygpath -u "$MSVCDir"`
-
-# VcOsDir is used to help create either a Windows 95 or Windows NT specific path.
-export VcOsDir=WIN95
-if [[ "$OS" == "Windows_NT" ]]; then
-    export VcOsDir=WINNT
-fi
-
-if [[ "$OS" == "Windows_NT" ]]; then
-    export PATH="$MSDevDir_cyg/Bin":"$MSVCDir_cyg/Bin":"$VSCommonDir_cyg/Tools/$VcOsDir":"$VSCommonDir_cyg/Tools":"$MOZ_TOOLS/bin":"$PATH"
-elif [[ "$OS" == "" ]]; then
-    export PATH="$MSDevDir_cyg/Bin":"MSVCDir_cyg/Bin":"$VSCommonDir_cyg/Tools/$VcOsDir":"$VSCommonDir_cyg/Tools":"$windir/SYSTEM":$MOZ_TOOLS/bin:"$PATH"
-fi
-
-export INCLUDE="$MSVCDir\\ATL\\Include;$MSVCDir\\Include;$MSVCDir\\MFC\\Include;$INCLUDE"
-export LIB="$MSVCDir\\Lib;$MSVCDir\\MFC\\Lib;$LIB"
-
-unset VcOsDir
-unset VSCommonDir
-
-# necessary for msys' /etc/profile.d/profile-extrapaths.sh to set properly
-if [[ -d "/c/mozilla-build" ]]; then
-    export MOZILLABUILD='C:\\mozilla-build\\'
-fi
-
-
deleted file mode 100755
--- a/testing/sisyphus/bin/set-msvc8-env.sh
+++ /dev/null
@@ -1,126 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is mozilla.org code.
-#
-# The Initial Developer of the Original Code is
-# Mozilla Corporation.
-# Portions created by the Initial Developer are Copyright (C) 2006.
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#  Bob Clary <bob@bclary.com>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-echo Setting environment for using Microsoft Visual Studio 8
-
-export VS8INSTALLDIR=${VS8INSTALLDIR:-'C:\Program Files\Microsoft Visual Studio 8'}
-export VS8COMNTOOLS="$VS8INSTALLDIR\\Common7\\Tools\\"
-export VCINSTALLDIR="$VS8INSTALLDIR\\VC"
-export FrameworkDir=${FrameworkDir:-'C:\WINDOWS\Microsoft.NET\Framework'}
-export FrameworkVersion=${FrameworkVersion:-'v2.0.50727'}
-export FrameworkSDKDir="$VS8INSTALLDIR\\SDK\\v2.0"
-export DevEnvDir="$VS8INSTALLDIR\\Common7\\IDE"
-export MSVCDir="$VS8INSTALLDIR\\VC"
-export PlatformSDKDir="$MSVCDir"\\PlatformSDK
-
-# Windows SDK 6 or later is required after https://bugzilla.mozilla.org/show_bug.cgi?id=412374
-# v6.0 - Windows SDK Update for Vista
-# v6.1 - Windows SDK for Windows Server 2008
-export WindowsSDK6=${WindowsSDK6:-'c:\Program Files\Microsoft SDKs\Windows\v6.0'}
-export WindowsSDK6_cyg=`cygpath -u "$WindowsSDK6"`
-
-if [[ ! -d "$WindowsSDK6_cyg" ]]; then
-    export WindowsSDK6='c:\Program Files\Microsoft SDKs\Windows\v6.1'
-    export WindowsSDK6_cyg=`cygpath -u "$WindowsSDK6"`
-fi
-
-export VS8INSTALLDIR_cyg=`cygpath -u "$VS8INSTALLDIR"`
-export VS8COMNTOOLS_cyg=`cygpath -u "$VS8COMNTOOLS"`
-export VCINSTALLDIR_cyg=`cygpath -u "$VCINSTALLDIR"`
-export FrameworkDir_cyg=`cygpath -u "$FrameworkDir"`
-export DevEnvDir_cyg=`cygpath -u "$DevEnvDir"`
-export MSVCDir_cyg=`cygpath -u "$VCINSTALLDIR"`
-export PlatformSDKDir_cyg=`cygpath -u "$PlatformSDKDir"`
-
-if [ ! -d "$PlatformSDKDir_cyg" ] ; then
-    echo "Can not find Platform SDK at $PlatformSDKDir_cyg"
-    break 2
-fi
-
-echo Platform SDK Location: $PlatformSDKDir_cyg
-
-if [ ! -d "$WindowsSDK6_cyg" ] ; then
-    echo "Can not find Windows SDK 6 at $WindowsSDK6_cyg"
-    break 2
-fi
-
-echo Windows SDK Location: $WindowsSDK6_cyg
-
-if [ ! -f "$MOZ_TOOLS"/lib/libIDL-0.6_s.lib ] ; then
-    echo "Can not find moztools at $MOZ_TOOLS"
-    break 2
-fi
-
-export PATH="\
-$WindowsSDK6_cyg/bin:\
-$DevEnvDir_cyg:\
-$MSVCDir_cyg/bin:\
-$VS8COMNTOOLS_cyg:\
-$VS8COMNTOOLS_cyg/bin:\
-$PlatformSDKDir_cyg/bin:\
-$FrameworkSDKDir_cyg/bin:\
-$FrameworkDir_cyg/$FrameworkVersion:\
-$MSVCDir/VCPackages:\
-$MOZ_TOOLS/bin:\
-$PATH"
-
-export INCLUDE="\
-$WindowsSDK6\\include;\
-$WindowsSDK6\\include\\atl;\
-$MSVCDir\\ATLMFC\\INCLUDE;\
-$MSVCDir\\INCLUDE;\
-$PlatformSDKDir\\include;\
-$FrameworkSDKDir\\include;\
-$INCLUDE"
-
-export LIB="\
-$WindowsSDK6\\lib;\
-$MSVCDir\\ATLMFC\\LIB;\
-$MSVCDir\\LIB;\
-$PlatformSDKDir\\lib;\
-$FrameworkSDKDir\\lib;\
-$LIB" 
-
-export LIBPATH="\
-$FrameworkDir\\$FrameworkVersion;\
-$MSVCDir\\ATLMFC\\LIB\
-"
-# necessary for msys' /etc/profile.d/profile-extrapaths.sh to set properly
-if [[ -d "/c/mozilla-build" ]]; then
-    export MOZILLABUILD='C:\\mozilla-build\\'
-fi
-