Allow sharing of local binaries between unrelated boards.

Currently we only share binhosts between a variant and its base board,
because of bug 200417. Now that that bug is fixed, we can remove this
restriction.

Note: While this CL enables the sharing of binaries, there are currently
no builders that would use it, because all of the grouped builders
currently only deal with a single base board. This will change in a
followup CL.

BUG=chromium:348226
TEST=Run with CL to build multiple boards on the same builder.

Change-Id: I56494473af8c6e1f5fefae4547ba611ec551eb4a
Reviewed-on: https://chromium-review.googlesource.com/188416
Reviewed-by: Yu-Ju Hong <yjhong@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
diff --git a/scripts/cros_generate_local_binhosts.py b/scripts/cros_generate_local_binhosts.py
index bb014d9..810d34a 100644
--- a/scripts/cros_generate_local_binhosts.py
+++ b/scripts/cros_generate_local_binhosts.py
@@ -2,8 +2,9 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-"""
-Generate a file that sets the specified board's binhosts to include all of the
+"""Script for calculating compatible binhosts.
+
+Generates a file that sets the specified board's binhosts to include all of the
 other compatible boards in this buildroot.
 """
 
@@ -16,20 +17,12 @@
 from chromite.buildbot import cbuildbot_config
 from chromite.lib import cros_build_lib
 
-def FindCandidateBoards(board):
+def FindCandidateBoards():
   """Find candidate local boards to grab prebuilts from."""
-  board_no_variant = board.partition("_")[0]
   portageq_prefix = "/usr/local/bin/portageq-"
   for path in sorted(glob.glob("%s*" % portageq_prefix)):
     # Strip off the portageq prefix, leaving only the board.
-    other_board = path.replace(portageq_prefix, "")
-
-    # It is only safe to inherit prebuilts from generic boards, or from the
-    # same board without the variant. This rule helps keep inheritance trees
-    # sane.
-    if (other_board in cbuildbot_config.generic_boards or
-        other_board == board_no_variant or other_board == board):
-      yield other_board
+    yield path.replace(portageq_prefix, "")
 
 
 def SummarizeCompatibility(board):
@@ -65,7 +58,7 @@
 
   by_compatibility = collections.defaultdict(set)
   compatible_boards = None
-  for other_board in FindCandidateBoards(flags.board):
+  for other_board in FindCandidateBoards():
     compat_id = SummarizeCompatibility(other_board)
     if other_board == flags.board:
       compatible_boards = by_compatibility[compat_id]