make_chroot: link in new eclass overlay

We need to create a link to the new eclass overlay so our boards
can leverage it.

While we're here, clear out the old /usr/portage one as that repo
no longer exists.

BUG=chromium:205164
TEST=`./update_chroot && ./build_packages --board=stumpy` works

Change-Id: I59e69b5cc586c63648139739de51dace7c7ab6bf
Reviewed-on: https://chromium-review.googlesource.com/180140
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
diff --git a/chroot_version_hooks.d/84_enable_eclass_overlay b/chroot_version_hooks.d/84_enable_eclass_overlay
new file mode 100644
index 0000000..5bfd492
--- /dev/null
+++ b/chroot_version_hooks.d/84_enable_eclass_overlay
@@ -0,0 +1,10 @@
+# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This symlink is dead and we no longer care.
+sudo rm -f /usr/portage
+
+# This is the new eclass overlay we want to use.
+sudo ln -sfT /mnt/host/source/src/third_party/eclass-overlay \
+  /usr/local/portage/eclass-overlay
diff --git a/sdk_lib/make_chroot.sh b/sdk_lib/make_chroot.sh
index 045b5c6..bad955e 100755
--- a/sdk_lib/make_chroot.sh
+++ b/sdk_lib/make_chroot.sh
@@ -165,10 +165,10 @@
 init_setup () {
    info "Running init_setup()..."
    mkdir -p -m 755 "${FLAGS_chroot}/usr" \
-     "${FLAGS_chroot}/usr/local/portage" \
+     "${FLAGS_chroot}${OVERLAYS_ROOT}" \
      "${FLAGS_chroot}"/"${CROSSDEV_OVERLAY}"
-   ln -sf "${CHROOT_TRUNK_DIR}/src/third_party/portage" \
-     "${FLAGS_chroot}/usr/portage"
+   ln -sf "${CHROOT_TRUNK_DIR}/src/third_party/eclass-overlay" \
+     "${FLAGS_chroot}"/"${ECLASS_OVERLAY}"
    ln -sf "${CHROOT_TRUNK_DIR}/src/third_party/chromiumos-overlay" \
      "${FLAGS_chroot}"/"${CHROOT_OVERLAY}"
    ln -sf "${CHROOT_TRUNK_DIR}/src/third_party/portage-stable" \
@@ -339,9 +339,11 @@
 OVERLAY="${SRC_ROOT}/third_party/chromiumos-overlay"
 CONFIG_DIR="${OVERLAY}/chromeos/config"
 CHROOT_CONFIG="${CHROOT_TRUNK_DIR}/src/third_party/chromiumos-overlay/chromeos/config"
-PORTAGE_STABLE_OVERLAY="/usr/local/portage/stable"
-CROSSDEV_OVERLAY="/usr/local/portage/crossdev"
-CHROOT_OVERLAY="/usr/local/portage/chromiumos"
+OVERLAYS_ROOT="/usr/local/portage"
+ECLASS_OVERLAY="${OVERLAYS_ROOT}/eclass-overlay"
+PORTAGE_STABLE_OVERLAY="${OVERLAYS_ROOT}/stable"
+CROSSDEV_OVERLAY="${OVERLAYS_ROOT}/crossdev"
+CHROOT_OVERLAY="${OVERLAYS_ROOT}/chromiumos"
 CHROOT_STATE="${FLAGS_chroot}/etc/debian_chroot"
 
 # Pass proxy variables into the environment.