From patchwork Mon Jan 28 23:22:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Duskett X-Patchwork-Id: 1032309 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="sYn6JGCm"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43pQf56CJ0z9sN6 for ; Tue, 29 Jan 2019 10:22:53 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 59BB4876C3; Mon, 28 Jan 2019 23:22:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qYw8ykxv0WuC; Mon, 28 Jan 2019 23:22:47 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id B236787697; Mon, 28 Jan 2019 23:22:47 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 1002F1BF2C8 for ; Mon, 28 Jan 2019 23:22:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 0C14186406 for ; Mon, 28 Jan 2019 23:22:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id votN87PjNo+x for ; Mon, 28 Jan 2019 23:22:44 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) by whitealder.osuosl.org (Postfix) with ESMTPS id 4D36984540 for ; Mon, 28 Jan 2019 23:22:44 +0000 (UTC) Received: by mail-io1-f67.google.com with SMTP id r200so15010234iod.11 for ; Mon, 28 Jan 2019 15:22:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=K1Dl6BWVvwLg147KSJjh/dFla+WLbV2djrL80ctLA1I=; b=sYn6JGCm7VikSrpxk6NiY+GP/Jb5wu8wT7pXClDvgcspXS4pi4OdsRkvHWWiukG7ZL AA066iqUA0OBwo/+TtAiRkdphe2YKM8nNMK8unDupVnQz63nNQicx04axinAfYkTw2IO LsZppC8Mcar8FwK/ldWGBzB/lJwzAJA23Mu+eNNZGCZ+lHPYfoEuuzv4xQic1biprN4J 7B98gkI0pesyyd5yfE8L+tT7sHqVJB4suNeWLJyYmxA6aQaLGcc3iyW66UgFC9Yy9vjv BuT/Q361cE8t1unQR8kcHHxqM/p+/jEO3HEur/v0g7o9ubfQ44BJn81aEIlZTNW66O+w dXrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K1Dl6BWVvwLg147KSJjh/dFla+WLbV2djrL80ctLA1I=; b=QMYJF8e3muYZwiiAsOES51h0h4Id6xXZ9JscixG+/2PDKDaURceDlTBC31gzh90r9X NxeAeJ0WMW0COtSLFgmkNQBlJhdy4JC0u+5NWNnYGz8jtln92lHt+6V4smtBTil4kzfB Po/0Sw0EJNySrW4hx5/xZbv/DVG35tOWMKUwcTzLC0w1EU5nn/YH5wQ4TW/5rnotwEJi 1mih0zpXFwXykcsM9Zae/X/bccDE/7S4paA3zigs79PTwFSe7DJRu3OK6WKukf3VR2qD JfxiDcmROBL/OrMzQL9yqUWhgO/NgS+Xc423GRZYo72BkrR9pYqzoO/H6GSyaWctL758 FUcg== X-Gm-Message-State: AJcUukces8oc8dnAkzkoDE6g+UiuVxnz7xKfYi8LnX8nlTJuCYIOvDKa aTvyRmOwq4ltVU2Z6VKecfxl3az/ X-Google-Smtp-Source: AHgI3IZbhDicG2U8qg56iQIieI0XQdk56UKeDRuDuXES5KMYGf5/H878gCI2W5O6M3sfZgZJdCsDmQ== X-Received: by 2002:a6b:7113:: with SMTP id q19mr14231528iog.9.1548717763308; Mon, 28 Jan 2019 15:22:43 -0800 (PST) Received: from localhost.localdomain (68-188-149-81.dhcp.aldl.mi.charter.com. [68.188.149.81]) by smtp.gmail.com with ESMTPSA id r195sm492325ita.3.2019.01.28.15.22.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 15:22:42 -0800 (PST) From: aduskett@gmail.com To: buildroot@buildroot.org Date: Mon, 28 Jan 2019 18:22:05 -0500 Message-Id: <20190128232209.17485-2-aduskett@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190128232209.17485-1-aduskett@gmail.com> References: <20190128232209.17485-1-aduskett@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v3 1/5] testing/infra/builder: build with target and environment X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ricardo Martincoski , dleach@belcan.com, matthew.weber@collins.com, Adam Duskett Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Ricardo Martincoski Make the builder able to call 'VAR1=1 make VAR2=2 target'. Allow sending extra parameters to be added to the end of make command line. Uses for these purposes: - to configure a br2-external, using the 'BR2_EXTERNAL="dir" variable. - to specify a make target, such as 'foo-source.' Allow adding variables to the environment when calling make. These added variables allow a user to override default values from BuildRoot, such as 'BR2_DL_DIR="dl"'. Signed-off-by: Ricardo Martincoski Cc: Arnout Vandecappelle Signed-off-by: Matt Weber Signed-off-by: Daniel J. Leach Signed-off-by: Adam Duskett --- Changes v1 -> v3: - Added this patch to the series. support/testing/infra/builder.py | 36 ++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/support/testing/infra/builder.py b/support/testing/infra/builder.py index fc318fe26e..018747555d 100644 --- a/support/testing/infra/builder.py +++ b/support/testing/infra/builder.py @@ -12,7 +12,17 @@ class Builder(object): self.builddir = builddir self.logfile = infra.open_log_file(builddir, "build", logtofile) - def configure(self): + def configure(self, make_extra_opts=[], make_extra_env={}): + """Configure the build. + + make_extra_opts: a list of arguments to be passed to the make + command. + e.g. make_extra_opts=["BR2_EXTERNAL=/path"] + + make_extra_env: a dict of variables to be appended (or replaced) + in the environment that calls make. + e.g. make_extra_env={"BR2_DL_DIR": "/path"} + """ if not os.path.isdir(self.builddir): os.makedirs(self.builddir) @@ -25,22 +35,40 @@ class Builder(object): self.logfile.flush() env = {"PATH": os.environ["PATH"]} + env.update(make_extra_env) + cmd = ["make", - "O={}".format(self.builddir), - "olddefconfig"] + "O={}".format(self.builddir)] + cmd += make_extra_opts + cmd += ["olddefconfig"] + ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile, env=env) if ret != 0: raise SystemError("Cannot olddefconfig") - def build(self): + def build(self, make_extra_opts=[], make_extra_env={}): + """Perform the build. + + make_extra_opts: a list of arguments to be passed to the make + command. It can include a make target. + e.g. make_extra_opts=["foo-source"] + + make_extra_env: a dict of variables to be appended (or replaced) + in the environment that calls make. + e.g. make_extra_env={"BR2_DL_DIR": "/path"} + """ env = {"PATH": os.environ["PATH"]} if "http_proxy" in os.environ: self.logfile.write("Using system proxy: " + os.environ["http_proxy"] + "\n") env['http_proxy'] = os.environ["http_proxy"] env['https_proxy'] = os.environ["http_proxy"] + env.update(make_extra_env) + cmd = ["make", "-C", self.builddir] + cmd += make_extra_opts + ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile, env=env) if ret != 0: