Message ID | 1465830632-25156-1-git-send-email-christian.ehrhardt@canonical.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Thomas Monjalon |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 29756567C; Mon, 13 Jun 2016 17:10:38 +0200 (CEST) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by dpdk.org (Postfix) with ESMTP id E8962567A for <dev@dpdk.org>; Mon, 13 Jun 2016 17:10:36 +0200 (CEST) Received: from 1.general.paelzer.uk.vpn ([10.172.196.172] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from <christian.ehrhardt@canonical.com>) id 1bCTVa-0006ZX-Pe; Mon, 13 Jun 2016 15:10:34 +0000 From: Christian Ehrhardt <christian.ehrhardt@canonical.com> To: christian.ehrhardt@canonical.com, ferruh.yigit@intel.com, thomas.monjalon@6wind.com, dev@dpdk.org Date: Mon, 13 Jun 2016 17:10:32 +0200 Message-Id: <1465830632-25156-1-git-send-email-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <CAATJJ0KgKO3nOYxVWs4-tHdFOJ7=Co-FWpdfNppXYCTOOrp=aA@mail.gmail.com> References: <CAATJJ0KgKO3nOYxVWs4-tHdFOJ7=Co-FWpdfNppXYCTOOrp=aA@mail.gmail.com> Subject: [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> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Christian Ehrhardt
June 13, 2016, 3:10 p.m. UTC
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(+)
Comments
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? And instead of checking each line, it is possible to get list of duplicates via "sort | uniq -d". 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 > >
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 > > > > > >
On 6/28/2016 5:38 PM, Christian Ehrhardt wrote: > On Tue, Jun 28, 2016 at 6:11 PM, Ferruh Yigit <ferruh.yigit@intel.com > <mailto: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 > <mailto:christian.ehrhardt@canonical.com>> > > --- > > mk/rte.sdkconfig.mk <http://rte.sdkconfig.mk> | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/mk/rte.sdkconfig.mk <http://rte.sdkconfig.mk> b/mk/rte.sdkconfig.mk > <http://rte.sdkconfig.mk> > > index a3acfe6..734aa06 100644 > > --- a/mk/rte.sdkconfig.mk <http://rte.sdkconfig.mk> > > +++ b/mk/rte.sdkconfig.mk <http://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. Correct, but if I am not missing something, reversing doesn't help to this, how lines deleted taking care of this: sed -i "0,/$${config}/{//d}" $(RTE_OUTPUT)/.config; sed works on original file, and deletes first occurrence, independent from lines from bottom to up, or up to bottom fed into it. > 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 > > > > > >
Hi, thanks a lot for your feedback. I looked at it once more and found some issues - the tac was correct, but at the wrong place. Also I could simplify the inner section at least a bit. I agree to the move to the .config target. I'll submit a v2 now to this thread. Here is the diff it generates for a: "make V=1 T=x86_64-native-linuxapp-gcc config" http://paste.ubuntu.com/18163566/ Christian Ehrhardt Software Engineer, Ubuntu Server Canonical Ltd On Tue, Jun 28, 2016 at 6:48 PM, Ferruh Yigit <ferruh.yigit@intel.com> wrote: > On 6/28/2016 5:38 PM, Christian Ehrhardt wrote: > > On Tue, Jun 28, 2016 at 6:11 PM, Ferruh Yigit <ferruh.yigit@intel.com > > <mailto: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 > > <mailto:christian.ehrhardt@canonical.com>> > > > --- > > > mk/rte.sdkconfig.mk <http://rte.sdkconfig.mk> | 5 +++++ > > > 1 file changed, 5 insertions(+) > > > > > > diff --git a/mk/rte.sdkconfig.mk <http://rte.sdkconfig.mk> b/mk/ > rte.sdkconfig.mk > > <http://rte.sdkconfig.mk> > > > index a3acfe6..734aa06 100644 > > > --- a/mk/rte.sdkconfig.mk <http://rte.sdkconfig.mk> > > > +++ b/mk/rte.sdkconfig.mk <http://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. > > Correct, but if I am not missing something, reversing doesn't help to this, > how lines deleted taking care of this: > sed -i "0,/$${config}/{//d}" $(RTE_OUTPUT)/.config; > > sed works on original file, and deletes first occurrence, independent > from lines from bottom to up, or up to bottom fed into it. > > > 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 > > > > > > > > > > > >
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 $(Q)$(MAKE) depdirs + tac $(RTE_OUTPUT)/.config | awk --field-separator '=' '!/^#/ {print $$1}' | while read config; do \ + if [ $$(grep "^$${config}=" $(RTE_OUTPUT)/.config | wc -l) -gt 1 ]; then \ + sed -i "0,/$${config}/{//d}" $(RTE_OUTPUT)/.config; \ + fi; \ + done @echo "Configuration done" endif