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 1598BC001DE for ; Thu, 20 Jul 2023 00:03:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0DDAE86905; Thu, 20 Jul 2023 01:53:01 +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="jx4Qm8hT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2C84086814; Thu, 20 Jul 2023 01:51:03 +0200 (CEST) Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) (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 457CE867FC for ; Thu, 20 Jul 2023 01:50:57 +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-io1-xd35.google.com with SMTP id ca18e2360f4ac-78666994bc2so9501239f.0 for ; Wed, 19 Jul 2023 16:50:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689810656; x=1690415456; 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=aRau3vtB3BP8ni6zjP3lHQ3eeTUnuaoWiX03Ql688oc=; b=jx4Qm8hTIE3FG7nJ9NriA4/PxADBpJ3c+N6Kmnn04CAbZxwAPKKlUvkdwUucnPwZkW RQpXvFbIuoDHU1XmqWwUKs+c5mOqjPT/3JScXxb2d987mZds3/zyHS3/rwmK7ZIGHmpx WyZSyliUcu2osX84X7k3dKvillytuisDcZKtQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689810656; x=1690415456; 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=aRau3vtB3BP8ni6zjP3lHQ3eeTUnuaoWiX03Ql688oc=; b=GcTo4N7hrJ92/jIKJWkkHoQ++8WZTVSAqFbGajAWWeVzY1J3vqiLMqMoJQJboBeg2Q s4HL45zJlpf7EDUOrQq7imDA/w5XGy3ti9sBmmxG+1x9/doBarRn8Dg5HLYiZnej1Scw edgDHcJe8UFi0rSp6D0rs6OX6EcEdJETXuVuVf8c8ZFn4nFiIGk4xthU1cK2Pq3sw50K gpBrPN0iDMh+TfWR2GJ//Wmuhwv1WJJY79b9rIbCZN36pfgbPr1HOTJtVPqplKrbxPDz 7AN/9HdrplkF7hCcvtY64vEgLv4ltqc7b9qlhjCMJVsxvEmwwYai2ZxiXXOMNAwW+53X MWjA== X-Gm-Message-State: ABy/qLYOT/YDjQzHa7XKW2em/I0UJlK+w68Gz0KTYgDw58MgXoOwU/pt HyL4u9We2qak3y4N89zYkyacxUz4QWHu4mda0So= X-Google-Smtp-Source: APBJJlHy2WRg7iJsUV1p9M4rOE5cIr2MUA85FPcPq45H+nUVywTr7cOb/3Rym3X5wz6VYDH/hs4w/Q== X-Received: by 2002:a6b:da09:0:b0:787:1697:1b3b with SMTP id x9-20020a6bda09000000b0078716971b3bmr8255179iob.8.1689810655913; Wed, 19 Jul 2023 16:50:55 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 16:50:55 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Mike Frysinger , Simon Glass Subject: [PATCH v4 76/83] buildman: Avoid passing result into _read_done_file() Date: Wed, 19 Jul 2023 17:49:24 -0600 Message-ID: <20230719234953.796101-77-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 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.487.g6d72f3e995-goog