From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas@monjalon.net>
Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com
 [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 9888E2BB5;
 Fri,  1 Mar 2019 22:08:28 +0100 (CET)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id 2483A22200;
 Fri,  1 Mar 2019 16:08:28 -0500 (EST)
Received: from mailfrontend2 ([10.202.2.163])
 by compute1.internal (MEProxy); Fri, 01 Mar 2019 16:08:28 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding:content-type; s=mesmtp;
 bh=YNRvI70VaujODN7LAojxoSPVHQWPz65qsxm1FmgFvGM=; b=Z7AvZAUng6O4
 TmtGcyfDYxr4a4FrH0EsBI7C10CbCNY182SvmWZb+doYDsclZnBOWHlh2n8Ybhvu
 izw3wvsFHSkw+I3XRdwY14BrgZOh9c3R1j2N2+f7j3VszN4HzC2x1Q+HmnoMUahp
 iICaol0DzWF+Fny3pY/axqw2BS7Dicc=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :date:from:in-reply-to:message-id:mime-version:references
 :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender
 :x-sasl-enc; s=fm2; bh=YNRvI70VaujODN7LAojxoSPVHQWPz65qsxm1FmgFv
 GM=; b=ctrR/TytTWAaDbvX2zQpMQqIXVcOZk3ZDAaZ7Mj56tBn7OCqnlSoQltLx
 UMqwDc8K0ConO5J+seqc7aYmlqzQyEkm/zXD3Zzdkmmie74eO81v9ycFYc8AlNTl
 49CxTWdl6eNETR/jJ6DQBhm7Efaap581/mHyp525NPhUBlLHhhP4xLELOVNn0FeI
 zxUbBNe8SJ2BM1J20+sKG5JRkIWk7aUEjSfsIfVWWJ3kfpNfmSWmfUNv54JO7Nva
 BmQWVrAFDjBwqlJQpUVYJ3/XnVfQvv36cNX30JSfnWw9lIu2cDrGaCKQ0mi1Xbke
 TzIq+hl34T16RbZaHE24iDSsNPucA==
X-ME-Sender: <xms:S595XAT0nyuiLR2oQNRWjxkiJmpG5v_kCiQLYB5j-sTwI-lPA4xNxg>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrvdehgddugeeiucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr
 shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecukf
 hppeejjedrudefgedrvddtfedrudekgeenucfrrghrrghmpehmrghilhhfrhhomhepthhh
 ohhmrghssehmohhnjhgrlhhonhdrnhgvthenucevlhhushhtvghrufhiiigvpedt
X-ME-Proxy: <xmx:S595XONEc8-JHhF4tO5WdSKYtFynAefGzHU2IQxyJbaMeQGyPYubkg>
 <xmx:S595XDSK-hOa9GUbGQ12wdhy9mQ4cdszBHegjesNbpNqJJKAXKWeJg>
 <xmx:S595XB_n_y_Rk7lZan-k4rlTzPZH8tDxMzkn0Pi6GB7LwO3VAOMMRg>
 <xmx:TJ95XC7ofUje3ElS8LHrfBTGpuSbA_04cjCyRnd7PbgQ1jst-r3r8w>
Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id B840610310;
 Fri,  1 Mar 2019 16:08:23 -0500 (EST)
From: Thomas Monjalon <thomas@monjalon.net>
To: msantana@redhat.com
Cc: dev@dpdk.org, stable@dpdk.org,
 Bruce Richardson <bruce.richardson@intel.com>,
 Van Haaren Harry <harry.van.haaren@intel.com>, ramirose@gmail.com
Date: Fri, 01 Mar 2019 22:08:18 +0100
Message-ID: <2081114.IUId4rgEkx@xps>
In-Reply-To: <5bfdfd39-8d04-dc88-ccc1-16ba9377f9ec@redhat.com>
References: <20190214193547.30783-1-msantana@redhat.com>
 <7663396.UzxFzaq1Qb@xps> <5bfdfd39-8d04-dc88-ccc1-16ba9377f9ec@redhat.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH v3 1/2] Enable codespell by
	default. Can be disabled from config file.
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 01 Mar 2019 21:08:28 -0000

01/03/2019 21:24, Michael Santana Francisco:
> On 3/1/19 12:51 PM, Thomas Monjalon wrote:
> > 01/03/2019 18:43, Thomas Monjalon:
> >> 01/03/2019 18:08, Michael Santana:
> >>> +# Enable codespell by default. This can be overwritten from a config file.
> >>> +# You can also enable codespell by setting DPDK_CHECKPATCH_CODESPELL to a valid path
> >>> +# to a dictionary.txt file if your dictionary.txt is not in the default location.
> > This line length won't pass chekpatch ;)
> >
> >> Better to avoid "you" form in such comment.
> >>
> >>> +DPDK_CHECKPATCH_CODESPELL=enable
> > It will override the value if passed with an environment variable.
> > You should do the same as for DPDK_CHECKPATCH_LINE_LENGTH.
> If I understood you correctly, you want to be able to set these 
> parameters via environment variables (and take precedence over any 
> variables set in any config file)

No :)
The scenario is to have no config file and use environment variables only.

> The problem is right now that any environment variable is overwritten by 
> the variable being set in one of the config files
> The only way I can think of doing this would be by saving the DPDK 
> variables (passed via environment) to a file or ironically temporary 
> variables (which themselves can also be overwritten, so that doesn't 
> really solve the problem) before being overwritten, and then restoring 
> said variables after the call to source.
> This would add extra clutter in checkpatches, but it can be avoided by 
> doing it in load-devel-config instead.
> 
> So the bottom line is, environment variables take overall precedence, 
> then config files, and then default
> 
> Does this sound sane enough?
> If anyone knows a better way to do this please share.

Look how DPDK_CHECKPATCH_LINE_LENGTH is handled.
The default value is used if DPDK_CHECKPATCH_LINE_LENGTH is not set,
neither by environment nor config file.

I think you can just do this after loading config file:

DPDK_CHECKPATCH_CODESPELL=${DPDK_CHECKPATCH_CODESPELL:-enable}

or check for empty value in the test:

[ -z "$DPDK_CHECKPATCH_CODESPELL" -o "$DPDK_CHECKPATCH_CODESPELL" = enable ]


> I am including in DPDK_CHECKPATCH_PATH, because might as well at this 
> point.

Empty DPDK_CHECKPATCH_PATH is already handled.

> >
> >>>   # Load config options:
> >>>   # - DPDK_CHECKPATCH_PATH
> >>>   # - DPDK_CHECKPATCH_LINE_LENGTH
> >>> +# - DPDK_CHECKPATCH_CODESPELL
> >>>   . $(dirname $(readlink -e $0))/load-devel-config
> >>>   
> >>>   VALIDATE_NEW_API=$(dirname $(readlink -e $0))/check-symbol-change.sh
> >>> @@ -13,6 +18,12 @@ length=${DPDK_CHECKPATCH_LINE_LENGTH:-80}
> >>>   
> >>>   # override default Linux options
> >>>   options="--no-tree"
> >>> +if [ "$DPDK_CHECKPATCH_CODESPELL" == "enable" ]; then
> >> This is a bashism.
> >> Standard sh uses a simple =
> >>
> >> No need for a v4, I can fix it.
> > Because of the required change for the env var case,
> > please do a v4.