Bug 1265817 - Update gecko-rust-build to v0.2.1. r?dustin
- Move to quay.io/rust builder base.
- Set stable channel to work around compatibility checks with upstream
rust-std builds.
- Updates for stable rust changes.
- Rough repack script for packaging upstream builds for tooltool.
Merge changes from https://github.com/rillian/rust-build tag v0.2.1.
MozReview-Commit-ID: 4rcrUCg2CSw
--- a/testing/docker/rust-build/Dockerfile
+++ b/testing/docker/rust-build/Dockerfile
@@ -1,9 +1,9 @@
-FROM quay.io/rillian/rust-buildbot
+FROM quay.io/rust/rust-buildbot
MAINTAINER Ralph Giles <giles@mozilla.com>
# Reset user/workdir from parent image so we can install software.
WORKDIR /
USER root
# Update base.
RUN yum upgrade -y
@@ -11,16 +11,17 @@ RUN yum clean all
# Install tooltool directly from github.
RUN mkdir /builds
ADD https://raw.githubusercontent.com/mozilla/build-tooltool/master/tooltool.py /build/tooltool.py
RUN chmod +rx /build/tooltool.py
# Add build scripts.
ADD fetch_rust.sh build_rust.sh upload_rust.sh /build/
+ADD repack_rust.sh /build/
RUN chmod +x /build/*
# Create user for doing the build.
ENV USER worker
ENV HOME /home/${USER}
RUN useradd -d ${HOME} -m ${USER}
--- a/testing/docker/rust-build/VERSION
+++ b/testing/docker/rust-build/VERSION
@@ -1,1 +1,1 @@
-0.2.0
+0.2.1
--- a/testing/docker/rust-build/build_rust.sh
+++ b/testing/docker/rust-build/build_rust.sh
@@ -4,26 +4,27 @@ set -x -e
: WORKSPACE ${WORKSPACE:=/home/worker}
CORES=$(nproc || grep -c ^processor /proc/cpuinfo || sysctl -n hw.ncpu)
set -v
# Configure and build rust.
-OPTIONS="--enable-rpath --enable-llvm-static-stdcpp --disable-docs"
+OPTIONS="--enable-llvm-static-stdcpp --disable-docs --release-channel=stable"
x32="i686-unknown-linux-gnu"
x64="x86_64-unknown-linux-gnu"
arm="arm-linux-androideabi"
mkdir -p ${WORKSPACE}/rust-build
pushd ${WORKSPACE}/rust-build
${WORKSPACE}/rust/configure --prefix=${WORKSPACE}/rustc \
--target=${x64},${x32} ${OPTIONS}
make -j ${CORES}
+make dist
make install
popd
# Package the toolchain for upload.
pushd ${WORKSPACE}
tar cvJf rustc.tar.xz rustc/*
-/build/tooltool.py add --visibility=public rustc.tar.xz
+/build/tooltool.py add --visibility=public --unpack rustc.tar.xz
popd
--- a/testing/docker/rust-build/build_rust_mac.sh
+++ b/testing/docker/rust-build/build_rust_mac.sh
@@ -1,16 +1,16 @@
#!/bin/bash -vex
: WORKSPACE ${WORKSPACE:=$PWD}
CORES=$(nproc || grep -c ^processor /proc/cpuinfo || sysctl -n hw.ncpu)
echo Building on $CORES cpus...
-OPTIONS="--enable-rpath --disable-elf-tls --disable-docs"
+OPTIONS="--disable-elf-tls --disable-docs"
TARGETS="x86_64-apple-darwin,i686-apple-darwin"
PREFIX=${WORKSPACE}/rustc
mkdir -p ${WORKSPACE}/gecko-rust-mac
pushd ${WORKSPACE}/gecko-rust-mac
export MACOSX_DEPLOYMENT_TARGET=10.7
new file mode 100644
--- /dev/null
+++ b/testing/docker/rust-build/repack_rust.sh
@@ -0,0 +1,160 @@
+#!/bin/bash -vex
+
+set -e
+
+# Set verbose options on taskcluster for logging.
+test -n "$TASK_ID" && set -x
+
+# Inputs, with defaults
+
+: RUST_URL ${RUST_URL:=https://static.rust-lang.org/dist/}
+: RUST_CHANNEL ${RUST_CHANNEL:=stable}
+
+: WORKSPACE ${WORKSPACE:=/home/worker}
+
+die() {
+ echo "ERROR: $@"
+ exit 1
+}
+
+fetch() {
+ echo "Fetching $1..."
+ curl -Os ${RUST_URL}${1}.asc
+ curl -Os ${RUST_URL}${1}
+ curl -Os ${RUST_URL}${1}.sha256
+ curl -Os ${RUST_URL}${1}.asc.sha256
+}
+
+verify() {
+ echo "Verifying $1..."
+ shasum -c ${1}.sha256
+ shasum -c ${1}.asc.sha256
+ gpg --verify ${1}.asc ${1}
+ keybase verify ${1}.asc
+}
+
+fetch_rustc() {
+ arch=$1
+ echo "Retrieving rustc build for $arch..."
+ pkg=$(cat ${IDX} | grep ^rustc | grep $arch)
+ test -n "${pkg}" || die "No rustc build for $arch in the manifest."
+ test 1 == $(echo ${pkg} | wc -w) ||
+ die "Multiple rustc builds for $arch in the manifest."
+ fetch ${pkg}
+ verify ${pkg}
+}
+
+fetch_std() {
+ echo "Retrieving rust-std builds for:"
+ for arch in $@; do
+ echo " $arch"
+ done
+ for arch in $@; do
+ pkg=$(cat ${IDX} | grep rust-std | grep $arch)
+ test -n "${pkg}" || die "No rust-std builds for $arch in the manifest."
+ test 1 == $(echo ${pkg} | wc -w) ||
+ die "Multiple rust-std builds for $arch in the manifest."
+ fetch ${pkg}
+ verify ${pkg}
+ done
+}
+
+install_rustc() {
+ pkg=$(cat ${IDX} | grep ^rustc | grep $1)
+ base=${pkg%%.tar.*}
+ echo "Installing $base..."
+ tar xf ${pkg}
+ ${base}/install.sh ${INSTALL_OPTS}
+ rm -rf ${base}
+}
+
+install_std() {
+ for arch in $@; do
+ for pkg in $(cat ${IDX} | grep rust-std | grep $arch); do
+ base=${pkg%%.tar.*}
+ echo "Installing $base..."
+ tar xf ${pkg}
+ ${base}/install.sh ${INSTALL_OPTS}
+ rm -rf ${base}
+ done
+ done
+}
+
+check() {
+ if test -x ${TARGET}/bin/rustc; then
+ file ${TARGET}/bin/rustc
+ ${TARGET}/bin/rustc --version
+ elif test -x ${TARGET}/bin/rustc.exe; then
+ file ${TARGET}/bin/rustc.exe
+ ${TARGET}/bin/rustc.exe --version
+ else
+ die "ERROR: Couldn't fine rustc executable"
+ fi
+ echo "Installed components:"
+ for component in $(cat ${TARGET}/lib/rustlib/components); do
+ echo " $component"
+ done
+ echo
+}
+
+test -n "$TASK_ID" && set -v
+
+linux64="x86_64-unknown-linux-gnu"
+linux32="i686-unknown-linux-gnu"
+
+android="arm-linux-androideabi"
+
+win64="x86_64-pc-windows-msvc"
+win32="i686-pc-windows-msvc"
+win32_i586="i586-pc-windows-msvc"
+
+# Fetch the manifest
+
+IDX=channel-rustc-${RUST_CHANNEL}
+
+fetch ${IDX}
+verify ${IDX}
+
+TARGET=rustc
+INSTALL_OPTS="--prefix=${PWD}/${TARGET} --disable-ldconfig"
+
+# Repack the linux64 builds.
+
+fetch_rustc $linux64
+fetch_std $linux64 $linux32
+
+rm -rf ${TARGET}
+
+install_rustc $linux64
+install_std $linux64 $linux32
+
+tar cJf rustc-$linux64-repack.tar.xz ${TARGET}/*
+check ${TARGET}
+
+# Repack the win64 builds.
+
+fetch_rustc $win64
+fetch_std $win64
+
+rm -rf ${TARGET}
+
+install_rustc $win64
+install_std $win64
+
+tar cjf rustc-$win64-repack.tar.bz2 ${TARGET}/*
+check ${TARGET}
+
+# Repack the win32 builds.
+
+fetch_rustc $win32
+fetch_std $win32 $win32_i586
+
+rm -rf ${TARGET}
+
+install_rustc $win32
+install_std $win32 $win32_i586
+
+tar cjf rustc-$win32-repack.tar.bz2 ${TARGET}/*
+check ${TARGET}
+
+rm -rf ${TARGET}
--- a/testing/docker/rust-build/upload_rust.sh
+++ b/testing/docker/rust-build/upload_rust.sh
@@ -1,16 +1,14 @@
#!/bin/bash -vex
set -x -e
: WORKSPACE ${WORKSPACE:=/home/worker}
-CORES=$(nproc || grep -c ^processor /proc/cpuinfo || sysctl -n hw.ncpu)
-
set -v
# Upload artifacts packaged by the build script.
pushd ${WORKSPACE}
if test -n "$TASK_ID"; then
# If we're running on task cluster, use the upload-capable tunnel.
TOOLTOOL_OPTS="--url=http://relengapi/tooltool/"
MESSAGE="Taskcluster upload ${TASK_ID}/${RUN_ID} $0"