From patchwork Tue Jul 25 08:57:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 706124 Delivered-To: patch@linaro.org Received: by 2002:a5d:464f:0:b0:317:2194:b2bc with SMTP id j15csp68791wrs; Tue, 25 Jul 2023 02:03:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlGW4yOGb+2l6sEHRAbE/bJpSAPJ9XeIu+0HCa3B6uIIpItpz/2BziUZ0/K5I5CO6WniPGcA X-Received: by 2002:adf:f583:0:b0:313:f3c0:62d8 with SMTP id f3-20020adff583000000b00313f3c062d8mr1441126wro.21.1690275829914; Tue, 25 Jul 2023 02:03:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690275829; cv=none; d=google.com; s=arc-20160816; b=TJGjs/g8ZqQlUGUZGGlv/RKx5x7vtZmWurKxKHcxxGaGiIHdIURSWQXZioxnUWAsvk j4D9CFqLiHGnFZlh6hpvBfb6LaBnt1DQg2KFHHh0Od19YFOnw/U5kP9s6QzMJ8S2wNo5 s7vZMhaexLNvXHD+x81raokxiii1D1Q1pTaMiAQABRfVl9jfRWqGs2IDyImf5tKAqeD6 tj+3Gre11zML43z3WThtASYWKp0t4kM0PwzNGsFmdDiDav5Z4UIuObzc0l982McYGo1b ZqfCQWHqJJyTGemE96M9c8QA4u40upbeFre9GNU9sg6MMz3fkgS21YTCsvLy+pp3WLaB nPdg== 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=/zIZArEfJBeIjTtBHcDlZpygg8wVMcvhjLIOSGqB53g=; fh=pvWoYJ8DnC9IyTD46q2s71hlWpPSBdE/YYp0/eyIYcc=; b=EI5/NzdLGV8mX7DjJkCZZ9cJ84oKVW2h+BMnxWyKoyJqyAmjaNAp6FSO5zzwDoTc/H ARZU/dIU2yxE6ZHQmawT2826TvFrZQbiSs419ysRb5vWesCKrMwDx7KVjbrjYIAcu+D1 NcGgUMLLPCdNEfmEEaNm8pqPH5lyh0+HMCQqAjnyWeypzfT9L/P2LLVb7oo/SuLpgIn6 NktfmppV3IVepuFMsIdu6wJflrQTyVSx1TshsfHGj/nfQN6X3tMJaQlHBnlnoytnQ8oY XY9nnCVJiiLMEP6Zr5OJg6fi7Rd8ydqz2hSZMNrXir8QAJ0AwRms4lBzNWWq0GqTgwxf grKQ== 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 d8-20020adff848000000b00314237f008dsi5931305wrq.846.2023.07.25.02.03.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 02:03:49 -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 DCC0686865; Tue, 25 Jul 2023 11:03:47 +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 26FF286797; Tue, 25 Jul 2023 10:59:32 +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,T_SCC_BODY_TEXT_LINE 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 90F5486807 for ; Tue, 25 Jul 2023 10:57:58 +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 F24C815DB; Tue, 25 Jul 2023 01:58:40 -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 0B1AC3F6C4; Tue, 25 Jul 2023 01:57:54 -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 v5 01/12] binman: bintool: Build a tool from a list of commands Date: Tue, 25 Jul 2023 14:27:14 +0530 Message-Id: <20230725085725.350917-2-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230725085725.350917-1-sughosh.ganu@linaro.org> References: <20230725085725.350917-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 V4: * Pass the single command target names directly to the function instead of putting them in a separate list. 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")