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 561B4C001DF for ; Sun, 16 Jul 2023 00:44:36 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9459086682; Sun, 16 Jul 2023 02:39:33 +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="KmWhJa7j"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C654086437; Sun, 16 Jul 2023 02:38:10 +0200 (CEST) Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) (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 A9C3E863C1 for ; Sun, 16 Jul 2023 02:37:55 +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-x130.google.com with SMTP id e9e14a558f8ab-3461053677eso7079195ab.0 for ; Sat, 15 Jul 2023 17:37:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689467874; x=1692059874; 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=XLMkGyTtQWEtCVZ4RJOHFeF1fi4Ivl85G51sx80JOng=; b=KmWhJa7jvSRX2ZpphLd6wT/35mL4AbnGDAKuyOt0X98VeI+GjTD+/Mu7ojmPWpA+JB Kf9ErZXnLJxxH5H8Qws1s5J71dqpkDkPDuNRCipOd+9OxsFV7MuFrpDvGdqUyTqFO59/ sNHfd87gw+enNpcidyKLuYNTzj4U0R7O/Sgpk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689467874; x=1692059874; 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=XLMkGyTtQWEtCVZ4RJOHFeF1fi4Ivl85G51sx80JOng=; b=e5J8jt2KqqN4QBZT+pw3PR287jojmgLOX0awfaPWuC2E0JKzn6lvpsYArab9UwgOuZ EVrenipJ1Ykn79x10eJjyKPH2LKqV+pqDY4be2Aef+dA83RGRb+mUif9BfnOI+cOHk7+ 8LdLJ0WsWwJriXdzwfPVbyvEq6Y3eB9i/s9v4C6w6eRluK117lhIlYw5B/m+Wcif8WRH C56H2MLq/NyjiFTiD1k/Ql0RDx1+57He8hE6jynfP9FTd/uxxtyngKly/t8xdATXYJqY BGjSnXkOsHxxjJrDbXRiVL2N+hsEyVRV2WKn8NLgyeozkF6H/j7ZdXtYT6KQaOfocSXs rrSw== X-Gm-Message-State: ABy/qLYx80B0m4UYp8HLUkVcVaXIaDywFuF5UUQRp5lmWxBHrCJlLnqM gSHJ30Kv0xfbre+eedtmMtJz7KKugQrYC/KM8Uc= X-Google-Smtp-Source: APBJJlGZ94W1v5Akoom7vB3oa+jRuYTfZKENWfYUbSHc685cBcmXWtF0ZDQSiLwMH4Ne3OW4ppOK0g== X-Received: by 2002:a92:d4d1:0:b0:348:76eb:17d8 with SMTP id o17-20020a92d4d1000000b0034876eb17d8mr2462612ilm.6.1689467874359; Sat, 15 Jul 2023 17:37:54 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 17:37:54 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Mike Frysinger , Simon Glass Subject: [PATCH v3 44/81] buildman: Moving running of the builder into a function Date: Sat, 15 Jul 2023 18:36:12 -0600 Message-ID: <20230716003718.231903-45-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 Move this code into a new function. This removes the pylint warning about too many branches. Signed-off-by: Simon Glass --- (no changes since v1) tools/buildman/control.py | 56 ++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/tools/buildman/control.py b/tools/buildman/control.py index b0cc7078c4ff..9f775cb15df4 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -474,6 +474,40 @@ def setup_output_dir(output_dir, work_in_output, branch, no_subdirs, col, shutil.rmtree(output_dir) return output_dir +def run_builder(builder, commits, board_selected, options): + """Run the builder or show the summary + + Args: + commits (list of Commit): List of commits being built, None if no branch + boards_selected (dict): Dict of selected boards: + key: target name + value: Board object + options (Options): Options to use + + Returns: + int: Return code for buildman + """ + if not options.ide: + tprint(get_action_summary(options.summary, commits, board_selected, + options.step, options.threads, options.jobs)) + + builder.SetDisplayOptions( + options.show_errors, options.show_sizes, options.show_detail, + options.show_bloat, options.list_error_boards, options.show_config, + options.show_environment, options.filter_dtb_warnings, + options.filter_migration_warnings, options.ide) + if options.summary: + builder.ShowSummary(commits, board_selected) + else: + fail, warned, excs = builder.BuildBoards( + commits, board_selected, options.keep_outputs, options.verbose) + if excs: + return 102 + if fail: + return 100 + if warned and not options.ignore_warnings: + return 101 + return 0 def do_buildman(options, args, toolchains=None, make_func=None, brds=None, clean_dir=False, test_thread_exceptions=False): @@ -586,25 +620,5 @@ def do_buildman(options, args, toolchains=None, make_func=None, brds=None, board_selected = brds.get_selected_dict() commits = series.commits if series else None - if not options.ide: - tprint(get_action_summary(options.summary, commits, board_selected, - options.step, options.threads, options.jobs)) - - builder.SetDisplayOptions( - options.show_errors, options.show_sizes, options.show_detail, - options.show_bloat, options.list_error_boards, options.show_config, - options.show_environment, options.filter_dtb_warnings, - options.filter_migration_warnings, options.ide) - retval = 0 - if options.summary: - builder.ShowSummary(commits, board_selected) - else: - fail, warned, excs = builder.BuildBoards( - commits, board_selected, options.keep_outputs, options.verbose) - if excs: - retval = 102 - if fail: - retval = 100 - if warned and not options.ignore_warnings: - retval = 101 + retval = run_builder(builder, commits, board_selected, options) return retval -- 2.41.0.455.g037347b96a-goog