From patchwork Tue Aug 22 17:39:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 715768 Delivered-To: patch@linaro.org Received: by 2002:adf:f747:0:b0:317:ecd7:513f with SMTP id z7csp392506wrp; Tue, 22 Aug 2023 10:40:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHyjE+KsYm9k9UPc84TiMmie7cDiNddisUF5Q1JXZ0PhGGrBwT1/hh/RzzUKXKarZxD4ND0 X-Received: by 2002:a5d:4246:0:b0:317:ef76:b776 with SMTP id s6-20020a5d4246000000b00317ef76b776mr7907908wrr.68.1692726049328; Tue, 22 Aug 2023 10:40:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692726049; cv=none; d=google.com; s=arc-20160816; b=vVkRq6bbXfglCreui1Wo7oe0XT76Dly86rX6mcxn4Be8HUO0XSiH7hcbmz8m5EyDy5 Mmy2jRQuOez9YiA3aZ8F+dk67S232NBZ+fQrf5TY4CJzO1iYLjMQhLDt2BsIIr63/IIi IxJxQPX7Bk6Y7XswUbBiewXpYnZHOdpzBUwMAXo1+Y+CxoIKjo0CEtjeTFWcpiteMo09 qrzxY600h6QDYVUOU69p7HYfBnH5/h5jFrHOj2Xodf5BYU4zAqTBr8fN7/Yrgui4/dvu vhJSRxSCq8PqzAI6ygEY3NowVZGTIJBBn+CusGmdzmJ7R8iG1niNUsSeDA4wPa9KmEyF evJQ== 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=ESg9UyLSFfSJUovOnNSO0vLi623LTFjqbQsFEoe+ckI=; fh=ikJSK2WVWLZPtKfyjzYjMbDKcRMYT5CY2x/iGdlGnWY=; b=yoVZonda10vPk7lzKyJ8tEWIgcrv+0tCNtPWzwbS10FeD2UtpgvjuSAsENoXXn0oN4 npNUzBMh8nlodsSViQO3KPOgcm+sRhQdoEe3z9o4VFXcq58c6vX4MgwDih5TzqB97jqq 5hI+EH9LsIQAId+bcJrwHfjQARp633cneqOx5tEOiEm+1LZwmjxpcwrxXaU69qGLTS0T BFHbh9fRkeyXtiUO2lgi2lm92/sK45Eqe5pR4iFOoU6gN9IbeHB6GPUhwARa1SumyQLX kTp212DdrUPUWCkV2GiTsLLhTJS9Pam5yW1NXm7+KoJPdcJMo/aSZtge/OYpocemvcQj 4Lww== 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 u6-20020a5d5146000000b003111ced4e61si5246145wrt.106.2023.08.22.10.40.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Aug 2023 10:40: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 C743E864A4; Tue, 22 Aug 2023 19:40:41 +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 2A069864A4; Tue, 22 Aug 2023 19:40:41 +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 E961C86497 for ; Tue, 22 Aug 2023 19:40:37 +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 53E1711FB; Tue, 22 Aug 2023 10:41:18 -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 3E30B3F762; Tue, 22 Aug 2023 10:40:35 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Takahiro Akashi , Tom Rini , Sughosh Ganu Subject: [PATCH v11 01/15] binman: bintool: Build a tool from a list of commands Date: Tue, 22 Aug 2023 23:09:54 +0530 Message-Id: <20230822174008.626239-2-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230822174008.626239-1-sughosh.ganu@linaro.org> References: <20230822174008.626239-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 V10: 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")