From patchwork Tue Dec 4 04:08:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Weber X-Patchwork-Id: 1007436 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.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=collins.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=collins.com header.i=@collins.com header.b="JtLpDMEL"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4387gB5Gsgz9s8J for ; Tue, 4 Dec 2018 15:09:58 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id C4220810FA; Tue, 4 Dec 2018 04:09:56 +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 j9v5qyQ21Iox; Tue, 4 Dec 2018 04:09:49 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 89C5086E58; Tue, 4 Dec 2018 04:09:03 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 569E61C2BE9 for ; Tue, 4 Dec 2018 04:09:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 53A1B84845 for ; Tue, 4 Dec 2018 04:09:00 +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 UZYWlX7lGk25 for ; Tue, 4 Dec 2018 04:08:57 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx0a-00105401.pphosted.com (mx0b-00105401.pphosted.com [67.231.152.184]) by hemlock.osuosl.org (Postfix) with ESMTPS id DF0FC821F0 for ; Tue, 4 Dec 2018 04:08:56 +0000 (UTC) Received: from pps.filterd (m0075420.ppops.net [127.0.0.1]) by mx0a-00105401.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wB444nw7014997; Mon, 3 Dec 2018 23:08:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=collins.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=POD051818; bh=uTp92AhzvTYAIXCr9lUH16Wm9g/z2J8sFT4hPu9sdiU=; b=JtLpDMELOK7cBWvZgJ8W+NN1i6R2Iz6hTMQPIO7a1VVLsYkBf5ehACigX+U+3eHrlQ+l CI0mONDmP78zUJvOOEY2V1nOWSj/wx/+Kqw+RktaSIXlZII0znOJYyXSqnMvBI6Z7X4S mciD3x+0nGLA7NXQJKp9cydAg8Pk315GpfTuxtBy3nAwBQW3WIvZjjO8Zoc/Sr250DYe 4x9HtRgAI7b+hNpgTfPKZ0HxGluwTTg/9ULu0k+VCEPzseTM0KlV6xxSAdrV5T/yzWzn 3OuFEz3BPmhuWEwFEST3XVCBwpHCEMl1wLs1SB8LWcD5kRaGIHwPAgJFTM8xsbqECLbi nQ== Received: from xmnpv36.utc.com ([167.17.255.16]) by mx0a-00105401.pphosted.com with ESMTP id 2p3qt5jsmv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 03 Dec 2018 23:08:55 -0500 Received: from uusmna1r.utc.com (uusmna1r.utc.com [159.82.219.64]) by xmnpv36.utc.com (8.16.0.21/8.16.0.21) with ESMTPS id wB448s59026900 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 3 Dec 2018 23:08:54 -0500 Received: from ch3vs03.rockwellcollins.com ([10.172.224.19]) by uusmna1r.utc.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id wB448qwD004278 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 3 Dec 2018 23:08:53 -0500 Received: from ofwch3n02.rockwellcollins.com (HELO ciulimr02.rockwellcollins.com) ([205.175.226.14]) by ch3vs03.rockwellcollins.com with ESMTP; 03 Dec 2018 22:08:52 -0600 X-Received: from largo.rockwellcollins.com (unknown [192.168.140.76]) by ciulimr02.rockwellcollins.com (Postfix) with ESMTP id 9005D20079; Mon, 3 Dec 2018 22:08:52 -0600 (CST) From: Matt Weber To: buildroot@buildroot.org Date: Mon, 3 Dec 2018 22:08:46 -0600 Message-Id: <1543896530-33550-3-git-send-email-matthew.weber@rockwellcollins.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1543896530-33550-1-git-send-email-matthew.weber@rockwellcollins.com> References: <1543896530-33550-1-git-send-email-matthew.weber@rockwellcollins.com> X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812040034 Subject: [Buildroot] [PATCH v5 3/7] 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 MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Ricardo Martincoski Make the builder able to call 'VAR1=1 make VAR2=2 target'. Allow to send extra parameters to be added to the end of make command line. It can be used for these purposes: - to configure a br2-external, by passing 'BR2_EXTERNAL="dir"'; - to specify a make target, such as 'foo-source'. Allow to add variables to the environment in which make runs. It can be used to override values from environment, such as 'BR2_DL_DIR="dl"'. This change will be needed when adding support for br2-externals to the test infra. Signed-off-by: Ricardo Martincoski Cc: Arnout Vandecappelle Signed-off-by: Matt Weber --- Changes v2 - New from: http://patchwork.ozlabs.org/patch/912351/ v2 -> v3 [Ricardo - Updated patch commit description context. v4 - None v5 - Rebased post 2018.11 on master --- support/testing/infra/builder.py | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/support/testing/infra/builder.py b/support/testing/infra/builder.py index fc318fe..4d9c512 100644 --- a/support/testing/infra/builder.py +++ b/support/testing/infra/builder.py @@ -12,7 +12,18 @@ 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 +36,41 @@ 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: