Revert "Upgrade to Debian 9 (a.k.a. stretch)"

Oops. I accidentally pushed to master...

This reverts commit 29443be0516152967061adb3eda60774daf4d380.

Change-Id: I853bf174dfff592ff6de0928adc88037f7e4a269
diff --git a/vm/Vagrantfile b/vm/Vagrantfile
index e72e26a..1404131 100644
--- a/vm/Vagrantfile
+++ b/vm/Vagrantfile
@@ -16,12 +16,12 @@
   # please see the online documentation at vagrantup.com.
 
   # Every Vagrant virtual environment requires a box to build off of.
-  config.vm.box = "debian/stretch64"
+  config.vm.box = "debian/jessie64"
 
   config.vm.provider "virtualbox" do |vb|
     # Don't boot with headless mode
     vb.gui = true
-    vb.name = "FRC971-Development-2018"
+    vb.name = "FRC971-Development-2017"
 
     # There are two shortcuts for modifying number of CPUs and amount of
     # memory. Modify them to your liking.
diff --git a/vm/setup_apt.sh b/vm/setup_apt.sh
index a2c2d28..d31a372 100755
--- a/vm/setup_apt.sh
+++ b/vm/setup_apt.sh
@@ -7,8 +7,8 @@
 
 # Set up contrib and non-free so we can install some more interesting programs.
 cat > /etc/apt/sources.list.d/contrib.list <<EOT
-deb  http://ftp.us.debian.org/debian/ stretch contrib non-free
-deb-src  http://ftp.us.debian.org/debian/ stretch contrib non-free
+deb  http://ftp.us.debian.org/debian/ jessie contrib non-free
+deb-src  http://ftp.us.debian.org/debian/ jessie contrib non-free
 EOT
 
 # Get a list of the latest packages.
diff --git a/vm/setup_code_building.sh b/vm/setup_code_building.sh
index 0ddc65f..cbb8fcd 100755
--- a/vm/setup_code_building.sh
+++ b/vm/setup_code_building.sh
@@ -6,17 +6,15 @@
 export DEBIAN_FRONTEND=noninteractive
 
 readonly PKGS=(
-  clang-3.9
-  clang-format-3.9
-  curl
+  bazel
+  clang-3.6
+  clang-format-3.5
   gfortran
   git
-  g++
   libblas-dev
   liblapack-dev
   libpython3-dev
   libpython-dev
-  openjdk-8-jdk
   python3
   python3-matplotlib
   python3-numpy
@@ -25,18 +23,22 @@
   python-scipy
   resolvconf
   ruby
-  zlib1g-dev
 )
 
 # Set up the backports repo.
 cat > /etc/apt/sources.list.d/backports.list <<EOT
-deb http://http.debian.net/debian stretch-backports main contrib
+deb http://http.debian.net/debian jessie-backports main
 EOT
 
 # Set up the LLVM repo.
-cat > /etc/apt/sources.list.d/llvm-apt.list <<EOT
-deb http://apt.llvm.org/jessie/ llvm-toolchain-jessie main
-deb-src http://apt.llvm.org/jessie/ llvm-toolchain-jessie main
+cat > /etc/apt/sources.list.d/llvm-3.6.list <<EOT
+deb  http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.6 main
+deb-src  http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.6 main
+EOT
+
+# Set up the 971-managed bazel repo.
+cat > /etc/apt/sources.list.d/bazel-971.list <<EOT
+deb http://robotics.mvla.net/files/frc971/packages jessie main
 EOT
 
 # Enable user namespace for sandboxing.
@@ -44,19 +46,19 @@
 kernel.unprivileged_userns_clone = 1
 EOT
 
+# We need to explicitly pull in the java certificates from backports. Otherwise
+# bazel won't install properly.
+cat > /etc/apt/preferences.d/java_certificates <<EOT
+Package: ca-certificates-java
+Pin: release a=jessie-backports
+Pin-Priority: 900
+EOT
+
 # Accept the LLVM GPG key so we can install their packages.
 wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add -
 
 # Install all the packages that we need/want.
 apt-get update
 for pkg in "${PKGS[@]}"; do
-  apt-get install -y -f --allow-change-held-packages "$pkg"
+  apt-get install -y -f --force-yes "$pkg"
 done
-
-# Install bazel if necessary.
-if ! dpkg -l bazel > /dev/null; then
-  pushd /tmp
-  curl -OL 'https://github.com/bazelbuild/bazel/releases/download/0.8.1/bazel_0.8.1-linux-x86_64.deb'
-  dpkg -i bazel_0.8.1-linux-x86_64.deb
-  popd
-fi
diff --git a/vm/setup_extra_storage.sh b/vm/setup_extra_storage.sh
index 49951d4..5fcf4cb 100755
--- a/vm/setup_extra_storage.sh
+++ b/vm/setup_extra_storage.sh
@@ -6,8 +6,6 @@
 readonly EXTRA_USER=user
 readonly EXTRA_STORAGE=/home/"${EXTRA_USER}"
 
-apt-get install whois
-
 if ! grep -q "$EXTRA_STORAGE" /etc/passwd; then
   PASSWORD="$(echo "$EXTRA_USER" | mkpasswd -s)"
   useradd \