From patchwork Sat Jul 15 13:45:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 703193 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp153891wrt; Sat, 15 Jul 2023 06:46:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlFnUVx9EZfZ8bXMLfKusieSuDK3tRPnTjEn5f2RNuGk0zOahTwGlSaZ7Ltx2udZcnCjDf2h X-Received: by 2002:a17:906:3a19:b0:991:c566:979 with SMTP id z25-20020a1709063a1900b00991c5660979mr5740232eje.36.1689428778501; Sat, 15 Jul 2023 06:46:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689428778; cv=none; d=google.com; s=arc-20160816; b=hu3FCHPL6iBeIMqwtrnqMCf+Ox3Aj6nlJvL8vbJ28c7teMX5T2KyXm/xdGP04qzNnl sKoZi5T7bF8L37/hxmgURd17KGmT0zYHqDaXX6P3mYh99Fe3rTTpxVAeRWKAGzMu+Yj/ bfooSVQUTySzpebCzkknna62JDE+26na6vDHwlLkl8mcI44wzT/ZEBLu70LTS02QDadq kk9XQviYeCu/8B+kxuXYn0U6UPnG9hJD4U1EuiWmNIGyENCrp4O0k1vaFBvMTasulkKi j+DVWQP0l1BvFZmCeWw5lLzJZwyNcYKL22eOo+jv7fEb1zSf2QLQYcql3o67lHIjdEQ/ jUVw== 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=eE8xU6LLEzlbIazY5lEZ26+o94nQfUSJ4XnD69ksOdM=; fh=pvWoYJ8DnC9IyTD46q2s71hlWpPSBdE/YYp0/eyIYcc=; b=w71BkhPqrb3D8uXpjnOhA6cmwwtSZmKxHB3pOhz08Y4cOsD5+Oz+6afcqQ5x318uPC dfMm6V8OS03fjSBkg4guWe83pJ1fhdLtq8Y9Pm19KuS7KZNqOri9maGSkgffHszsSVn/ ZhO7EyV/kChFlEeHcolCV+ZL9TVUsbi3Tl9Hn72Csy1fuG5UbAUqFCCSsoXlSvEn1ANK hzXv4SMjKI9t/xC7snj3QG/l2ot/bKM9TShKHXsE/a9ILcuYD4HRLJua3ZBs6KV0j7Xe VM/r4NwyRaizsu7G9UXf7RWHskv7qqKpv3STIJm4KkDGXnx8qqwNR9z1BhuJg+9g/0qs e5ew== 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 d12-20020a1709067f0c00b009886470de61si10248015ejr.857.2023.07.15.06.46.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:46:18 -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 858CC86139; Sat, 15 Jul 2023 15:46:08 +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 8A55986154; Sat, 15 Jul 2023 15:46:06 +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 5816C860AC for ; Sat, 15 Jul 2023 15:46:02 +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 0CEE81063; Sat, 15 Jul 2023 06:46:44 -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 140573F67D; Sat, 15 Jul 2023 06:45:58 -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 v4 01/12] binman: bintool: Build a tool from a list of commands Date: Sat, 15 Jul 2023 19:15:22 +0530 Message-Id: <20230715134533.2025893-2-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715134533.2025893-1-sughosh.ganu@linaro.org> References: <20230715134533.2025893-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 --- Changes since V3: * New patch to support passing multiple commands to the build_from_git function to build the tool. tools/binman/bintool.py | 19 +++++++++++-------- tools/binman/btool/_testing.py | 3 ++- tools/binman/btool/fiptool.py | 4 +++- tools/binman/btool/futility.py | 4 +++- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py index 81629683df..279bf2fec4 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") diff --git a/tools/binman/btool/_testing.py b/tools/binman/btool/_testing.py index 4005e8a8a5..c0109c76bf 100644 --- a/tools/binman/btool/_testing.py +++ b/tools/binman/btool/_testing.py @@ -32,5 +32,6 @@ class Bintool_testing(bintool.Bintool): return self.apt_install('package') return self.fetch_from_drive('junk') if method == bintool.FETCH_BUILD: - return self.build_from_git('url', 'target', 'pathname') + cmd = ['target'] + return self.build_from_git('url', cmd, 'pathname') return None diff --git a/tools/binman/btool/fiptool.py b/tools/binman/btool/fiptool.py index c80f8275c4..b275fee43b 100644 --- a/tools/binman/btool/fiptool.py +++ b/tools/binman/btool/fiptool.py @@ -107,8 +107,10 @@ class Bintoolfiptool(bintool.Bintool): """ if method != bintool.FETCH_BUILD: return None + + cmd = ['fiptool'] result = self.build_from_git( 'https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git', - 'fiptool', + cmd, 'tools/fiptool/fiptool') return result diff --git a/tools/binman/btool/futility.py b/tools/binman/btool/futility.py index 04c9aefe9b..4b22547368 100644 --- a/tools/binman/btool/futility.py +++ b/tools/binman/btool/futility.py @@ -168,9 +168,11 @@ class Bintoolfutility(bintool.Bintool): # # Unfortunately this requires logging in and obtaining a line for the # .gitcookies file. So use a mirror instead. + + cmd = ['all'] result = self.build_from_git( 'https://github.com/sjg20/vboot_reference.git', - 'all', + cmd, 'build/futility/futility', flags=['USE_FLASHROM=0']) return result