From patchwork Sat Aug 12 05:57:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 713183 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp240361wrp; Fri, 11 Aug 2023 22:58:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGoakIhKbBIC1fmNK5SBJhqPviy+cS1YrzFBalASvnnSJ3jqJ/ZW+jUMlarT9mOi4zbB6ad X-Received: by 2002:adf:f8ce:0:b0:317:3d78:c313 with SMTP id f14-20020adff8ce000000b003173d78c313mr2964278wrq.60.1691819880313; Fri, 11 Aug 2023 22:58:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691819880; cv=none; d=google.com; s=arc-20160816; b=uyMH7dtmFUpIh/3sHB8auyLLX8xM8iMASHdlZqoCbIqkCnUpbyXap1nTMcHKoGPo8/ /Y88qrHIiVbTSiGC0Smnya0rO9oYpz9lxTJpPR8+n+xlMdrFQ1ZEgajWLKY2lrv/daWC NUQdcbUpnveJE2LCY81OXmuh3w4HYGURdOk/yKBDR8pAoniNXhdqOaEQCAAuFhkq+AAM hDNTN9lpypPLw/wu77N9vFCOJwKbh+QXmMveoANHTLl60msx1wrbUq2f5w5Y/c7lCGPh C4j3IJWewSAGAXnUvxEUJsrrnwtWuxB6ZA3tZWc+9z8bBrkiKfwtUCUT7+r2TzA84I7d 3EDg== 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=pXSu5yPWqNAn322ykmlAkkNDaElTxvWigOcIkCM6IXw=; fh=pvWoYJ8DnC9IyTD46q2s71hlWpPSBdE/YYp0/eyIYcc=; b=ZG947DYsHv4aNF+k6MKyIuYBN7Q81G02O5enVS4JR0GgEKtcMNyDnxjvg4AvC76zXf VcYQFuGVDAXo2KHDSKolr7RDMHSdqylorBH5bNPP/ybbgvDX90aE2msFa+L3XN6Kr6BF XtBrIvoDvFXCM97N/SJ6apyKT3d4xRKA/zy/+zaHICyz1Q99/3MveWWYiiUZvaHrC5tq 8huaQ5f01ekEtmpdWEWzQD+dpkrnDHh7iVxiLp1x2JOXYHuSLGLjAgGYkEROmLavuOxA aUQxiaXsHn4gWYALbbbSeDImYd6cDuuI2ypxjUIf/H4o75L6tTqga7Y2Jh09rHg0+I/G 6v6A== 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 g11-20020a5d554b000000b003177e454123si2949934wrw.205.2023.08.11.22.58.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Aug 2023 22:58:00 -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 5FBA586961; Sat, 12 Aug 2023 07:57:51 +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 1DE4A86959; Sat, 12 Aug 2023 07:57:50 +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 30D1E86954 for ; Sat, 12 Aug 2023 07:57:48 +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 BF387113E; Fri, 11 Aug 2023 22:58:29 -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 039953F64C; Fri, 11 Aug 2023 22:57:44 -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 v9 01/10] binman: bintool: Build a tool from a list of commands Date: Sat, 12 Aug 2023 11:27:16 +0530 Message-Id: <20230812055725.252424-2-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230812055725.252424-1-sughosh.ganu@linaro.org> References: <20230812055725.252424-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 V8: 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")