From patchwork Sat Aug 5 11:34:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 710645 Delivered-To: patch@linaro.org Received: by 2002:a05:6359:d30:b0:129:c516:61db with SMTP id gp48csp501916rwb; Sat, 5 Aug 2023 04:35:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEWM3GqQFXzTdRxoPaDMC9QkuJ1K2hMrIAxLk0jUJ/ed+2X4icZviXsExnY+aBPfG34BXFQ X-Received: by 2002:a05:600c:260c:b0:3f8:f382:8e1f with SMTP id h12-20020a05600c260c00b003f8f3828e1fmr2975654wma.24.1691235336390; Sat, 05 Aug 2023 04:35:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691235336; cv=none; d=google.com; s=arc-20160816; b=egGbaRt2QflqPKuhx/vt+8qRC0l8PdU/RQCQ7xvlFBEphBh4k/E03f43aHErFbe8e7 n7cLSL5KvExtqP7sLVZHTKkJLYnh9Gzve5U/cD8WYH40AooYnMZZAdDXDKmm7DhC4zWR wF5CqGldFgEmmY8PPOQsFyzA3jIHoaDU1lQq/ndpveLyrfQSqiIAH3GQ3Uq7EmWt9rCX F+XG3Ja99HHIyA9OeLaarJpQKHj+kWAm/Fqdm+b2A5o8IfFk5rzfKUniXLIGezA3AjaH DSh2Eunp4PzvR6hMyzkk1zFL2sh7twQMap+snSEFh90hSVKbMRVi0bDsLGwaJzaa15FT ZzAA== 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=MZWWkAdYYxP+XT+W+6WU7Kf81YHYISoY4tHttMop6PA=; fh=pvWoYJ8DnC9IyTD46q2s71hlWpPSBdE/YYp0/eyIYcc=; b=0HJpLCdF2UoUvyw+oMlCFdMk79vapOz6RCYDI5ke824t0PcgASQHI3LkLsMcihWQVx V5Er51RUFDaWRIwmoHWK+TxwUB7GwehS/fPYqRR5CPXToXUmU8cDqmmi4DR6eu2J16Ck iXJT71v3tg5HzDytbVW+db6gn2XIn6+b8tOZ0GHr8igi4QHQZPXptZJObrzRPfhQDFxv mI9du0NtQE2Zo8wF5r7QMQyJr+XPz9iVy3ngBIWUZpVtP7vf215uiDEMiQEHV4ZFj+Yu pb/zrOc99GIAq6zOXvN70i9dVaFupC1eI9/w4LUE5skVbuYLOOYBYhPk8yIc3n8unTAD ZdxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id j18-20020adfea52000000b00317847f7c7asi1941078wrn.156.2023.08.05.04.35.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Aug 2023 04:35:36 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 0C697867EF; Sat, 5 Aug 2023 13:35:30 +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 3493F867D6; Sat, 5 Aug 2023 13:35:28 +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 218038666E for ; Sat, 5 Aug 2023 13:35:26 +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 248021007; Sat, 5 Aug 2023 04:36:08 -0700 (PDT) Received: from a076522.blr.arm.com (unknown [10.162.46.7]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9D43E3F5A1; Sat, 5 Aug 2023 04:35:22 -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 v7 01/11] binman: bintool: Build a tool from a list of commands Date: Sat, 5 Aug 2023 17:04:48 +0530 Message-Id: <20230805113458.1430239-2-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230805113458.1430239-1-sughosh.ganu@linaro.org> References: <20230805113458.1430239-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 V6: 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")