Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 11A42C001DC for ; Wed, 19 Jul 2023 23:55:17 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D11238682A; Thu, 20 Jul 2023 01:51:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="J9aMtMUJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7761F867DA; Thu, 20 Jul 2023 01:50:29 +0200 (CEST) Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 078A7867BA for ; Thu, 20 Jul 2023 01:50:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x131.google.com with SMTP id e9e14a558f8ab-345d3c10bdfso1549435ab.2 for ; Wed, 19 Jul 2023 16:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689810622; x=1690415422; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=w0GTG36IBJrS2wsFXSaDBTrSG0Vgr9a7ZKR9oPfnkKY=; b=J9aMtMUJ8J7hULLSIHqlRd4445FVkls1YdoGGZABLbtgONeRvY92CWWlvitmKXk/Qk K5f8HaNAGoFCeFORX86yFEDBeLKn23L6yM+de04pGksMsRmySobDX9zQnmmlOZQcbQGI If2BEMFxZVvbjUKzJQIqIzkZo9f9xuvZmwBho= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689810622; x=1690415422; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w0GTG36IBJrS2wsFXSaDBTrSG0Vgr9a7ZKR9oPfnkKY=; b=Aufpqc2SHho5ADm8LT32pGysELtFRUHaT6MYNzXgc91q3hMdA2sB2LulTW0t0xoVt5 dHN4KOrUmswniwPBJ3bun898Jpcs11dP4v0Rsy2xgC++79EqFr/6C0aop5NWDATF003j 0QU2kcFCqDpHnGJ4LAhwPdlxKBzhnGtmooqNElHWltosZbMLbJHThjB7WWlsDTHeZbRt Bu5BxgPsCQVjkuOzdSnA0sgohw67nPOhd/Eya9rmBp4LEzRATR6hOVEiHCkdpyzXKqkv WDN33p2fzN7RBxLErm5njmHSlAn25frUosBofxZJhBM9R3HBZ6zIM2Su1i3HpLMNK/nf QKYg== X-Gm-Message-State: ABy/qLbht3pDrKBuwYY3DXeoQNqOzAS0Dd7ccWroDifwYpz/BGDEwGVO S+ctJzQL/0AKTJklCiEQUB+kYxs+Y5r8zr7Xuvw= X-Google-Smtp-Source: APBJJlHj7ilEdeavJ5Vgra3DPhHwWAPRzSnmrXfxdol+0mk54/sfafuLIjnG6NHb/E8VCL/VHehJUg== X-Received: by 2002:a92:c26b:0:b0:348:4ab6:98cc with SMTP id h11-20020a92c26b000000b003484ab698ccmr8431073ild.14.1689810622586; Wed, 19 Jul 2023 16:50:22 -0700 (PDT) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id ed16-20020a056638291000b0042bb1779c18sm1551779jab.151.2023.07.19.16.50.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 16:50:22 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Mike Frysinger , Simon Glass Subject: [PATCH v4 31/83] buildman: Move board-selection code into a function Date: Wed, 19 Jul 2023 17:48:39 -0600 Message-ID: <20230719234953.796101-32-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog In-Reply-To: <20230719234953.796101-1-sjg@chromium.org> References: <20230719234953.796101-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Create a new determine_boards() function to hold the code which selects which boards to build. Signed-off-by: Simon Glass --- (no changes since v3) Changes in v3: - Correct test failure when using incorrect variable tools/buildman/control.py | 59 ++++++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 16 deletions(-) diff --git a/tools/buildman/control.py b/tools/buildman/control.py index 80f9315a11e4..8f1edf9dbb95 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -222,6 +222,47 @@ def do_fetch_arch(toolchains, col, fetch_arch): return 0 +def determine_boards(brds, args, col, opt_boards, exclude_list): + """Determine which boards to build + + Each element of args and exclude can refer to a board name, arch or SoC + + Args: + brds (Boards): Boards object + args (list of str): Arguments describing boards to build + col (Terminal.Color): Color object + opt_boards (list of str): Specific boards to build, or None for all + exclude_list (list of str): Arguments describing boards to exclude + + Returns: + tuple: + list of Board: List of Board objects that are marked selected + why_selected: Dictionary where each key is a buildman argument + provided by the user, and the value is the list of boards + brought in by that argument. For example, 'arm' might bring + in 400 boards, so in this case the key would be 'arm' and + the value would be a list of board names. + board_warnings: List of warnings obtained from board selected + """ + exclude = [] + if exclude_list: + for arg in exclude_list: + exclude += arg.split(',') + + if opt_boards: + requested_boards = [] + for brd in opt_boards: + requested_boards += brd.split(',') + else: + requested_boards = None + why_selected, board_warnings = brds.select_boards(args, exclude, + requested_boards) + selected = brds.get_selected() + if not selected: + sys.exit(col.build(col.RED, 'No matching boards found')) + return selected, why_selected, board_warnings + + def do_buildman(options, args, toolchains=None, make_func=None, brds=None, clean_dir=False, test_thread_exceptions=False): """The main control code for buildman @@ -300,22 +341,8 @@ def do_buildman(options, args, toolchains=None, make_func=None, brds=None, return 0 if okay else 2 brds.read_boards(board_file) - exclude = [] - if options.exclude: - for arg in options.exclude: - exclude += arg.split(',') - - if options.boards: - requested_boards = [] - for brd in options.boards: - requested_boards += brd.split(',') - else: - requested_boards = None - why_selected, board_warnings = brds.select_boards(args, exclude, - requested_boards) - selected = brds.get_selected() - if not selected: - sys.exit(col.build(col.RED, 'No matching boards found')) + selected, why_selected, board_warnings = determine_boards( + brds, args, col, options.boards, options.exclude) if options.print_prefix: err = show_toolchain_prefix(brds, toolchains) -- 2.41.0.487.g6d72f3e995-goog