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 4E3F3C0015E for ; Thu, 20 Jul 2023 00:03:07 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EE193868F1; Thu, 20 Jul 2023 01:52:59 +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="C8IeSB5V"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4992786817; Thu, 20 Jul 2023 01:51:02 +0200 (CEST) Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) (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 CE04786795 for ; Thu, 20 Jul 2023 01:50: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-io1-xd34.google.com with SMTP id ca18e2360f4ac-78666994bc2so9500739f.0 for ; Wed, 19 Jul 2023 16:50:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689810654; x=1690415454; 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=V8NeVoiHB5beJg79+gy9a3+VkGhI2BXCVul5cLtrTXs=; b=C8IeSB5Vpfa67w18L7sZzuRB8i9TYkWeWwYTPaQN3iWn2ojFAvyIQohGVUmzdbD4S4 ixJbzXKR9h3myGcyTNPoa3w8BQp/scCDpz8upMeWyyj/TBf2owuIg/ZgiW2JHErZYstN v6vNj95n9aStS6SDyl3S54hD9fpw4GABYsEd4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689810654; x=1690415454; 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=V8NeVoiHB5beJg79+gy9a3+VkGhI2BXCVul5cLtrTXs=; b=GpS34I8nuZiVEwfjVmpmz4NimbzQBeU7T+j54ex3OtkGvRWH+VF0kCNioGS0uqALa8 O6MJCeKGoFefERxm4oKcqNbrHx3D2otGaXAQaNsM8hi2AGbacMCjwf6xoAkkQEagObHm oZQo+nlkXhDOmfhZs9msa2VzG30Jow3jiskr7J5aLYXZHSxora4dac181gVfN3k5ITBp cMMqeDyIZYz4ZnNueBAKU61eTfCriHfuBQ+evhVe+VtqPWkwpbU94+RbcD4fTd8xaqFs EEiwDfjvWPekks9CmAniMzG0TmJU07GSqJT0h3xsToDL88exDmlIABuAM9Te2NfLCaNE YEbw== X-Gm-Message-State: ABy/qLaKMdcr1m3ZVKNekni1lEpBKYSLQAzDaJDhLiaGHs6kTpryBveZ CSgSluFcErCgEQ0TypaRQjAVQfZJfFHQP+fr1YM= X-Google-Smtp-Source: APBJJlHd/PdoaAARbjTXXB/qTWLhakDPu5r3gt7vk5AdYsXEEoXJQQLypoqrsYxwIlv2Dy4TuolQWA== X-Received: by 2002:a5d:9ada:0:b0:785:fbe8:1da0 with SMTP id x26-20020a5d9ada000000b00785fbe81da0mr5762984ion.15.1689810654459; Wed, 19 Jul 2023 16:50: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 ed16-20020a056638291000b0042bb1779c18sm1551779jab.151.2023.07.19.16.50.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 16:50:54 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Mike Frysinger , Simon Glass Subject: [PATCH v4 74/83] buildman: Move checkout code to a separate function Date: Wed, 19 Jul 2023 17:49:22 -0600 Message-ID: <20230719234953.796101-75-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 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.487.g6d72f3e995-goog