def _ChromeBinhost(self, board): """Gets the latest chrome binhost for |board|. Args: board: The board to use. """ extra_useflags = os.environ.get('USE', '').split() compat_id = binhost.CalculateCompatId(board, extra_useflags) internal_config = binhost.PrebuiltMapping.GetFilename( constants.SOURCE_ROOT, 'chrome') external_config = binhost.PrebuiltMapping.GetFilename( constants.SOURCE_ROOT, 'chromium', internal=False) binhost_dirs = (_INTERNAL_BINHOST_DIR, _EXTERNAL_BINHOST_DIR) if os.path.exists(internal_config): pfq_configs = binhost.PrebuiltMapping.Load(internal_config) elif os.path.exists(external_config): pfq_configs = binhost.PrebuiltMapping.Load(external_config) else: return None for key in pfq_configs.GetPrebuilts(compat_id): for binhost_dir in binhost_dirs: binhost_file = os.path.join(binhost_dir, key.board + _CHROME_BINHOST_SUFFIX) # Make sure the binhost file is not empty. We sometimes empty the file # to force clients to use another binhost. if _NotEmpty(binhost_file): return binhost_file return None
def main(argv): cros_build_lib.AssertInsideChroot() opts = _ParseArguments(argv) filename = binhost.PrebuiltMapping.GetFilename(opts.buildroot, opts.prebuilt_type) pfq_configs = binhost.PrebuiltMapping.Load(filename) extra_useflags = os.environ.get('USE', '').split() compat_id = binhost.CalculateCompatId(opts.board, extra_useflags) for key in pfq_configs.GetPrebuilts(compat_id): print(key.board)
def GetCompatId(self, config, board=None): """Get the CompatId for a config. Args: config: A config_lib.BuildConfig object. board: Board to use. Defaults to the first board in the config. Optional if len(config.boards) == 1. """ if board is None: assert len(config.boards) == 1 board = config.boards[0] else: assert board in config.boards board_key = binhost.GetBoardKey(config, board) compat_id = self.COMPAT_IDS.get(board_key) if compat_id is None: compat_id = binhost.CalculateCompatId(board, config.useflags) self.COMPAT_IDS[board_key] = compat_id return compat_id