make_chroot: Emerge sandbox/automake/patch early

dev-libs/nss, embedded-dev/coreboot-sdk, and media-libs/freetype fail
to build when certain implicit dependencies are emerged during their
build.  They rebuild successfully on the second try, but this makes the
sdk builder take about 30 minutes longer than it needs to.  emerge a few
specific packages early to eliminate this concurrency:

* sys-apps/sandbox breaks dev-libs/nss
* sys-devel/patch breaks dev-embedded/coreboot-sdk
* sys-devel/automake sometimes breaks media-libs/freetype and the
  old version slows down coreboot-sdk build times by 10 minutes.
  This one isn't strictly necessary on every build, but seems worth
  doing to avoid freetype build flakiness.

gcc is still being rebuilt during the host toolchain update, but that
needs to be fixed separately.

BUG=chromium:762283
TEST=chromiumos-sdk completes without retrying packages in the main
     build phase.

Change-Id: I0af1e0c3d2b4918b76bf07758d857d7a71c99166
Reviewed-on: https://chromium-review.googlesource.com/801130
Commit-Ready: Benjamin Gordon <bmgordon@chromium.org>
Tested-by: Benjamin Gordon <bmgordon@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/sdk_lib/make_chroot.sh b/sdk_lib/make_chroot.sh
index 181b4b8..f90464f 100755
--- a/sdk_lib/make_chroot.sh
+++ b/sdk_lib/make_chroot.sh
@@ -627,6 +627,16 @@
     "${CHROOT_TRUNK_DIR}/src/scripts/run_chroot_version_hooks" --init_latest
 fi
 
+# Update these packages early because they cause build failures when they're
+# concurrently emerged during the main update below.
+# Specific packages:
+#   sys-apps/sandbox upgrade breaks dev-libs/nss.
+#   sys-devel/patch 2.6 misapplies git patches in dev-embedded/coreboot-sdk.
+#   older sys-devel/automake makes media-libs/freetype build flaky.
+info "Updating preinstalled build tools"
+early_enter_chroot ${EMERGE_CMD} -uNv ${USEPKG} --select ${EMERGE_JOBS} \
+  sys-apps/sandbox '>=sys-devel/patch-2.7' sys-devel/automake
+
 # Update chroot.
 # Skip toolchain update because it already happened above, and the chroot is
 # not ready to emerge all cross toolchains.