Bug 1479672 - Remove need to set GECKO_DIR when running build-haz-linux.sh, and fix shell lint warnings, r=jonco
authorSteve Fink <sfink@mozilla.com>
Thu, 02 Aug 2018 09:57:58 -0700
changeset 489820 5dc260a940fb4c7e4804ae08de3fa853d8b46c2b
parent 489819 d67c4217db0bb9d96cb36f8eca1ca5cc755837ab
child 489821 8308ccadecfad676d2316242014a30d118b9b17d
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersjonco
bugs1479672
milestone64.0a1
Bug 1479672 - Remove need to set GECKO_DIR when running build-haz-linux.sh, and fix shell lint warnings, r=jonco
taskcluster/scripts/builder/build-haz-linux.sh
--- a/taskcluster/scripts/builder/build-haz-linux.sh
+++ b/taskcluster/scripts/builder/build-haz-linux.sh
@@ -22,61 +22,65 @@ while [[ $# -gt 0 ]]; do
         DO_TOOLTOOL=
     elif [[ -z "$WORKSPACE" ]]; then
         WORKSPACE=$( cd "$1" && pwd )
         shift
         break
     fi
 done
 
-SCRIPT_FLAGS="$@"
+SCRIPT_FLAGS=$*
 
 # Ensure all the scripts in this dir are on the path....
 DIRNAME=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 PATH=$DIRNAME:$PATH
 
 # Use GECKO_BASE_REPOSITORY as a signal for whether we are running in automation.
 export AUTOMATION=${GECKO_BASE_REPOSITORY:+1}
 
-: ${GECKO_DIR:=$WORKSPACE/gecko}
-: ${TOOLTOOL_CACHE:=$WORKSPACE/tt-cache}
+: "${GECKO_DIR:="$DIRNAME"/../../..}"
+: "${TOOLTOOL_CACHE:=$WORKSPACE/tt-cache}"
 
-if ! [ -d $GECKO_DIR ]; then
+if ! [ -d "$GECKO_DIR" ]; then
     echo "GECKO_DIR must be set to a directory containing a gecko source checkout" >&2
     exit 1
 fi
-GECKO_DIR=$( cd "$GECKO_DIR" && pwd )
+GECKO_DIR="$( cd "$GECKO_DIR" && pwd )"
 
 # Directory to populate with tooltool-installed tools
 export TOOLTOOL_DIR="$WORKSPACE"
 
 # Directory to hold the (useless) object files generated by the analysis.
 export MOZ_OBJDIR="$WORKSPACE/obj-analyzed"
 mkdir -p "$MOZ_OBJDIR"
 
-if [ -n "$DO_TOOLTOOL" ]; then
-  ( cd $TOOLTOOL_DIR; $GECKO_DIR/mach artifact toolchain -v${TOOLTOOL_MANIFEST:+ --tooltool-url https://tooltool.mozilla-releng.net/ --tooltool-manifest $GECKO_DIR/$TOOLTOOL_MANIFEST} --cache-dir $TOOLTOOL_CACHE${MOZ_TOOLCHAINS:+ ${MOZ_TOOLCHAINS}} )
-fi
+if [ -n "$DO_TOOLTOOL" ]; then (
+    cd "$TOOLTOOL_DIR"
+    "$GECKO_DIR"/mach artifact toolchain -v\
+                ${TOOLTOOL_MANIFEST:+ --tooltool-url https://tooltool.mozilla-releng.net/ \
+                                      --tooltool-manifest "$GECKO_DIR/$TOOLTOOL_MANIFEST"} \
+                --cache-dir "$TOOLTOOL_CACHE"${MOZ_TOOLCHAINS:+ ${MOZ_TOOLCHAINS}}
+) fi
 
 export NO_MERCURIAL_SETUP_CHECK=1
 
 if [[ "$PROJECT" = "browser" ]]; then (
     cd "$WORKSPACE"
     set "$WORKSPACE"
     # Mozbuild config:
     export MOZBUILD_STATE_PATH=$WORKSPACE/mozbuild/
     # Create .mozbuild so mach doesn't complain about this
-    mkdir -p $MOZBUILD_STATE_PATH
+    mkdir -p "$MOZBUILD_STATE_PATH"
 ) fi
 . hazard-analysis.sh
 
 build_js_shell
 
 # Artifacts folder is outside of the cache.
-mkdir -p $HOME/artifacts/ || true
+mkdir -p "$HOME"/artifacts/ || true
 
 function onexit () {
     grab_artifacts "$WORKSPACE/analysis" "$HOME/artifacts"
 }
 
 trap onexit EXIT
 
 configure_analysis "$WORKSPACE/analysis"