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 1513DC001DF for ; Sun, 16 Jul 2023 00:42:14 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 90F8A865F3; Sun, 16 Jul 2023 02:38:54 +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="eNJjYip5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F2D7D865C0; Sun, 16 Jul 2023 02:37:53 +0200 (CEST) Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) (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 55CFC862E9 for ; Sun, 16 Jul 2023 02:37:45 +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-x12b.google.com with SMTP id e9e14a558f8ab-3466725f0beso19176125ab.1 for ; Sat, 15 Jul 2023 17:37:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689467864; x=1692059864; 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=iX1ohP72tBUyfT48xbagSr+cX3zm5nxWRjqWnTEQ4u0=; b=eNJjYip5ssuPof6eAJF45/SyJ4A6Ft5Yvk9DLRHCkzoSLUdyWwOqfFkiD3M66sJ3K7 HTQO69Dji9Te0atNRsyIz+Y/OUZuQtS2DGZC//Mmx+x3pSLO/NUNYCm6ISXO1eXKVg/I +dYogU+uv8jAAzbYZayX5IgkO5Q4yR7eX+n6Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689467864; x=1692059864; 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=iX1ohP72tBUyfT48xbagSr+cX3zm5nxWRjqWnTEQ4u0=; b=FzVyFPdvpdqEo3jnDdJDz4mGmvA04hcPZVS5aAGf9/YkKmnWPEmyyb9U/omRj5QCDp MY8Wvn5MqSlrnkpzSM8eHFpipKjiplLW5Gu05N1/fdFJICeaSVa3hgTYPaNtSpi4bvfA VkO+mzRu5r2+BFQP2teF8lj61pfp1U4Wx41EzoixYJHA82tJVYPNYxTIXUg5ln4TPRQI 85BYIO+XC2wyereOvEcI+dW3TGkrhEIGauL+7Z1vb4aGebjmPJZHwEVnYDx8GL7RaF4O 7UA3lmhdloctLCcu25xVoT7W3F1PzRFfE4ihCoiHheFi8rubQ9btdJohhKh+gWHCRxfu AO2A== X-Gm-Message-State: ABy/qLa1myyTLS61Hirlmskkr3hWox8W/H53dbiwDTySgHgUAOx6WWlE T968OkV0gTOYaV9PUn/XszDXrWISQwlq3YE5yG8= X-Google-Smtp-Source: APBJJlGoxR4PZxThwKtblyTSPdqcRMcGc7anAIH9w/QA/Ovzv80iwLePHzy4br0wBMcIV7jkH55ZzA== X-Received: by 2002:a92:ce0e:0:b0:346:6dc3:b531 with SMTP id b14-20020a92ce0e000000b003466dc3b531mr8124861ilo.1.1689467863944; Sat, 15 Jul 2023 17:37:43 -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 t3-20020a05663801e300b0042b52dc77e3sm3510512jaq.158.2023.07.15.17.37.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 17:37:43 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Mike Frysinger , Simon Glass Subject: [PATCH v3 29/81] buildman: Move board-selection code into a function Date: Sat, 15 Jul 2023 18:35:57 -0600 Message-ID: <20230716003718.231903-30-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.455.g037347b96a-goog In-Reply-To: <20230716003718.231903-1-sjg@chromium.org> References: <20230716003718.231903-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 --- 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.455.g037347b96a-goog