Bug 1356933 - Use tooltool-download.sh helper in cctools build scripts. r=chmanchester draft
authorMike Hommey <mh+mozilla@glandium.org>
Mon, 17 Apr 2017 08:34:24 +0900
changeset 564034 7c96c67ec24f5105ed73ad241ad3b7d6596f22de
parent 564033 e3fd79ba263d76dae2f7de09b62a4764033d2f18
child 564075 b11686940cda1084b2017b7780101af3e890363e
push id54499
push userbmo:mh+mozilla@glandium.org
push dateTue, 18 Apr 2017 07:41:57 +0000
reviewerschmanchester
bugs1356933
milestone55.0a1
Bug 1356933 - Use tooltool-download.sh helper in cctools build scripts. r=chmanchester While here, since the tooltool call from the cctools build scripts was verbose, make the one in tooltool-download.sh verbose. It will benefit the other things using tooltool-download.sh, making debugging easier when one needs to look at the tooltool download logs...
taskcluster/ci/toolchain/linux.yml
taskcluster/ci/toolchain/macosx.yml
taskcluster/scripts/misc/build-cctools-port-macosx.sh
taskcluster/scripts/misc/build-cctools-port.sh
taskcluster/scripts/misc/tooltool-download.sh
--- a/taskcluster/ci/toolchain/linux.yml
+++ b/taskcluster/ci/toolchain/linux.yml
@@ -92,16 +92,19 @@ linux64-cctools-port/opt:
     worker-type: aws-provisioner-v1/gecko-{level}-b-linux
     worker:
         implementation: docker-worker
         docker-image: {in-tree: desktop-build}
         max-run-time: 36000
     run:
         using: toolchain-script
         script: build-cctools-port.sh
+        tooltool-downloads: public
+        resources:
+            - 'taskcluster/scripts/misc/tooltool-download.sh'
 
 linux64-hfsplus/opt:
     description: "hfsplus toolchain build"
     treeherder:
         kind: build
         platform: toolchains/opt
         symbol: TL(hfs+)
         tier: 1
--- a/taskcluster/ci/toolchain/macosx.yml
+++ b/taskcluster/ci/toolchain/macosx.yml
@@ -57,8 +57,10 @@ macosx64-cctools-port/opt:
     worker:
         implementation: docker-worker
         docker-image: {in-tree: desktop-build}
         max-run-time: 36000
     run:
         using: toolchain-script
         script: build-cctools-port-macosx.sh
         tooltool-downloads: internal
