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 746F9C001DF for ; Sun, 16 Jul 2023 00:49:42 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 31CB28672B; Sun, 16 Jul 2023 02:40:44 +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="CpixVBoD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8285086237; Sun, 16 Jul 2023 02:38:39 +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 5942C863E9 for ; Sun, 16 Jul 2023 02:38:15 +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-3461163c0b6so19175715ab.2 for ; Sat, 15 Jul 2023 17:38:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689467894; x=1692059894; 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=zNoxu32mEYZ+4CZxrWnIdM9zRi5f7vUF4VYUTds+Eps=; b=CpixVBoD/Sn78RJ9lC9fsVplwHpWsKHyMXgvCicGkhKKh85VjnhqcqzMDIK8DxmdMF iVuzL7FF+IIkPYfPDEMwk+nhavSu1yud3P7vuvW8MNG+EIBMSAUxB810WN131y4BjxgP 1qSROqGCOOyPe9xXI3vm2fmel6itYOAIKN3tI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689467894; x=1692059894; 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=zNoxu32mEYZ+4CZxrWnIdM9zRi5f7vUF4VYUTds+Eps=; b=GvTfZ9VL6uTdq2dkVW5WN+rCvFd/BboVJW4d0Ve8wce1u7HxwOyhSFHHWH1eWo5tnO 6FdtCY7qkZnXxWGHcazRQR5pWtQeuuWPQqZrXtFdvqn/23X731jk7xCfnPQeJCA9sIA+ CZJ/K9jjpov3oA9AG8jHlRAr5a00O+a5ijcOmN6wkiwz76hJwBLWnmcOftvda022dQpi qGiuBPjPBKiLw9ovqUMwaXYvesFgjdlb+x5aRpygW5DlVx1ORDOtKEaAKx4CPBqHyTlr fbM1bMVaYfxKR0hYouYdRYJrVn/DsyPBBGAKm9soaDlh7qgN4df59Q55iiG5wFLmAaVB +n5g== X-Gm-Message-State: ABy/qLZORjG++kAGhmfJ9JxW9MAL8WWM9WMr/eZ+PjjDuH/010m8Ehig xWlj8li6FxNPPYSlemTOmloSrwdi9onzbphmcgU= X-Google-Smtp-Source: APBJJlHd0fwnz4pXz6UXvyWbU49Uun3uOzOmGjiNdTkccniQu3gpzrvazlKH+rTadHQ5zXyv9cO4HA== X-Received: by 2002:a92:d984:0:b0:345:d326:9c7f with SMTP id r4-20020a92d984000000b00345d3269c7fmr8298294iln.29.1689467893891; Sat, 15 Jul 2023 17:38:13 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 17:38:13 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Mike Frysinger , Simon Glass Subject: [PATCH v3 72/81] buildman: Move checkout code to a separate function Date: Sat, 15 Jul 2023 18:36:40 -0600 Message-ID: <20230716003718.231903-73-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 Put this in its own function to reduce the size of the run_commit() function Signed-off-by: Simon Glass --- (no changes since v1) tools/buildman/builderthread.py | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index 78405956ef51..0c73b8646b1c 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -326,6 +326,26 @@ class BuilderThread(threading.Thread): out_dir = os.path.join(work_dir, out_rel_dir) return out_dir, out_rel_dir + def _checkout(self, commit_upto, work_dir): + """Checkout the right commit + + Args: + commit_upto (int): Commit number to build (0...n-1) + work_dir (str): Directory to which the source will be checked out + + Returns: + Commit: Commit being built, or 'current' for current source + """ + if self.builder.commits: + commit = self.builder.commits[commit_upto] + if self.builder.checkout: + git_dir = os.path.join(work_dir, '.git') + gitutil.checkout(commit.hash, git_dir, work_dir, force=True) + else: + commit = 'current' + return commit + + def run_commit(self, commit_upto, brd, work_dir, do_config, config_only, force_build, force_build_failures, work_in_output, adjust_cfg): @@ -381,15 +401,7 @@ class BuilderThread(threading.Thread): # to be reported. if self.toolchain: - # Checkout the right commit - if self.builder.commits: - commit = self.builder.commits[commit_upto] - if self.builder.checkout: - git_dir = os.path.join(work_dir, '.git') - gitutil.checkout(commit.hash, git_dir, work_dir, - force=True) - else: - commit = 'current' + commit = self._checkout(commit_upto, work_dir) # Set up the environment and command line env = self.toolchain.MakeEnvironment(self.builder.full_path) -- 2.41.0.455.g037347b96a-goog