Reconfigure docker builders to be more modular.

And other various cleanups to the configuration.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@363722 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/docker/debian9/Dockerfile b/utils/docker/debian9/Dockerfile
deleted file mode 100644
index 4530a70..0000000
--- a/utils/docker/debian9/Dockerfile
+++ /dev/null
@@ -1,205 +0,0 @@
-#===- libcxx/utils/docker/debian9/Dockerfile --------------------------------------------------===//
-#
-# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-# See https://llvm.org/LICENSE.txt for license information.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-#===-------------------------------------------------------------------------------------------===//
-
-# Setup the base builder image with the packages we'll need to build GCC and Clang from source.
-FROM launcher.gcr.io/google/debian9:latest AS builder-base
-LABEL maintainer "libc++ Developers"
-
-RUN apt-get update && \
-    apt-get install -y --no-install-recommends \
-      ca-certificates \
-      gnupg \
-      build-essential \
-      wget \
-      subversion \
-      unzip \
-      automake \
-      python \
-      cmake \
-      ninja-build \
-      curl \
-      git \
-      gcc-multilib \
-      g++-multilib \
-      libc6-dev \
-      bison \
-      flex \
-      libtool \
-      autoconf \
-      binutils-dev \
-      binutils-gold \
-      software-properties-common \
-      gnupg \
-      apt-transport-https \
-      sudo \
-      systemd \
-      sysvinit-utils \
-      systemd-sysv && \
-  update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20 && \
-  update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10 && \
-  rm -rf /var/lib/apt/lists/*
-
-
-# Build GCC versions
-FROM builder-base as gcc-48-builder
-LABEL maintainer "libc++ Developers"
-
-ADD scripts/build_gcc_version.sh /tmp/build_gcc_version.sh
-RUN /tmp/build_gcc_version.sh --install /opt/gcc-4.8.5 --branch gcc-4_8_5-release \
-    --cherry-pick ec1cc0263f156f70693a62cf17b254a0029f4852
-
-FROM builder-base as gcc-49-builder
-LABEL maintainer "libc++ Developers"
-
-ADD scripts/build_gcc_version.sh /tmp/build_gcc_version.sh
-RUN /tmp/build_gcc_version.sh --install /opt/gcc-4.9.4 --branch gcc-4_9_4-release
-
-FROM builder-base as gcc-5-builder
-LABEL maintainer "libc++ Developers"
-
-ADD scripts/build_gcc_version.sh /tmp/build_gcc_version.sh
-RUN /tmp/build_gcc_version.sh --install /opt/gcc-5 --branch gcc-5_5_0-release
-
-FROM builder-base as gcc-6-builder
-LABEL maintainer "libc++ Developers"
-
-ADD scripts/build_gcc_version.sh /tmp/build_gcc_version.sh
-RUN /tmp/build_gcc_version.sh --install /opt/gcc-6 --branch gcc-6_5_0-release
-
-FROM builder-base as gcc-7-builder
-LABEL maintainer "libc++ Developers"
-
-ADD scripts/build_gcc_version.sh /tmp/build_gcc_version.sh
-RUN /tmp/build_gcc_version.sh --install /opt/gcc-7 --branch gcc-7_4_0-release
-
-FROM builder-base as gcc-8-builder
-LABEL maintainer "libc++ Developers"
-
-ADD scripts/build_gcc_version.sh /tmp/build_gcc_version.sh
-RUN /tmp/build_gcc_version.sh --install /opt/gcc-8 --branch gcc-8_2_0-release
-
-FROM builder-base as gcc-tot-builder
-LABEL maintainer "libc++ Developers"
-
-ADD scripts/build_gcc_version.sh /tmp/build_gcc_version.sh
-RUN /tmp/build_gcc_version.sh --install /opt/gcc-tot --branch master
-
-# Build additional LLVM versions
-FROM builder-base as llvm-36-builder
-LABEL maintainer "libc++ Developers"
-
-ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh
-RUN /tmp/build_llvm_version.sh --install /opt/llvm-3.6 --branch release/3.6.x
-
-FROM builder-base as llvm-37-builder
-LABEL maintainer "libc++ Developers"
-
-ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh
-RUN /tmp/build_llvm_version.sh --install /opt/llvm-3.7 --branch release/3.7.x
-
-FROM builder-base as llvm-38-builder
-LABEL maintainer "libc++ Developers"
-
-ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh
-RUN /tmp/build_llvm_version.sh --install /opt/llvm-3.8 --branch release/3.8.x
-
-FROM builder-base as llvm-39-builder
-LABEL maintainer "libc++ Developers"
-
-ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh
-RUN /tmp/build_llvm_version.sh --install /opt/llvm-3.9 --branch release/3.9.x
-
-FROM builder-base as llvm-4-builder
-LABEL maintainer "libc++ Developers"
-
-ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh
-RUN /tmp/build_llvm_version.sh --install /opt/llvm-4.0 --branch release/4.x
-
-FROM builder-base as llvm-5-builder
-LABEL maintainer "libc++ Developers"
-
-ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh
-RUN /tmp/build_llvm_version.sh --install /opt/llvm-5.0 --branch release/5.x
-
-FROM builder-base as llvm-6-builder
-LABEL maintainer "libc++ Developers"
-
-ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh
-RUN /tmp/build_llvm_version.sh --install /opt/llvm-6.0 --branch release/6.x
-
-FROM builder-base as llvm-7-builder
-LABEL maintainer "libc++ Developers"
-
-ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh
-RUN /tmp/build_llvm_version.sh --install /opt/llvm-7.0 --branch release/7.x
-
-FROM builder-base as llvm-8-builder
-LABEL maintainer "libc++ Developers"
-
-ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh
-RUN /tmp/build_llvm_version.sh --install /opt/llvm-8.0 --branch release/8.x
-
-FROM builder-base as llvm-tot-builder
-LABEL maintainer "libc++ Developers"
-
-ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh
-RUN /tmp/build_llvm_version.sh --install /opt/llvm-tot --branch master
-
-
-#===-------------------------------------------------------------------------------------------===//
-# buildslave
-#===-------------------------------------------------------------------------------------------===//
-FROM builder-base AS buildbot
-
-# Copy over the GCC and Clang installations
-COPY --from=gcc-5-builder /opt/gcc-5 /opt/gcc-5
-COPY --from=gcc-tot-builder /opt/gcc-tot /opt/gcc-tot
-COPY --from=llvm-4-builder /opt/llvm-4.0 /opt/llvm-4.0
-
-RUN ln -s /opt/gcc-5/bin/gcc /usr/local/bin/gcc-4.9 && \
-    ln -s /opt/gcc-5/bin/g++ /usr/local/bin/g++-4.9
-
-RUN apt-get update && \
-    apt-get install -y --no-install-recommends \
-    bash-completion \
-    vim \
-    buildbot-slave \
-  && rm -rf /var/lib/apt/lists/*
-
-ADD scripts/install_clang_packages.sh /tmp/install_clang_packages.sh
-RUN /tmp/install_clang_packages.sh && rm /tmp/install_clang_packages.sh
-
-RUN git clone https://git.llvm.org/git/libcxx.git /libcxx
-
-#===-------------------------------------------------------------------------------------------===//
-#  compiler-zoo
-#===-------------------------------------------------------------------------------------------===//
-FROM  buildbot AS compiler-zoo
-LABEL maintainer "libc++ Developers"
-
-# Copy over the GCC and Clang installations
-COPY --from=gcc-48-builder /opt/gcc-4.8.5 /opt/gcc-4.8.5
-COPY --from=gcc-49-builder /opt/gcc-4.9.4 /opt/gcc-4.9.4
-COPY --from=gcc-5-builder /opt/gcc-5   /opt/gcc-5
-COPY --from=gcc-6-builder /opt/gcc-6   /opt/gcc-6
-COPY --from=gcc-7-builder /opt/gcc-7   /opt/gcc-7
-COPY --from=gcc-8-builder /opt/gcc-8   /opt/gcc-8
-COPY --from=gcc-tot-builder /opt/gcc-tot /opt/gcc-tot
-
-COPY --from=llvm-36-builder /opt/llvm-3.6 /opt/llvm-3.6
-COPY --from=llvm-37-builder /opt/llvm-3.7 /opt/llvm-3.7
-COPY --from=llvm-38-builder /opt/llvm-3.8 /opt/llvm-3.8
-COPY --from=llvm-39-builder /opt/llvm-3.9 /opt/llvm-3.9
-COPY --from=llvm-4-builder /opt/llvm-4.0 /opt/llvm-4.0
-COPY --from=llvm-5-builder /opt/llvm-5.0 /opt/llvm-5.0
-COPY --from=llvm-6-builder /opt/llvm-6.0 /opt/llvm-6.0
-COPY --from=llvm-7-builder /opt/llvm-7.0 /opt/llvm-7.0
-COPY --from=llvm-8-builder /opt/llvm-8.0 /opt/llvm-8.0
-COPY --from=llvm-tot-builder /opt/llvm-tot /opt/llvm-tot
-
-
diff --git a/utils/docker/debian9/Dockerfile.base b/utils/docker/debian9/Dockerfile.base
new file mode 100644
index 0000000..56c93f9
--- /dev/null
+++ b/utils/docker/debian9/Dockerfile.base
@@ -0,0 +1,46 @@
+#===- libcxx/utils/docker/debian9/Dockerfile --------------------------------------------------===//
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+#===-------------------------------------------------------------------------------------------===//
+
+# Setup the base builder image with the packages we'll need to build GCC and Clang from source.
+FROM launcher.gcr.io/google/debian9:latest AS builder-base
+LABEL maintainer "libc++ Developers"
+
+RUN apt-get update && \
+    apt-get install -y --no-install-recommends \
+      ca-certificates \
+      gnupg \
+      build-essential \
+      wget \
+      subversion \
+      unzip \
+      automake \
+      python \
+      cmake \
+      ninja-build \
+      curl \
+      git \
+      gcc-multilib \
+      g++-multilib \
+      libc6-dev \
+      bison \
+      flex \
+      libtool \
+      autoconf \
+      binutils-dev \
+      binutils-gold \
+      software-properties-common \
+      gnupg \
+      apt-transport-https \
+      sudo \
+      systemd \
+      sysvinit-utils \
+      systemd-sysv && \
+  update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20 && \
+  update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10 && \
+  rm -rf /var/lib/apt/lists/*
+
diff --git a/utils/docker/debian9/Dockerfile.buildbot b/utils/docker/debian9/Dockerfile.buildbot
new file mode 100644
index 0000000..c48f59a
--- /dev/null
+++ b/utils/docker/debian9/Dockerfile.buildbot
@@ -0,0 +1,26 @@
+
+#===-------------------------------------------------------------------------------------------===//
+# buildslave
+#===-------------------------------------------------------------------------------------------===//
+FROM ericwf/builder-base:latest AS buildbot
+
+# Copy over the GCC and Clang installations
+COPY --from=ericwf/gcc-5:latest /opt/gcc-5 /opt/gcc-5
+COPY --from=ericwf/gcc-tot:latest /opt/gcc-tot /opt/gcc-tot
+COPY --from=ericwf/llvm-4:latest /opt/llvm-4.0 /opt/llvm-4.0
+
+RUN ln -s /opt/gcc-5/bin/gcc /usr/local/bin/gcc-4.9 && \
+    ln -s /opt/gcc-5/bin/g++ /usr/local/bin/g++-4.9
+
+RUN apt-get update && \
+    apt-get install -y --no-install-recommends \
+    bash-completion \
+    vim \
+    sudo \
+    buildbot-slave \
+  && rm -rf /var/lib/apt/lists/*
+
+ADD scripts/install_clang_packages.sh /tmp/install_clang_packages.sh
+RUN /tmp/install_clang_packages.sh && rm /tmp/install_clang_packages.sh
+
+RUN git clone https://git.llvm.org/git/libcxx.git /libcxx
diff --git a/utils/docker/debian9/Dockerfile.clang b/utils/docker/debian9/Dockerfile.clang
new file mode 100644
index 0000000..68e39bc
--- /dev/null
+++ b/utils/docker/debian9/Dockerfile.clang
@@ -0,0 +1,19 @@
+#===- libcxx/utils/docker/debian9/Dockerfile --------------------------------------------------===//
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+#===-------------------------------------------------------------------------------------------===//
+
+# Build GCC versions
+FROM ericwf/builder-base:latest
+LABEL maintainer "libc++ Developers"
+
+ARG install_prefix
+ARG branch
+
+# Build additional LLVM versions
+
+ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh
+RUN /tmp/build_llvm_version.sh --install "$install_prefix" --branch "$branch"
diff --git a/utils/docker/debian9/Dockerfile.compiler_zoo b/utils/docker/debian9/Dockerfile.compiler_zoo
new file mode 100644
index 0000000..b357221
--- /dev/null
+++ b/utils/docker/debian9/Dockerfile.compiler_zoo
@@ -0,0 +1,35 @@
+#===- libcxx/utils/docker/debian9/Dockerfile --------------------------------------------------===//
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+#===-------------------------------------------------------------------------------------------===//
+
+#===-------------------------------------------------------------------------------------------===//
+#  compiler-zoo
+#===-------------------------------------------------------------------------------------------===//
+FROM  ericwf/libcxx-buildbot-base:latest AS compiler-zoo
+LABEL maintainer "libc++ Developers"
+
+# Copy over the GCC and Clang installations
+COPY --from=ericwf/compilers:latest /opt/gcc-4.8.5 /opt/gcc-4.8.5
+COPY --from=ericwf/compilers:latest /opt/gcc-4.9.4 /opt/gcc-4.9.4
+COPY --from=ericwf/compilers:latest /opt/gcc-5   /opt/gcc-5
+COPY --from=ericwf/compilers:latest /opt/gcc-6   /opt/gcc-6
+COPY --from=ericwf/compilers:latest /opt/gcc-7   /opt/gcc-7
+COPY --from=ericwf/compilers:latest /opt/gcc-8   /opt/gcc-8
+COPY --from=ericwf/compilers_tot:latest /opt/gcc-tot /opt/gcc-tot
+
+COPY --from=ericwf/compilers:latest /opt/llvm-3.6 /opt/llvm-3.6
+COPY --from=ericwf/compilers:latest /opt/llvm-3.7 /opt/llvm-3.7
+COPY --from=ericwf/compilers:latest /opt/llvm-3.8 /opt/llvm-3.8
+COPY --from=ericwf/compilers:latest /opt/llvm-3.9 /opt/llvm-3.9
+COPY --from=ericwf/compilers:latest /opt/llvm-4.0 /opt/llvm-4.0
+COPY --from=ericwf/compilers:latest /opt/llvm-5.0 /opt/llvm-5.0
+COPY --from=ericwf/compilers:latest /opt/llvm-6.0 /opt/llvm-6.0
+COPY --from=ericwf/compilers:latest /opt/llvm-7.0 /opt/llvm-7.0
+COPY --from=ericwf/compilers:latest /opt/llvm-8.0 /opt/llvm-8.0
+COPY --from=ericwf/compilers_tot:latest /opt/llvm-tot /opt/llvm-tot
+
+
diff --git a/utils/docker/debian9/Dockerfile.gcc b/utils/docker/debian9/Dockerfile.gcc
new file mode 100644
index 0000000..5a12074
--- /dev/null
+++ b/utils/docker/debian9/Dockerfile.gcc
@@ -0,0 +1,18 @@
+#===- libcxx/utils/docker/debian9/Dockerfile --------------------------------------------------===//
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+#===-------------------------------------------------------------------------------------------===//
+
+# Build GCC versions
+FROM ericwf/builder-base:latest
+LABEL maintainer "libc++ Developers"
+
+ARG install_prefix
+ARG branch
+ARG cherry_pick=""
+
+ADD scripts/build_gcc_version.sh /tmp/build_gcc_version.sh
+RUN /tmp/build_gcc_version.sh --install "$install_prefix" --branch "$branch" --cherry-pick "$cherry_pick"
diff --git a/utils/docker/docker-compose.yml b/utils/docker/docker-compose.yml
index 5e8e5a4..1202a82 100644
--- a/utils/docker/docker-compose.yml
+++ b/utils/docker/docker-compose.yml
@@ -1,14 +1,46 @@
 version: '3.4'
 services:
+  builder-base:
+    build:
+      context: .
+      dockerfile: debian9/Dockerfile.base
+      target: builder-base
+    image: ericwf/builder-base:latest
+  gcc-tot:
+    build:
+      context: .
+      dockerfile: debian9/Dockerfile.gcc
+      args:
+        install_prefix: /opt/gcc-tot
+        branch: master
+    image: ericwf/gcc-tot:latest
+  gcc-5:
+      build:
+        context: .
+        dockerfile: debian9/Dockerfile.gcc
+        args:
+          install_prefix: /opt/gcc-5
+          branch: gcc-5_5_0-release
+      image: ericwf/gcc-5:latest
+  llvm-4:
+    build:
+      context: .
+      dockerfile: debian9/Dockerfile.clang
+      args:
+        install_prefix: /opt/llvm-4.0
+        branch: release/4.x
+    image: ericwf/llvm-4:latest
+  llvm-tot:
+    build:
+      context: .
+      dockerfile: debian9/Dockerfile.clang
+      args:
+        install_prefix: /opt/llvm-tot
+        branch: master
+    image: ericwf/llvm-tot:latest
   buildbot:
     build:
       context: .
-      dockerfile: debian9/Dockerfile
+      dockerfile: debian9/Dockerfile.buildbot
       target: buildbot
     image: ericwf/libcxx-buildbot-base:latest
-  compiler-zoo:
-    build:
-      context: .
-      dockerfile: debian9/Dockerfile
-      target: compiler-zoo
-    image: ericwf/compiler-zoo:latest
diff --git a/utils/docker/scripts/checkout_git.sh b/utils/docker/scripts/checkout_git.sh
deleted file mode 100755
index 2c5563b..0000000
--- a/utils/docker/scripts/checkout_git.sh
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/usr/bin/env bash
-#===- llvm/utils/docker/scripts/checkout.sh ---------------------===//
-#
-# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-# See https://llvm.org/LICENSE.txt for license information.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-#===-----------------------------------------------------------------------===//
-
-set -e
-
-function show_usage() {
-  cat << EOF
-Usage: checkout.sh [options]
-
-Checkout svn sources into /tmp/clang-build/src. Used inside a docker container.
-
-Available options:
-  -h|--help           show this help message
-  -b|--branch         svn branch to checkout, i.e. 'trunk',
-                      'branches/release_40'
-                      (default: 'trunk')
-  -p|--llvm-project   name of an svn project to checkout.
-                      For clang, please use 'clang', not 'cfe'.
-                      Project 'llvm' is always included and ignored, if
-                      specified.
-                      Can be specified multiple times.
-EOF
-}
-
-LLVM_BRANCH=""
-# We always checkout llvm
-LLVM_PROJECTS="llvm"
-SOURCE_DIR=""
-
-function contains_project() {
-  local TARGET_PROJ="$1"
-  local PROJ
-  for PROJ in $LLVM_PROJECTS; do
-    if [ "$PROJ" == "$TARGET_PROJ" ]; then
-      return 0
-    fi
-  done
-  return 1
-}
-
-while [[ $# -gt 0 ]]; do
-  case "$1" in
-    --to)
-      shift
-      SOURCE_DIR="$1"
-      shift
-      ;;
-    -b|--branch)
-      shift
-      LLVM_BRANCH="$1"
-      shift
-      ;;
-    -p|--llvm-project)
-      shift
-      PROJ="$1"
-      shift
-
-      if [ "$PROJ" == "cfe" ]; then
-        PROJ="clang"
-      fi
-
-      if ! contains_project "$PROJ" ; then
-        if [ "$PROJ" == "clang-tools-extra" ] && [ ! contains_project "clang" ]; then
-          echo "Project 'clang-tools-extra' specified before 'clang'. Adding 'clang' to a list of projects first."
-          LLVM_PROJECTS="$LLVM_PROJECTS clang"
-        fi
-        LLVM_PROJECTS="$LLVM_PROJECTS $PROJ"
-      else
-        echo "Project '$PROJ' is already enabled, ignoring extra occurrences."
-      fi
-      ;;
-    -h|--help)
-      show_usage
-      exit 0
-      ;;
-    *)
-      echo "Unknown option: $1"
-      exit 1
-  esac
-done
-
-if [ "$SOURCE_DIR" == "" ]; then
-  echo "Must specify checkout directory using --to"
-  exit 1
-fi
-
-if [ "$LLVM_BRANCH" == "" ]; then
-  GIT_BRANCH_ARG=""
-else
-  GIT_BRANCH_ARG="--branch $LLVM_BRANCH"
-fi
-
-if [ "$LLVM_SVN_REV" != "" ]; then
-  SVN_REV_ARG="-r$LLVM_SVN_REV"
-  echo "Checking out svn revision r$LLVM_SVN_REV."
-else
-  SVN_REV_ARG=""
-  echo "Checking out latest svn revision."
-fi
-
-# Get the sources from svn.
-echo "Checking out sources from git"
-
-for LLVM_PROJECT in $LLVM_PROJECTS; do
-  if [ "$LLVM_PROJECT" == "llvm" ]; then
-    CHECKOUT_DIR="$SOURCE_DIR"
-  elif [ "$LLVM_PROJECT" == "libcxx" ] || [ "$LLVM_PROJECT" == "libcxxabi" ] || [ "$LLVM_PROJECT" == "compiler-rt" ]; then
-    CHECKOUT_DIR="$SOURCE_DIR/projects/$LLVM_PROJECT"
-  elif [ "$LLVM_PROJECT" == "clang" ]; then
-    CHECKOUT_DIR="$SOURCE_DIR/tools/clang"
-  elif [ "$LLVM_PROJECT" == "clang-tools-extra" ]; then
-    CHECKOUT_DIR="$SOURCE_DIR/tools/clang/tools/extra"
-  else
-    CHECKOUT_DIR="$SOURCE_DIR/$LLVM_PROJECT"
-  fi
-
-  echo "Checking out https://git.llvm.org/git/$LLVM_PROJECT to $CHECKOUT_DIR"
-  git clone --depth=1 $GIT_BRANCH_ARG \
-    "https://git.llvm.org/git/$LLVM_PROJECT.git" \
-    "$CHECKOUT_DIR"
-done
-
-echo "Done"
diff --git a/utils/docker/scripts/docker_start_buildbots.sh b/utils/docker/scripts/docker_start_buildbots.sh
index 0531d6f..f47ddcd 100755
--- a/utils/docker/scripts/docker_start_buildbots.sh
+++ b/utils/docker/scripts/docker_start_buildbots.sh
@@ -1,12 +1,8 @@
 #!/usr/bin/env bash
 set -x
 
-if [[ "$1" == "--new" ]]; then
-  shift
-fi
-
 # Update the libc++ sources in the image in order to use the most recent version of
 # run_buildbots.sh
 cd /libcxx
 git pull
-/libcxx/utils/docker/scripts/run_buildbot_new.sh "$@"
+/libcxx/utils/docker/scripts/run_buildbot.sh "$@"
diff --git a/utils/docker/scripts/docker_update_bot.sh b/utils/docker/scripts/docker_update_bot.sh
new file mode 100755
index 0000000..5c027a8
--- /dev/null
+++ b/utils/docker/scripts/docker_update_bot.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+
+set -x
+
+cd /libcxx
+git pull
+
+
+#pushd /tmp
+#curl -sSO https://dl.google.com/cloudagents/install-monitoring-agent.sh
+#bash install-monitoring-agent.sh
+#curl -sSO https://dl.google.com/cloudagents/install-logging-agent.sh
+#bash install-logging-agent.sh --structured
+#popd
+
+
+apt-get update -y
+apt-get upgrade -y
+
+apt-get install sudo -y
+
+# FIXME(EricWF): Remove this hack. It's only in place to temporarily fix linking libclang_rt from the
+# debian packages.
+# WARNING: If you're not a buildbot, DO NOT RUN!
+apt-get install lld-9
+rm /usr/bin/ld
+ln -s /usr/bin/lld-9 /usr/bin/ld
+
+systemctl set-property buildslave.service TasksMax=100000
+
+systemctl daemon-reload
+service buildslave restart
diff --git a/utils/docker/scripts/run_buildbot.sh b/utils/docker/scripts/run_buildbot.sh
index ede0049..bd1d82a 100755
--- a/utils/docker/scripts/run_buildbot.sh
+++ b/utils/docker/scripts/run_buildbot.sh
@@ -1,32 +1,22 @@
 #!/usr/bin/env bash
 set -x
 
-script_dir=`dirname "$0"`
+readonly BOT_ROOT=/b
+readonly BOT_ROOT_NAME=$1
+readonly BOT_PASS=$2
 
-# TODO(EricWF): Replace this file with the new script once the existing
-# bots have been migrated.
-if [ "$1" == "--new" ]; then
-  shift
-  $script_dir/run_buildbot_new.sh "$@"
-  shutdown now
-fi
-
-BOT_DIR=/b
-BOT_NAME=$1
-BOT_PASS=$2
-
-pushd /tmp
-curl -sSO https://dl.google.com/cloudagents/install-monitoring-agent.sh
-bash install-monitoring-agent.sh
-curl -sSO https://dl.google.com/cloudagents/install-logging-agent.sh
-bash install-logging-agent.sh --structured
-popd
-
-mkdir -p $BOT_DIR
+#pushd /tmp
+#curl -sSO https://dl.google.com/cloudagents/install-monitoring-agent.sh
+#bash install-monitoring-agent.sh
+#curl -sSO https://dl.google.com/cloudagents/install-logging-agent.sh
+#bash install-logging-agent.sh --structured
+#popd
 
 apt-get update -y
 apt-get upgrade -y
 
+apt-get install sudo -y
+
 # FIXME(EricWF): Remove this hack. It's only in place to temporarily fix linking libclang_rt from the
 # debian packages.
 # WARNING: If you're not a buildbot, DO NOT RUN!
@@ -36,42 +26,85 @@
 
 systemctl set-property buildslave.service TasksMax=100000
 
-buildslave stop $BOT_DIR
+function setup_numbered_bot() {
+  local BOT_NAME=$1
+  local BOT_DIR=$2
+  mkdir -p $BOT_DIR
 
-chown buildbot:buildbot $BOT_DIR
+  buildslave stop $BOT_DIR
+  chown buildbot:buildbot $BOT_DIR
+  rm -rf $BOT_DIR/*
 
-echo "Connecting as $BOT_NAME"
-buildslave create-slave --allow-shutdown=signal $BOT_DIR lab.llvm.org:9990 $BOT_NAME $BOT_PASS
+  buildslave create-slave --allow-shutdown=signal "$BOT_DIR" "lab.llvm.org:9990" "$BOT_NAME" "$BOT_PASS"
 
-echo "Eric Fiselier <ericwf@google.com>" > $BOT_DIR/info/admin
+  echo "Eric Fiselier <ericwf@google.com>" > $BOT_DIR/info/admin
 
-{
-  uname -a | head -n1
-  cmake --version | head -n1
-  g++ --version | head -n1
-  ld --version | head -n1
-  date
-  lscpu
-} > $BOT_DIR/info/host
+  echo "Connecting as $1"
+  {
+    uname -a | head -n1
+    cmake --version | head -n1
+    g++ --version | head -n1
+    ld --version | head -n1
+    date
+    lscpu
+  } > $BOT_DIR/info/host
 
-echo "SLAVE_RUNNER=/usr/bin/buildslave
-SLAVE_ENABLED[1]=\"1\"
-SLAVE_NAME[1]=\"buildslave1\"
-SLAVE_USER[1]=\"buildbot\"
-SLAVE_BASEDIR[1]=\"$BOT_DIR\"
-SLAVE_OPTIONS[1]=\"\"
-SLAVE_PREFIXCMD[1]=\"\"" > /etc/default/buildslave
 
-chown -R buildbot:buildbot $BOT_DIR
-systemctl daemon-reload
-service buildslave restart
+#echo "SLAVE_RUNNER=/usr/bin/buildslave
+#SLAVE_ENABLED[1]=\"1\"
+#SLAVE_NAME[1]=\"$BOT_NAME\"
+#SLAVE_USER[1]=\"buildbot\"
+#SLAVE_BASEDIR[1]=\"$BOT_DIR\"
+#SLAVE_OPTIONS[1]=\"\"
+#SLAVE_PREFIXCMD[1]=\"\"" > $BOT_DIR/buildslave.cfg
 
-sleep 30
-cat $BOT_DIR/twistd.log
-grep "slave is ready" $BOT_DIR/twistd.log || shutdown now
+  ls $BOT_DIR/
+  cat $BOT_DIR/buildbot.tac
+}
+
+function try_start_builder {
+  local N=$1
+  local BOT_DIR="$BOT_ROOT/b$N"
+  local BOT_NAME="$BOT_ROOT_NAME$N"
+
+  systemctl daemon-reload
+  service buildslave restart
+  setup_numbered_bot "$BOT_NAME" "$BOT_DIR"
+
+  systemctl daemon-reload
+  service buildslave restart
+
+  chown -R buildbot:buildbot $BOT_DIR/
+  sudo -u buildbot /usr/bin/buildslave start $BOT_DIR/
+
+  sleep 30
+  cat $BOT_DIR/twistd.log
+  if grep --quiet "slave is ready" $BOT_DIR/twistd.log; then
+    return 0
+  fi
+  if grep --quiet "configuration update complete" $BOT_DIR/twistd.log; then
+    return 0
+  fi
+  if grep "rejecting duplicate slave" $BOT_DIR/twistd.log; then
+    return 1
+  fi
+  echo "Unknown error"
+  cat $BOT_DIR/twistd.log
+  exit 1
+}
+
+for N in `shuf -i 1-5`
+do
+  if try_start_builder $N; then
+    break
+  fi
+  echo "failed to start any buildbot"
+  shutdown now
+done
 
 # GCE can restart instance after 24h in the middle of the build.
 # Gracefully restart before that happen.
 sleep 72000
 while pkill -SIGHUP buildslave; do sleep 5; done;
 shutdown now
+
diff --git a/utils/docker/scripts/run_buildbot_new.sh b/utils/docker/scripts/run_buildbot_new.sh
deleted file mode 100755
index cb747a9..0000000
--- a/utils/docker/scripts/run_buildbot_new.sh
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/usr/bin/env bash
-set -x
-
-BOT_ROOT=/b
-BOT_ROOT_NAME=$1
-BOT_PASS=$2
-
-pushd /tmp
-curl -sSO https://dl.google.com/cloudagents/install-monitoring-agent.sh
-bash install-monitoring-agent.sh
-curl -sSO https://dl.google.com/cloudagents/install-logging-agent.sh
-bash install-logging-agent.sh --structured
-popd
-
-apt-get update -y
-apt-get upgrade -y
-
-apt-get install sudo -y
-
-# FIXME(EricWF): Remove this hack. It's only in place to temporarily fix linking libclang_rt from the
-# debian packages.
-# WARNING: If you're not a buildbot, DO NOT RUN!
-apt-get install lld-9
-rm /usr/bin/ld
-ln -s /usr/bin/lld-9 /usr/bin/ld
-
-systemctl set-property buildslave.service TasksMax=100000
-
-systemctl daemon-reload
-service buildslave restart
-
-function setup_numbered_bot {
-  local BOT_NAME=$1
-  local BOT_DIR=$2
-  mkdir -p $BOT_DIR
-
-  buildslave stop $BOT_DIR
-  chown buildbot:buildbot $BOT_DIR
-  rm -rf $BOT_DIR/*
-
-  buildslave create-slave --allow-shutdown=signal $BOT_DIR lab.llvm.org:9990 \
-      $BOT_NAME $BOT_PASS
-
-  echo "Eric Fiselier <ericwf@google.com>" > $BOT_DIR/info/admin
-
-  echo "Connecting as $BOT_BASE_NAME$1"
-  {
-    uname -a | head -n1
-    cmake --version | head -n1
-    g++ --version | head -n1
-    ld --version | head -n1
-    date
-    lscpu
-  } > $BOT_DIR/info/host
-
-
- # echo "SLAVE_RUNNER=/usr/bin/buildslave
- # SLAVE_ENABLED[1]=\"1\"
- # SLAVE_NAME[1]=\"buildslave$1\"
- # SLAVE_USER[1]=\"buildbot\"
- # SLAVE_BASEDIR[1]=\"$BOT_DIR\"
- # SLAVE_OPTIONS[1]=\"\"
- # SLAVE_PREFIXCMD[1]=\"\"" > $BOT_DIR/buildslave.cfg
-
-}
-
-function try_start_builder {
-  local $N=$1
-  local BOT_DIR=$BOT_ROOT/b$N
-  local BOT_NAME=$BOT_ROOT_NAME$N
-  setup_numbered_bot $BOT_NAME $BOT_DIR
-  chown -R buildbot:buildbot $BOT_DIR/
-  sudo -u buildbot /usr/bin/buildslave start $BOT_DIR
-
-  sleep 30
-  cat $BOT_DIR/twistd.log
-  if grep --quiet "slave is ready" $BOT_DIR/twistd.log; then
-    return 0
-  fi
-  if grep --quiet "configuration update complete" $BOT_DIR/twistd.log; then
-    return 0
-  fi
-  if grep "rejecting duplicate slave" $BOT_DIR/twistd.log; then
-    return 1
-  fi
-  echo "Unknown error"
-  cat $BOT_DIR/twistd.log
-  exit 1
-}
-
-for N in `shuf -i 1-5`
-do
-  if try_start_builder $N; then
-    break
-  fi
-  echo "failed to start any buildbot"
-  shutdown now
-done
-
-# GCE can restart instance after 24h in the middle of the build.
-# Gracefully restart before that happen.
-sleep 72000
-while pkill -SIGHUP buildslave; do sleep 5; done;
-shutdown now
-
-echo "Failed to start any buildbot"
-shutdown now
-
-
-