From patchwork Tue Aug 1 17:40:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 708738 Delivered-To: patch@linaro.org Received: by 2002:a5d:55c5:0:b0:317:2194:b2bc with SMTP id i5csp472818wrw; Tue, 1 Aug 2023 10:40:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlFTfy3v+CuFY1MS/Ku+wZrt+sCeMf0bf1BJ9EYU93R55qjBIbJ/Vntkz/9itSY+c1xKI4aQ X-Received: by 2002:a05:6000:1082:b0:313:f957:fc0c with SMTP id y2-20020a056000108200b00313f957fc0cmr2936775wrw.47.1690911653008; Tue, 01 Aug 2023 10:40:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690911652; cv=none; d=google.com; s=arc-20160816; b=GQsF+VYJs9uLUa8kdnf+5hYzo7pDGDzJagm38Qj4wz9+ti6r1cnUSZrfhZqUv3555Z PMw7qHo5bhPLe6p1Cy1f/teoA3qsqDideygTkGQFPMmSZ2LnTAnmWvkHX74AjXa++0Za yBpzNfuzkddtDcKQqaTFwzXQLG7hmgGp8JlwEdqMFO7eHHyzdDmdBRtR6GVX3/0ztwLH 2SJg6tuKUe+8Rbf0bhUDX6QGYnszUNvBZ4U2g/lS4HYYMo8CGzhed4ge1tSw+lpwjEd1 lTMjQsdhuFe8KmVVTa/T3/nNVwlP9w7kcTbgAv9IV3BPlsKZ7/5osXOuhvwg6yp8PUWM vJ7g== 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=oUe1jCr6OyqmAjtFGYJddTK5ueGQ3NRl9nv9QsWGZqo=; fh=pvWoYJ8DnC9IyTD46q2s71hlWpPSBdE/YYp0/eyIYcc=; b=Te2X2OKx4u0qMKsYC1fptO1ErC32RLQpEAmAHbSWJ9IAAO8nQkfWUWJtxO/utNR+TH DZvSowJuh/vGHadi39QoCk7GrfZlHNVu0bpHFlitEwn49ekB8OyIyTmG6uNiXBsYgi3h g4AbdZ2KwGt3s+X/pbEtnIJuu+ombqOc3QNRsyUwnNk/H0PW5lg1Y/3ID2NWnxZEQAtm ZjXgvbQq5cYPdr4FU2+nhgVNGPX6L22pmL2oMJyDXOYPRMxXXgoIaGZJGINIb4Wb+bGv 9GGF7QKs22wsGPgiRkpwGK6A7FU3A3wW0nE3qJU9fV5UfRDHIGXTxMHtktMYQj4FUwzZ IjUQ== 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 t15-20020a5d49cf000000b003179e275374si2803305wrs.114.2023.08.01.10.40.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:40:52 -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 0EB5D86C54; Tue, 1 Aug 2023 19:40:45 +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 2D5CB86CA3; Tue, 1 Aug 2023 19:40:44 +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 1471586B09 for ; Tue, 1 Aug 2023 19:40:42 +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 EF93AD75; Tue, 1 Aug 2023 10:41:24 -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 A0CBC3F59C; Tue, 1 Aug 2023 10:40:38 -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 v6 1/9] binman: bintool: Build a tool from a list of commands Date: Tue, 1 Aug 2023 23:10:10 +0530 Message-Id: <20230801174018.1342555-2-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230801174018.1342555-1-sughosh.ganu@linaro.org> References: <20230801174018.1342555-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 V5: 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")