From patchwork Sat Aug 12 15:30:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 713194 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp428200wrp; Sat, 12 Aug 2023 08:30:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHuPUUaRWhy5jxF1gJQGql47yzy0S9u+qs2K2G+zYvi6FInV07Fj6be5FZrP5tIC3+i8wd1 X-Received: by 2002:a1c:7419:0:b0:3fe:1f2c:df1a with SMTP id p25-20020a1c7419000000b003fe1f2cdf1amr3862572wmc.24.1691854256745; Sat, 12 Aug 2023 08:30:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691854256; cv=none; d=google.com; s=arc-20160816; b=AgvHGNMkYes0iTafE+2NarkWMC5FQocgza3yZ8c0G5rZ7EFvltRVvgBmnPSBm/jqir YmvdekU2m35QwjlJbgNOnlaN6BoMghPY09j7j8cR23MxRfgurVODWbZJa8QPmdj85lA3 XrNiOkO9tsYb9x3yo3yZpq3z+jpb55o46Ml7ISJH9Cjg5BtJHRBE9DPmsmW8ec23J9FI 1qEyiGTei0To7XvVWxWMKVb3q9oxFz5qfDEN3xtGQAXZ8seoT6vMO58qRPShqAXnfksu MlZycr7F6XCtgO9H0MAJdTVw6r19p/UfayBXz9ioYHgiPJ2uXgU5kJ7vVyeM/VIsVJSB DHPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=mMp6wr6HjQqzeAw721kx8mNGnjF7byZt+pvI3sd3glA=; fh=pvWoYJ8DnC9IyTD46q2s71hlWpPSBdE/YYp0/eyIYcc=; b=PaJmUhhuVLudu9QnoBNp+fre8IXjruElhpX0RMlxpa7EiQyQiMJAsSIBlHOEhsb3Nr qCxrHMFZBlkdh0ayiulayUyG4/YOVImp5LdLoopbm2LQyAZGQGmC3XGzpPOO4bbwAsEd nwdefdbkCtgMRhpsEwXW3wLXVVTIIuMiIK4ru67fnGEemf1K32Wrr1qF6MayW0V9G3H0 ukF8ziD5SGgFHc1SjOQhyBp/XS8dJlowkQ66BKYwP+H2YFkwka/Kl1NHnrPz2pj3hEc7 ho7vCJRVjoyz57pWcG5//t9yNBqjpaK+IN0YaaQvbFMAtgBpq7O70IgceuNY464c1rhP lOwg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id d1-20020adfe881000000b00314237f008dsi3398043wrm.846.2023.08.12.08.30.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Aug 2023 08:30:56 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5F69586918; Sat, 12 Aug 2023 17:30:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 1D43A86957; Sat, 12 Aug 2023 17:30:47 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 298C68638E for ; Sat, 12 Aug 2023 17:30:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A0F8E1042; Sat, 12 Aug 2023 08:31:26 -0700 (PDT) Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.46.7]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C99C63F6C4; Sat, 12 Aug 2023 08:30:41 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Takahiro Akashi , Malte Schmidt , Michal Simek , Tom Rini , Sughosh Ganu Subject: [PATCH v10 01/10] binman: bintool: Build a tool from a list of commands Date: Sat, 12 Aug 2023 21:00:15 +0530 Message-Id: <20230812153024.334563-2-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230812153024.334563-1-sughosh.ganu@linaro.org> References: <20230812153024.334563-1-sughosh.ganu@linaro.org> MIME-Version: 1.0 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 Add support to build a tool from source with a list of commands. This is useful when a tool can be built with multiple commands instead of a single command. Signed-off-by: Sughosh Ganu Reviewed-by: Simon Glass --- Changes since V9: None tools/binman/bintool.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py index 0b0f56dbbb..3c4ad1adbb 100644 --- a/tools/binman/bintool.py +++ b/tools/binman/bintool.py @@ -328,7 +328,7 @@ class Bintool: return result.stdout @classmethod - def build_from_git(cls, git_repo, make_target, bintool_path, flags=None): + def build_from_git(cls, git_repo, make_targets, bintool_path, flags=None): """Build a bintool from a git repo This clones the repo in a temporary directory, builds it with 'make', @@ -336,7 +336,8 @@ class Bintool: Args: git_repo (str): URL of git repo - make_target (str): Target to pass to 'make' to build the tool + make_targets (list of str): List of targets to pass to 'make' to build + the tool bintool_path (str): Relative path of the tool in the repo, after build is complete flags (list of str): Flags or variables to pass to make, or None @@ -350,12 +351,14 @@ class Bintool: tmpdir = tempfile.mkdtemp(prefix='binmanf.') print(f"- clone git repo '{git_repo}' to '{tmpdir}'") tools.run('git', 'clone', '--depth', '1', git_repo, tmpdir) - print(f"- build target '{make_target}'") - cmd = ['make', '-C', tmpdir, '-j', f'{multiprocessing.cpu_count()}', - make_target] - if flags: - cmd += flags - tools.run(*cmd) + for target in make_targets: + print(f"- build target '{target}'") + cmd = ['make', '-C', tmpdir, '-j', f'{multiprocessing.cpu_count()}', + target] + if flags: + cmd += flags + tools.run(*cmd) + fname = os.path.join(tmpdir, bintool_path) if not os.path.exists(fname): print(f"- File '{fname}' was not produced")