+        resources:
+            - 'taskcluster/scripts/misc/tooltool-download.sh'
--- a/taskcluster/scripts/misc/build-cctools-port-macosx.sh
+++ b/taskcluster/scripts/misc/build-cctools-port-macosx.sh
@@ -9,48 +9,44 @@ UPLOAD_DIR=$WORKSPACE/artifacts
 # Repository info
 : CROSSTOOL_PORT_REPOSITORY    ${CROSSTOOL_PORT_REPOSITORY:=https://github.com/tpoechtrager/cctools-port}
 : CROSSTOOL_PORT_REV           ${CROSSTOOL_PORT_REV:=8e9c3f2506b51cf56725eaa60b6e90e240e249ca}
 
 # Set some crosstools-port directories
 CROSSTOOLS_SOURCE_DIR=$WORKSPACE/crosstools-port
 CROSSTOOLS_CCTOOLS_DIR=$CROSSTOOLS_SOURCE_DIR/cctools
 CROSSTOOLS_BUILD_DIR=/tmp/cctools
-CLANG_DIR=$WORKSPACE/clang
-CCTOOLS_DIR=$WORKSPACE/cctools
-MACOSX_SDK_DIR=$WORKSPACE/MacOSX10.10.sdk
+CLANG_DIR=$WORKSPACE/build/src/clang
+CCTOOLS_DIR=$WORKSPACE/build/src/cctools
+MACOSX_SDK_DIR=$WORKSPACE/build/src/MacOSX10.10.sdk
 
 TARGET_TRIPLE=x86_64-apple-darwin11
 
 # Create our directories
 mkdir -p $CROSSTOOLS_BUILD_DIR
 
 git clone --no-checkout $CROSSTOOL_PORT_REPOSITORY $CROSSTOOLS_SOURCE_DIR
 cd $CROSSTOOLS_SOURCE_DIR
 git checkout $CROSSTOOL_PORT_REV
 echo "Building from commit hash `git rev-parse $CROSSTOOL_PORT_REV`..."
 
 # Fetch clang from tooltool
-cd $WORKSPACE
-wget -O tooltool.py https://raw.githubusercontent.com/mozilla/build-tooltool/master/tooltool.py
-chmod +x tooltool.py
-: TOOLTOOL_CACHE                ${TOOLTOOL_CACHE:=/home/worker/tooltool-cache}
-export TOOLTOOL_CACHE
-
-wget ${GECKO_HEAD_REPOSITORY}/raw-file/${GECKO_HEAD_REV}/browser/config/tooltool-manifests/macosx64/cross-clang.manifest
-
-python tooltool.py -v --manifest=cross-clang.manifest --url=http://relengapi/tooltool/ fetch
+cd $WORKSPACE/build/src
+TOOLTOOL_MANIFEST=browser/config/tooltool-manifests/macosx64/cross-clang.manifest
+. taskcluster/scripts/misc/tooltool-download.sh
 
 # Configure crosstools-port
 cd $CROSSTOOLS_CCTOOLS_DIR
 export CC=$CLANG_DIR/bin/clang
 export CXX=$CLANG_DIR/bin/clang++
 export CFLAGS="-mcpu=generic -mtune=generic -O3 -target $TARGET_TRIPLE -isysroot $MACOSX_SDK_DIR"
 export CXXFLAGS="-mcpu=generic -mtune=generic -O3 -target $TARGET_TRIPLE -isysroot $MACOSX_SDK_DIR"
 export LDFLAGS="-Wl,-syslibroot,$MACOSX_SDK_DIR -Wl,-dead_strip"
+# TODO: bug 1357317 to avoid the LD_LIBRARY_PATH.
+export LD_LIBRARY_PATH="$CLANG_DIR/lib"
 export PATH="$CCTOOLS_DIR/bin:$PATH"
 ./autogen.sh
 ./configure --prefix=$CROSSTOOLS_BUILD_DIR --build=$MACHTYPE --host=$TARGET_TRIPLE --with-llvm-config=$CLANG_DIR/bin/llvm-config
 
 # Build cctools
 make -j `nproc --all` install
 $CCTOOLS_DIR/bin/$TARGET_TRIPLE-strip $CROSSTOOLS_BUILD_DIR/bin/*
 
--- a/taskcluster/scripts/misc/build-cctools-port.sh
+++ b/taskcluster/scripts/misc/build-cctools-port.sh
@@ -9,36 +9,30 @@ UPLOAD_DIR=$WORKSPACE/artifacts
 # Repository info
 : CROSSTOOL_PORT_REPOSITORY    ${CROSSTOOL_PORT_REPOSITORY:=https://github.com/tpoechtrager/cctools-port}
 : CROSSTOOL_PORT_REV           ${CROSSTOOL_PORT_REV:=8e9c3f2506b51cf56725eaa60b6e90e240e249ca}
 
 # Set some crosstools-port directories
 CROSSTOOLS_SOURCE_DIR=$WORKSPACE/crosstools-port
 CROSSTOOLS_CCTOOLS_DIR=$CROSSTOOLS_SOURCE_DIR/cctools
 CROSSTOOLS_BUILD_DIR=$WORKSPACE/cctools
-CLANG_DIR=$WORKSPACE/clang
+CLANG_DIR=$WORKSPACE/build/src/clang
 
 # Create our directories
 mkdir -p $CROSSTOOLS_BUILD_DIR
 
 git clone --no-checkout $CROSSTOOL_PORT_REPOSITORY $CROSSTOOLS_SOURCE_DIR
 cd $CROSSTOOLS_SOURCE_DIR
 git checkout $CROSSTOOL_PORT_REV
 echo "Building from commit hash `git rev-parse $CROSSTOOL_PORT_REV`..."
 
 # Fetch clang from tooltool
-cd $WORKSPACE
-wget -O tooltool.py https://raw.githubusercontent.com/mozilla/build-tooltool/master/tooltool.py
-chmod +x tooltool.py
-: TOOLTOOL_CACHE                ${TOOLTOOL_CACHE:=/home/worker/tooltool-cache}
-export TOOLTOOL_CACHE
-
-wget ${GECKO_HEAD_REPOSITORY}/raw-file/${GECKO_HEAD_REV}/browser/config/tooltool-manifests/linux64/clang.manifest
-
-python tooltool.py -v --manifest=clang.manifest fetch
+cd $WORKSPACE/build/src
+TOOLTOOL_MANIFEST=browser/config/tooltool-manifests/linux64/clang.manifest
+. taskcluster/scripts/misc/tooltool-download.sh
 
 # Configure crosstools-port
 cd $CROSSTOOLS_CCTOOLS_DIR
 export CC=$CLANG_DIR/bin/clang
 export CXX=$CLANG_DIR/bin/clang++
 export LDFLAGS=/lib64/libpthread.so.0
 ./autogen.sh
 ./configure --prefix=$CROSSTOOLS_BUILD_DIR --target=x86_64-apple-darwin11 --with-llvm-config=$CLANG_DIR/bin/llvm-config
--- a/taskcluster/scripts/misc/tooltool-download.sh
+++ b/taskcluster/scripts/misc/tooltool-download.sh
@@ -1,11 +1,11 @@
 # Fetch a tooltool manifest.
 
 cd $HOME/workspace/build/src
 
 chmod +x python/mozbuild/mozbuild/action/tooltool.py
 : TOOLTOOL_CACHE                ${TOOLTOOL_CACHE:=/home/worker/tooltool-cache}
 export TOOLTOOL_CACHE
 
-./python/mozbuild/mozbuild/action/tooltool.py --url=http://relengapi/tooltool/ -m "${TOOLTOOL_MANIFEST}" fetch
+./python/mozbuild/mozbuild/action/tooltool.py -v --url=http://relengapi/tooltool/ -m "${TOOLTOOL_MANIFEST}" fetch
 
 cd $OLDPWD