Update Perl modules when making chroot.

This CL moves the Perl rebuild logic from update_chroot into a separate
script under build_library/perl_rebuild.sh, such that we can reuse the
code to update Perl modules in the early phase of make_chroot.

BUG=chromium:722063
TEST=Remote trybot run on chromiumos-sdk builder.

Change-Id: Ic0cbbbd8f98abca2c8e11e1adbae9aa2c0ea8a9c
Reviewed-on: https://chromium-review.googlesource.com/506432
Commit-Ready: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
diff --git a/sdk_lib/make_chroot.sh b/sdk_lib/make_chroot.sh
index 55bd329..dccb872 100755
--- a/sdk_lib/make_chroot.sh
+++ b/sdk_lib/make_chroot.sh
@@ -467,9 +467,13 @@
 early_enter_chroot "${CHROOT_TRUNK_DIR}/chromite/bin/cros_setup_toolchains" \
     --hostonly "${TOOLCHAIN_ARGS[@]}"
 
-info "Running emerge curl sudo ..."
+info "Running emerge curl sudo gentoolkit ..."
 early_enter_chroot $EMERGE_CMD -uNv $USEPKG --select $EMERGE_JOBS \
-  pbzip2 dev-libs/openssl net-misc/curl sudo
+  pbzip2 dev-libs/openssl net-misc/curl sudo app-portage/gentoolkit
+
+info "Updating Perl modules"
+early_enter_chroot \
+  "${CHROOT_TRUNK_DIR}/src/scripts/build_library/perl_rebuild.sh"
 
 if [ -n "${INITIALIZE_CHROOT}" ]; then
   # If we're creating a new chroot, we also want to set it to the latest