build_sdk_board: add some logging of major commands

Log each emerge command we run since each one takes quite a long
time to complete to help with debugging/progress.

BUG=chromium:985180
TEST=`./build_sdk_board --board amd64-host` passes

Change-Id: Ife3f8a06a53d76f02142cff66cfa1cfcaa588cb6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/2212155
Reviewed-by: Alex Klein <saklein@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
diff --git a/build_sdk_board b/build_sdk_board
index 154618f..22b5158 100755
--- a/build_sdk_board
+++ b/build_sdk_board
@@ -125,15 +125,21 @@
 fi
 PACKAGES=( system virtual/target-sdk world )
 
+run_emerge() {
+  local cmd=( ${EMERGE_CMD} "$@" )
+  info "Running: ${cmd[*]}"
+  sudo -E "${cmd[@]}"
+}
+
 # First, rebuild all packages from scratch. This is needed to make sure
 # we rebuild all chroot packages.
 
 # We build the toolchain by hand to avoid race conditions where the toolchain
 # is used by other packages that we're building.  See https://crbug.com/906289.
-sudo -E ${EMERGE_CMD} "${TOOLCHAIN_PACKAGES[@]}"
+run_emerge "${TOOLCHAIN_PACKAGES[@]}"
 
 # Then build everything else.
-sudo -E $EMERGE_CMD --emptytree --with-bdeps=y \
+run_emerge --emptytree --with-bdeps=y \
   --exclude "${TOOLCHAIN_PACKAGES[*]}" \
   "${PACKAGES[@]}" virtual/target-sdk-nobdeps
 sudo eclean -d packages
@@ -141,12 +147,12 @@
 # Next, install our rebuilt packages into our separate root.
 HOST_FLAGS="--root=$BOARD_ROOT --update --verbose --deep --root-deps"
 HOST_FLAGS+=" --newuse --usepkgonly"
-sudo -E $EMERGE_CMD $HOST_FLAGS --with-bdeps=y "${PACKAGES[@]}"
+run_emerge $HOST_FLAGS --with-bdeps=y "${PACKAGES[@]}"
 # Install our rebuilt packages from the nobdeps target into our separate root
 # without their build-time deps.  We also avoid adding this target to the
 # world set so that subsequent update_chroot commands won't re-import the
 # build deps.
-sudo -E $EMERGE_CMD $HOST_FLAGS --with-bdeps=n --oneshot \
+run_emerge $HOST_FLAGS --with-bdeps=n --oneshot \
   virtual/target-sdk-nobdeps
 sudo cp -a "${PKGDIR}" $BOARD_ROOT/packages