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 0EBD0C001DE for ; Thu, 20 Jul 2023 00:01:54 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 49A46868DF; Thu, 20 Jul 2023 01:52:52 +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="lLvyqQ6g"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 55BF286801; Thu, 20 Jul 2023 01:50:58 +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 C73E4867CA for ; Thu, 20 Jul 2023 01:50:50 +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-78372625badso8538039f.3 for ; Wed, 19 Jul 2023 16:50:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689810649; x=1690415449; 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=61m6LMer4DmGG4jTn/sv3BpkG8QRbG/pdD8Nbthnh6c=; b=lLvyqQ6gHSOspVzhRzE2xlKa1q7NPgMpOQeqaJ8InU7FssnkIKPLo+tTz9HtK+HJ3t duxkUgwHfO39nWwWvaYBnSBrGDMbEoNsHEP29/iUtuAPGtsfASV5uiWUEmnHdPCpzVtv C9rAne61UWldPuW+z/c6NSxBdS9E1U+4mL1oU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689810649; x=1690415449; 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=61m6LMer4DmGG4jTn/sv3BpkG8QRbG/pdD8Nbthnh6c=; b=P/9lnNC8E0sUpNuOUmIs15nBwxZY4PTPpS+1EuVxcFqDH5Nsk3J3d1VEYKH9IDOVss ljHGhica2813qM/W5iJOrDKOH1v1JX4TSE9oMH2dwfz9vXgQNjDk6jHWaz1ai7/ClreN A5nFqgQANv4kagm9V4zCOpyGPh/bWuOcDR568XbICUbFYPXl7bikNks+o3OrNTX14r+X fhXXcB3F2finJxP2lffN9NdrJSak2rJOTTyHJyRmIMBh/OyAoQ8UObT6tnq7QiSFpG6j /MDd/1Gjrhffsm2sevwM/C2Dq58mLiw9NPEqXVQdetqojr6jc0acECyX6MLevrmyRMTS pWiQ== X-Gm-Message-State: ABy/qLZAP4K8K/GZayyj7cjJljAmuhNMnAmmXXN1h21UlTRyZ5sjF9LH yXl91erDq7Zt3xM5m1ULreotfajaQFFVxkz+oDs= X-Google-Smtp-Source: APBJJlHF2A2Wzq1q4XEnEG4mlS+RRra92XlQovTVIgTmP6OiY5iYW3B6VjgOijXvZF9HtXr9LFcjJQ== X-Received: by 2002:a5d:8403:0:b0:783:6190:f913 with SMTP id i3-20020a5d8403000000b007836190f913mr3991900ion.4.1689810649410; Wed, 19 Jul 2023 16:50:49 -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.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 16:50:49 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Mike Frysinger , Simon Glass Subject: [PATCH v4 67/83] buildman: Move more things into _build_args() Date: Wed, 19 Jul 2023 17:49:15 -0600 Message-ID: <20230719234953.796101-68-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 more of the argument-building code into this function. Fix a missing assignment for out_rel_dir too. Rename the function since it now builds all the arguments. Signed-off-by: Simon Glass --- (no changes since v1) tools/buildman/builderthread.py | 55 ++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index e7d9a29d03ef..42af5197dace 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -137,13 +137,40 @@ class BuilderThread(threading.Thread): return self.builder.do_make(commit, brd, stage, cwd, *args, **kwargs) - def _build_args(self, args, brd): + def _build_args(self, brd, out_dir, out_rel_dir, work_dir, commit_upto): """Set up arguments to the args list based on the settings Args: - args (list of str): List of string arguments to add things to brd (Board): Board to create arguments for + out_dir (str): Path to output directory containing the files + out_rel_dir (str): Output directory relative to the current dir + work_dir (str): Directory to which the source will be checked out + commit_upto (int): Commit number to build (0...n-1) + + Returns: + tuple: + list of str: Arguments to pass to make + str: Current working directory, or None if no commit + str: Source directory (typically the work directory) """ + args = [] + cwd = work_dir + src_dir = os.path.realpath(work_dir) + if not self.builder.in_tree: + if commit_upto is None: + # In this case we are building in the original source directory + # (i.e. the current directory where buildman is invoked. The + # output directory is set to this thread's selected work + # directory. + # + # Symlinks can confuse U-Boot's Makefile since we may use '..' + # in our path, so remove them. + real_dir = os.path.realpath(out_dir) + args.append(f'O={real_dir}') + cwd = None + src_dir = os.getcwd() + else: + args.append(f'O={out_rel_dir}') if self.builder.verbose_build: args.append('V=1') else: @@ -161,6 +188,7 @@ class BuilderThread(threading.Thread): args.append('SOURCE_DATE_EPOCH=0') args.extend(self.builder.toolchains.GetMakeArguments(brd)) args.extend(self.toolchain.MakeArgs()) + return args, cwd, src_dir def run_commit(self, commit_upto, brd, work_dir, do_config, config_only, force_build, force_build_failures, work_in_output, @@ -199,6 +227,7 @@ class BuilderThread(threading.Thread): result = command.CommandResult() result.return_code = 0 if work_in_output or self.builder.in_tree: + out_rel_dir = None out_dir = work_dir else: if self.per_board_out_dir: @@ -259,25 +288,9 @@ class BuilderThread(threading.Thread): # Set up the environment and command line env = self.toolchain.MakeEnvironment(self.builder.full_path) mkdir(out_dir) - args = [] - cwd = work_dir - src_dir = os.path.realpath(work_dir) - if not self.builder.in_tree: - if commit_upto is None: - # In this case we are building in the original source - # directory (i.e. the current directory where buildman - # is invoked. The output directory is set to this - # thread's selected work directory. - # - # Symlinks can confuse U-Boot's Makefile since - # we may use '..' in our path, so remove them. - real_dir = os.path.realpath(out_dir) - args.append(f'O={real_dir}') - cwd = None - src_dir = os.getcwd() - else: - args.append(f'O={out_rel_dir}') - self._build_args(args, brd) + + args, cwd, src_dir = self._build_args(brd, out_dir, out_rel_dir, + work_dir, commit_upto) config_args = [f'{brd.target}_defconfig'] config_out = '' -- 2.41.0.487.g6d72f3e995-goog