From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <christian.ehrhardt@canonical.com>
Received: from mail-qk0-f175.google.com (mail-qk0-f175.google.com
 [209.85.220.175]) by dpdk.org (Postfix) with ESMTP id A6C4D2BD0
 for <dev@dpdk.org>; Tue, 28 Jun 2016 18:38:36 +0200 (CEST)
Received: by mail-qk0-f175.google.com with SMTP id q79so40008266qke.0
 for <dev@dpdk.org>; Tue, 28 Jun 2016 09:38:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=canonical-com.20150623.gappssmtp.com; s=20150623;
 h=mime-version:in-reply-to:references:from:date:message-id:subject:to
 :cc; bh=1FX4KO3/a3H0DgFNAIVRqNw0Uw8FicZ05x9mg2YtlD0=;
 b=1xzCt6qwD5darRwpVSl4hvJTtT9hDnEBibtipttwk0Kbwu/ocnI1+AiuDX8xe54xQi
 lZovO8GUj+AY13wLbh5Q+GgyD/Y3AG9MYwVL5Th2bGNPDMAUsB9dzTYSxcGuuqU4iZY7
 kT/MagHfeYs89RuK7TzWNLOFQALFk7Z8Mg0vG2UGpdKdPt4cSKjK4cdLc1bkUzUvHNwD
 xUr/staqC9FjyjRJhU5tiVb5VN4XnNJVT6XFYbg07XTb6M7dLrHlt8eKl75JYZka+ycP
 BYO0Sil50KlFkESB0YeJiMKw9/4i6eXTUWWM/W1yu2Nmi+8AagwowXPt7HtZvlBEPvMb
 1yFA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:mime-version:in-reply-to:references:from:date
 :message-id:subject:to:cc;
 bh=1FX4KO3/a3H0DgFNAIVRqNw0Uw8FicZ05x9mg2YtlD0=;
 b=RQafgoohUscNAO+f/qnj+e+d7fDjizOxSnthbhjgjHUHsBZH4bdv//7M5BCuOwCrqB
 XvM3sZhbOqDnwLZNYHsLUHRNlSf+TnyC20dCvdc1FuldeH8V7EhlOnhBwkgqxCaXQpw4
 PYXq5jPhVkyaEtSR9fP24+bPDjbIoykL3c9InznqWKFXl9RblQgqg72Ij59BZzEJqefs
 BUJZcxolfnFsScMlZW3B40lee4ZhMto2Sffl97L5JtiSATQHLaxd/Iz2ZV59N3Bed2ym
 QH1oglV7RJS9lKs9I1HK7rd0DHUhgtrV9BUigbVjSbyA6KYbpswBpLU88vR+prvTtKVO
 BAsA==
X-Gm-Message-State: ALyK8tKGfaxU2k4Vn/Q0IllExqW2BtdgPA0pHMJTVqPhI+g5biQ41bcW6SBAXDoydHN7xsx0/4taxVU6H7Ig+z7W
X-Received: by 10.55.22.154 with SMTP id 26mr3390319qkw.193.1467131915615;
 Tue, 28 Jun 2016 09:38:35 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.55.23.77 with HTTP; Tue, 28 Jun 2016 09:38:16 -0700 (PDT)
In-Reply-To: <5772A1C4.3030700@intel.com>
References: <CAATJJ0KgKO3nOYxVWs4-tHdFOJ7=Co-FWpdfNppXYCTOOrp=aA@mail.gmail.com>
 <1465830632-25156-1-git-send-email-christian.ehrhardt@canonical.com>
 <5772A1C4.3030700@intel.com>
From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Date: Tue, 28 Jun 2016 18:38:16 +0200
Message-ID: <CAATJJ0+Mh_pFHrJ_G3x0Z8i3xeCZu388evha5yiCya+1v8Bq-A@mail.gmail.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>, 
 Christian Ehrhardt <christian.ehrhardt@canonical.com>
Cc: Thomas Monjalon <thomas.monjalon@6wind.com>, dev <dev@dpdk.org>
Content-Type: text/plain; charset=UTF-8
X-Content-Filtered-By: Mailman/MimeDel 2.1.15
Subject: Re: [dpdk-dev] [RFC] mk: filter duplicate configuration entries
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 28 Jun 2016 16:38:37 -0000

On Tue, Jun 28, 2016 at 6:11 PM, Ferruh Yigit <ferruh.yigit@intel.com>
wrote:

> On 6/13/2016 4:10 PM, Christian Ehrhardt wrote:
> > Due to the hierarchy and the demand to keep the base config shoing all
> > options some options end up multiple times in the .config file.
> >
> > A suggested solution was to filter for duplicates at the end of the
> > actual config step which is implemented here.
> >
> > Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> > ---
> >  mk/rte.sdkconfig.mk | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
> > index a3acfe6..734aa06 100644
> > --- a/mk/rte.sdkconfig.mk
> > +++ b/mk/rte.sdkconfig.mk
> > @@ -70,6 +70,11 @@ config: notemplate
> >  else
> >  config: $(RTE_OUTPUT)/include/rte_config.h $(RTE_OUTPUT)/Makefile
> Not sure if this should go under this rule, or "$(RTE_OUTPUT)/.config:"
> and should work with ".config_tmp".
>
> >       $(Q)$(MAKE) depdirs
> > +     tac $(RTE_OUTPUT)/.config | awk --field-separator '=' '!/^#/
> {print $$1}' | while read config; do \
> Why reversing file since already checking all lines one by one in
> original file?
>

Hi,
every other comment is ok I'll rebase and resubmit once I find some time
again.
But for this (tac) the reason is simple - to keep behaviour.
Currently the last one wins.
So if you have
CONFIG_A=n
CONFIG_A=y

Essentially you have
CONFIG_A=y

By the tac and keeping the first occurrence we maintain behavior.
It is interestingly hard to "keep the last occurrence" without such tricks,
but I'm open to suggestions.


> And instead of checking each line, it is possible to get list of
> duplicates via "sort | uniq -d".
>

That would fail for the reasons outlined above.

Although less important, file comments also tripled in final .config.
>
> > +             if [ $$(grep "^$${config}=" $(RTE_OUTPUT)/.config | wc -l)
> -gt 1 ]; then \
> "grep -c" can be used instead of "grep | wc -l"
>
> > +                     sed -i "0,/$${config}/{//d}"
> $(RTE_OUTPUT)/.config; \
> > +             fi; \
> > +     done
> >       @echo "Configuration done"
> >  endif
> >
> >
>
>