build_packages: Add 'use_any_chrome' flag

This flag directs the build to use any chrome prebuilt that is available
even if the USE flags are not an exact match.

Developers will have to manually re-emerge the stable version of
chromeos-chrome if they have stopped cros-workon for chromeos-chrome and
want to re-run build_packages using the stable chrome ebuild.

BUG=chromium:1015565
TEST=`build_packages` uses the chrome_internal prebuilt for veyron_minnie
TEST=`build_packages` with chromeos-chrome workon'd still builds the 9999 version

Change-Id: Id120189a73742f06efe6dacf34cd3e6c36090e7b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/1913304
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Chris McDonald <cjmcdonald@chromium.org>
Commit-Queue: Chris McDonald <cjmcdonald@chromium.org>
diff --git a/build_packages b/build_packages
index ed84d22..2bd3eff 100755
--- a/build_packages
+++ b/build_packages
@@ -34,6 +34,8 @@
   "Calculate reverse dependencies on changed ebuilds."
 DEFINE_boolean autosetgov "${FLAGS_FALSE}" \
   "Automatically set cpu governor to 'performance'."
+DEFINE_boolean use_any_chrome "${FLAGS_TRUE}" \
+  "Use any Chrome prebuilt available, even if the prebuilt doesn't match exactly."
 
 # The --board_root flag specifies the environment variables ROOT and PKGDIR.
 # This allows fetching and emerging of all packages to specified board_root.
@@ -184,6 +186,10 @@
   --board=${FLAGS_board}
 )
 
+if [[ "${FLAGS_use_any_chrome}" -eq "${FLAGS_TRUE}" ]]; then
+  EMERGE_CMD+=( "--force-remote-binary=chromeos-base/chromeos-chrome" )
+fi
+
 if [[ "${FLAGS_buildretry}" -eq "${FLAGS_FALSE}" ]]; then
   EMERGE_CMD+=( --retries=0 )
 fi