build_packages: Add expanded binhosts option.

BUG=chromium:1185995
TEST=cq

Cq-Depend: chromium:2743957
Change-Id: I447256ac6856793bf78184ec5495e5cf9b0acd44
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/2743581
Tested-by: Alex Klein <saklein@chromium.org>
Commit-Queue: Alex Klein <saklein@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/build_packages b/build_packages
index 1190ea9..f01d5df 100755
--- a/build_packages
+++ b/build_packages
@@ -83,6 +83,8 @@
   "Build factory installer."
 DEFINE_boolean withtest "${FLAGS_TRUE}" \
   "Build packages required for testing."
+DEFINE_boolean expandedbinhosts "${FLAGS_FALSE}" \
+  "Allow expanded binhost inheritance."
 
 # The --reuse_pkgs_from_local_boards flag tells Portage to share binary
 # packages between boards that are built locally, so that the total time
@@ -194,6 +196,11 @@
 if [ "${FLAGS_cleanbuild}" -eq "${FLAGS_TRUE}" ]; then
   UPDATE_ARGS+=( --force )
 fi
+if [[ "${FLAGS_expandedbinhosts}" -eq "${FLAGS_TRUE}" ]]; then
+  UPDATE_ARGS+=( --more-binhosts )
+else
+  UPDATE_ARGS+=( --fewer-binhosts )
+fi
 
 setup_board --quiet --board=${FLAGS_board} "${UPDATE_ARGS[@]}"