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 95A10C0015E for ; Sun, 16 Jul 2023 00:50:21 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AB67986776; Sun, 16 Jul 2023 02:40:51 +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="ZKaTNJcP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F1C7C8627C; Sun, 16 Jul 2023 02:38:43 +0200 (CEST) Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) (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 0CBCD8634D for ; Sun, 16 Jul 2023 02:38:17 +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-x129.google.com with SMTP id e9e14a558f8ab-345d6dc271dso16226065ab.0 for ; Sat, 15 Jul 2023 17:38:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689467895; x=1692059895; 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=Qx/nbII+44vNucthvtQmgSybvmhZTXW6jQXFBYQamQc=; b=ZKaTNJcPzJYpRwktyi9LZDha4qMsWTZLgqoQ4XxeBiirUxUAA1HDm+jrjFocwe7IP7 Z8doQLwFSy6qf0Zx1+FZ2rat9s/M/HPopUT56i79w96/yr8nVKRZc/73EH4X4MUzHLW/ 5U8ydH7oCiLy1iIJTUUxPl1SdcRJS6mJH3NwI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689467895; x=1692059895; 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=Qx/nbII+44vNucthvtQmgSybvmhZTXW6jQXFBYQamQc=; b=gDT6Je4RKFxi/9LxEiV/6qg+ixfFtcuwWRpfYh43idUuJ5tkUgkiR36A7VbLt46he0 RA5uSzssUrJZU+gURhf/F5Bn24F8JArpYJ2jsb08ZxqznkzQS1G8tNykvYSMOZ2T9TtE TKILYbMZHUWA+l8+Yto4lf+YGVb9EqJnMHnbEPmZD0P1C3d96Q6n8uItY1GKshQn+LIv 1Fvfix6foUwFpGJkDGMryoLFHMB/oV5Zes2ViinHlr/WHTBA/X7dW75yWdkxNevBenuX xlJs7ucf+MHU9Dv1uXHDrsIHIjegHb2Fj4wm6uaGFX30u6+ogN6w+ZwZydQsNtAoFEyx /G4A== X-Gm-Message-State: ABy/qLZ/j9QrVsQ6j1ShM9ceU6qHekaAPd2AmI5xaXo+Yp7nS0VqkpmP 6ni8kHLsn8Uja9Sg1dP/5nY7f3YMbPsYdfAiVM4= X-Google-Smtp-Source: APBJJlGSob8qCUysXa1/cRpAWqmaXRH3wqoAcYsnIa0cWoF1eoj2iGC+2RQD6HCm24PVZIFrg8vT4A== X-Received: by 2002:a92:130f:0:b0:346:58b5:9012 with SMTP id 15-20020a92130f000000b0034658b59012mr6971481ilt.16.1689467895589; Sat, 15 Jul 2023 17:38:15 -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.38.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 17:38:15 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Mike Frysinger , Simon Glass Subject: [PATCH v3 74/81] buildman: Avoid passing result into _read_done_file() Date: Sat, 15 Jul 2023 18:36:42 -0600 Message-ID: <20230716003718.231903-75-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 the creating of the result object into the function which sets it up, to simplify the code. Signed-off-by: Simon Glass --- (no changes since v1) tools/buildman/builderthread.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index aa4a9d9919c6..d3912390bc4f 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -262,21 +262,26 @@ class BuilderThread(threading.Thread): result.return_code = 0 return result - def _read_done_file(self, commit_upto, brd, result, force_build, + def _read_done_file(self, commit_upto, brd, force_build, force_build_failures): """Check the 'done' file and see if this commit should be built Args: commit (Commit): Commit only being built brd (Board): Board being built - result (CommandResult): result object to update force_build (bool): Force a build even if one was previously done force_build_failures (bool): Force a bulid if the previous result showed failure Returns: - bool: True if build should be built + tuple: + bool: True if build should be built + CommandResult: if there was a previous run: + - already_done set to True + - return_code set to return code + - result.stderr set to 'bad' if stderr output was recorded """ + result = command.CommandResult() done_file = self.builder.get_done_file(commit_upto, brd.target) result.already_done = os.path.exists(done_file) will_build = (force_build or force_build_failures or @@ -300,7 +305,7 @@ class BuilderThread(threading.Thread): elif not force_build: # The build passed, so no need to build it again will_build = False - return will_build + return will_build, result def _decide_dirs(self, brd, work_dir, work_in_output): """Decide the output directory to use @@ -438,13 +443,11 @@ class BuilderThread(threading.Thread): """ # Create a default result - it will be overwritte by the call to # self.make() below, in the event that we do a build. - result = command.CommandResult() - result.return_code = 0 out_dir, out_rel_dir = self._decide_dirs(brd, work_dir, work_in_output) # Check if the job was already completed last time - will_build = self._read_done_file(commit_upto, brd, result, force_build, - force_build_failures) + will_build, result = self._read_done_file(commit_upto, brd, force_build, + force_build_failures) if will_build: # We are going to have to build it. First, get a toolchain -- 2.41.0.455.g037347b96a-goog