From patchwork Thu Aug 10 14:23:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 712348 Delivered-To: patch@linaro.org Received: by 2002:a05:6359:baf:b0:129:c516:61db with SMTP id gf47csp675380rwb; Thu, 10 Aug 2023 07:24:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGP1E7Eyk4S/quAq/u+46pOIbQ62F8rMan1ausnCIsLjNGWatzapflE06YPMnxRezF81yEv X-Received: by 2002:adf:e850:0:b0:317:eee2:6fba with SMTP id d16-20020adfe850000000b00317eee26fbamr2121502wrn.40.1691677476398; Thu, 10 Aug 2023 07:24:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691677476; cv=none; d=google.com; s=arc-20160816; b=n/Aruld5vYHC87JiawUFKkbE0YbYgq5pEISvUTA/jPMLnk/TjT2W+GnvoL0hoMP9Jp PlMXybwJoUiLsVZv7OBnKt51c/i2q1ydPC49Fv39paesL/NvK7OmbiSyjnsk2oLKsGmA X/DNap49sJc7rvcBvOoOSpXKyqpDCwuKF+/hyJd8fmyHV9gAHQYwAaAZ8UA4NKwf85Qq 16sHqM0odhzS3GRuwcW/7c+doakrCaBOKVyOnRvXrZf5lJKVdvr+rdYi1IOobbE34Sk2 CU7qujzZqsxGAZrLXWlpYqMFvm3ONrgL86K14MTZ4ALysyAC3MFndBZcymuYZrrJTyhg BmlA== 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=B2LIikxZfKnRv7LcBL+azK79ksUovXoZl9ayv4DDpgY=; fh=pvWoYJ8DnC9IyTD46q2s71hlWpPSBdE/YYp0/eyIYcc=; b=MMVpKXJMtcClt3FjjyQgAVGkCGkJcfQFniuCQ4ujc7zOjZflLb/f5Qp5hLFJY4U47X 16fvgvjocXUzGjVvLGVq715lZrUH4NUut3FRF/CgsbXcjxPzCn0BmicTwnNNWqkT3COO 2ozElsuh6RlpFInbrjMPuwoY6QCQxtrdzKCZECsfnf5p39PTAmpfiHzqjP//U2YT9SFC tBsP7SZq8x5L0OCembKEredPyC9v1B7SZXThZMDcPiZ27URH7kJ8DXita/4cyKdigmkU HcUsZt7QQr9zwKZf9oLoMkbXrzV2dW78peLVbwWt6bXaSEbzMWHcIA5PZEUgFz34mQeo i1XA== 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 v7-20020adff687000000b0031809d9b282si865408wrp.638.2023.08.10.07.24.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 07:24: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 4452A86894; Thu, 10 Aug 2023 16:24:25 +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 39F6D86851; Thu, 10 Aug 2023 16:24:23 +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 46BBA8681D for ; Thu, 10 Aug 2023 16:24:18 +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 D371A113E; Thu, 10 Aug 2023 07:24:59 -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 ADB343F64C; Thu, 10 Aug 2023 07:24:14 -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 v8 1/9] binman: bintool: Build a tool from a list of commands Date: Thu, 10 Aug 2023 19:53:30 +0530 Message-Id: <20230810142338.3402963-2-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230810142338.3402963-1-sughosh.ganu@linaro.org> References: <20230810142338.3402963-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 V7: 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")